Closed godzilla74 closed 9 years ago
Are you using version 4.2 of rails?
@kurenn I started matching your GemFile from Chapter 1, which had rails 4.0.2
, I just changed to rails 4.2.0
, ran bundle update
& bundle install
, still getting the same rspec errors.
The respond_with method was taken out from Rails 4.2, you can still get this behavior with the responders gem.
Let me know how it goes!
@kurenn Tried to add the responders
gem, which indicated I only need to run bundle install
to support backwards compatibility, didn't work!
Switched back to rails 4.0.2
, removed responders
, and still getting the same error. I'm stumped at this point.
I did not notice, it as a Rspec error, which version are you using?
@kurenn rspec-core 2.99.2
Try using rspec-rails version 2.14, that should fix the problem
@kurenn Changed Gemfile
to:
group :test do
gem "rspec-rails", "2.14"
gem 'shoulda-matchers'
end
Still no luck though!
Api::V1::ProductsController GET #show
Failure/Error: it { should respond_with 200 }
NoMethodError:
undefined method `respond_with' for # <RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fad924af4b0>
# ./spec/controllers/api/v1/products_controller_spec.rb:21:in `block (3 levels) in <top (required)>'
I also grabbed your version of products_controller_spec.rb on the Chapter7 branch just to make sure I didn't have any misconfigs.
It has to be then with Shoulda Matchers, you think you can match the version on the repo?
That was it!
This is what my Gemfile to looks like, in case you want to update the tutorial:
group :test do
gem "rspec-rails", "2.14"
gem 'shoulda-matchers', "2.6.1"
end
Thanks!
Thanks to you! =)
I made the changes in section 7.9 to
product_controllers_spec.rb
andproduct_controllers.rb
and now my tests are failing. Before doing these steps, my tests were green.