That’s the proper way to run the specs, right?
However, perhaps I didn’t explain myself correctly in my previous message, but I do get the specs to run. The problem is that I get the following errors:
Failures:
1) Babble::TopicsController post does not affect user's post count
Failure/Error: expect { xhr :post, :create_post, raw: "I am a test post", id: topic.id }.not_to change { user.post_count }
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6073", :raw=>"I am a test post"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:128:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:128:in `block (3 levels) in <top (required)>'
2) Babble::TopicsController post cannot create a post in a topic the user does not have access to
Failure/Error: expect { xhr :post, :create_post, raw: "I am a test post!", id: topic.id }.not_to change { topic.posts.count }
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6075", :raw=>"I am a test post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:117:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:117:in `block (3 levels) in <top (required)>'
3) Babble::TopicsController post does not allow posts from users who are not logged in
Failure/Error: expect { xhr :post, :create_post, raw: "I am a test post", id: topic.id }.not_to change { topic.posts.count }
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6077", :raw=>"I am a test post"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:122:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:122:in `block (3 levels) in <top (required)>'
4) Babble::TopicsController post adds a new post to the chat topic
Failure/Error: expect { xhr :post, :create_post, raw: "I am a test post", id: topic.id }.to change { topic.posts.count }.by(1)
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6079", :raw=>"I am a test post"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:93:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:93:in `block (3 levels) in <top (required)>'
5) Babble::TopicsController post can add a short post to the chat topic
Failure/Error: expect { xhr :post, :create_post, raw: "Hi!", id: topic.id }.to change { topic.posts.count }.by(1)
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6081", :raw=>"Hi!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:105:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:105:in `block (3 levels) in <top (required)>'
6) Babble::TopicsController post does not allow posts with no content to be made
Failure/Error: expect { xhr :post, :create_post, id: topic.id }.not_to change { topic.posts.count }
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6083"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:111:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:111:in `block (3 levels) in <top (required)>'
7) Babble::TopicsController post returns the raw value of the post
Failure/Error: xhr :post, :create_post, raw: "I am a test post", id: topic.id
ActionController::UrlGenerationError:
No route matches {:action=>"create_post", :controller=>"babble/topics", :id=>"6085", :raw=>"I am a test post"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:99:in `block (3 levels) in <top (required)>'
8) Babble::TopicsController update_post ensures the post belongs to the topic
Failure/Error: xhr :post, :update_post, raw: raw, id: another_topic.id, post_id: topic_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6098", :post_id=>"5842", :raw=>"Here is an updated post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:201:in `block (3 levels) in <top (required)>'
9) Babble::TopicsController update_post does not allow updates from users who are not logged in
Failure/Error: xhr :post, :update_post, raw: raw, id: topic.id, post_id: topic_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6099", :post_id=>"5844", :raw=>"Here is an updated post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:189:in `block (3 levels) in <top (required)>'
10) Babble::TopicsController update_post does not allow updates to posts the user can't edit
Failure/Error: xhr :post, :update_post, raw: raw, id: topic.id, post_id: another_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6101", :post_id=>"5847", :raw=>"Here is an updated post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:175:in `block (3 levels) in <top (required)>'
11) Babble::TopicsController update_post does not allow posts to be updated to no content
Failure/Error: xhr :post, :update_post, raw: '', id: topic.id, post_id: topic_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6103", :post_id=>"5848", :raw=>""}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:195:in `block (3 levels) in <top (required)>'
12) Babble::TopicsController update_post updates an existing post
Failure/Error: expect { xhr :post, :update_post, raw: raw, id: topic.id, post_id: topic_post.id }.not_to change { topic.posts.count }
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6105", :post_id=>"5850", :raw=>"Here is an updated post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:167:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:167:in `block (3 levels) in <top (required)>'
13) Babble::TopicsController update_post allows admins to update others' posts
Failure/Error: xhr :post, :update_post, raw: raw, id: topic.id, post_id: topic_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"update_post", :controller=>"babble/topics", :id=>"6107", :post_id=>"5852", :raw=>"Here is an updated post!"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:183:in `block (3 levels) in <top (required)>'
14) Babble::TopicsController destroy_post allows admins to delete others' posts
Failure/Error: expect { xhr :post, :destroy_post, id: topic.id, post_id: target_post.id }.to change { topic.posts.count }.by(-1)
ActionController::UrlGenerationError:
No route matches {:action=>"destroy_post", :controller=>"babble/topics", :id=>"6111", :post_id=>"5858"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:157:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:157:in `block (3 levels) in <top (required)>'
15) Babble::TopicsController destroy_post deletes an existing post
Failure/Error: expect { xhr :post, :destroy_post, id: topic.id, post_id: target_post.id }.to_not change { topic.posts.count }
ActionController::UrlGenerationError:
No route matches {:action=>"destroy_post", :controller=>"babble/topics", :id=>"6113", :post_id=>"5861"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:141:in `block (4 levels) in <top (required)>'
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:141:in `block (3 levels) in <top (required)>'
16) Babble::TopicsController destroy_post does not allow deleting of posts the user can't delete
Failure/Error: xhr :post, :destroy_post, id: topic.id, post_id: another_post.id
ActionController::UrlGenerationError:
No route matches {:action=>"destroy_post", :controller=>"babble/topics", :id=>"6115", :post_id=>"5863"}
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:149:in `block (3 levels) in <top (required)>'
17) Babble::TopicsController update does not allow non-admins to update topics
Failure/Error: expect(Babble::Topic.find(id: topic.id).title).to_not eq chat_params[:title]
NoMethodError:
undefined method `find' for Babble::Topic:Class
Did you mean? find_by
# ./plugins/babble/spec/controllers/topics_controller_spec.rb:301:in `block (3 levels) in <top (required)>'
Finished in 21.43 seconds (files took 7.29 seconds to load)
43 examples, 17 failures