Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy I would be getting a "method_missing" error when calling "should respond_with :success" in context block?
    text
    copied!<p>Here is a gist of the error and test: <a href="https://gist.github.com/1445801" rel="nofollow">https://gist.github.com/1445801</a></p> <p>And here are the gist contents:</p> <pre><code>require 'test_helper' class Api::HotelsControllerTest &lt; ActionController::TestCase context "When not logged in" do should "forbid access when creating a hotel" do hotel = Factory.build(:hotel) post :create, :hotel =&gt; hotel assert @response.code == "401" assert Hotel.count.zero? end should "forbid access when listing available hotels" do get :available assert @response.code == "401" end should "forbid access when listing hotels" do get :index assert @response.code == "401" end should "forbid access when showing a hotel" do hotel = Factory(:hotel) get :show, :id =&gt; hotel.id assert @response.code == "401" end should "forbid when updating a hotel" do hotel = Factory(:hotel) hotel.name = "Some new Hotel name" put :update, :id =&gt; hotel.id, :hotel =&gt; hotel assert @response.code == "401" end end context "When logged in as basic user" do setup do @user = Factory(:user) sign_in @user end context "on GET available hotel with no search criteria" do setup do get :available end should respond_with :success should "be valid response" do true end end end end </code></pre> <p>And the test:</p> <pre><code>** Invoke test (first_time) ** Execute test ** Invoke test:units (first_time) ** Invoke test:prepare (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load NOTICE: CREATE TABLE will create implicit sequence "addresses_id_seq" for serial column "addresses.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "addresses_pkey" for table "addresses" NOTICE: CREATE TABLE will create implicit sequence "amenities_id_seq" for serial column "amenities.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "amenities_pkey" for table "amenities" NOTICE: CREATE TABLE will create implicit sequence "hotels_id_seq" for serial column "hotels.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "hotels_pkey" for table "hotels" NOTICE: CREATE TABLE will create implicit sequence "locations_id_seq" for serial column "locations.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "locations_pkey" for table "locations" NOTICE: CREATE TABLE will create implicit sequence "photos_id_seq" for serial column "photos.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "photos_pkey" for table "photos" NOTICE: CREATE TABLE will create implicit sequence "rooms_id_seq" for serial column "rooms.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "rooms_pkey" for table "rooms" NOTICE: CREATE TABLE will create implicit sequence "user_hotel_taggings_id_seq" for serial column "user_hotel_taggings.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "user_hotel_taggings_pkey" for table "user_hotel_taggings" NOTICE: CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" ** Execute test:prepare ** Execute test:units ** Invoke test:functionals (first_time) ** Invoke test:prepare ** Execute test:functionals /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:429:in `method_missing': undefined method `respond_with' for Api::HotelsControllerTest:Class (NoMethodError) from /Users/Eric/Work/webapp/test/functional/api/hotels_controller_test.rb:48:in `block (2 levels) in &lt;class:HotelsControllerTest&gt;' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in `call' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in `merge_block' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:301:in `initialize' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:310:in `new' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:310:in `context' from /Users/Eric/Work/webapp/test/functional/api/hotels_controller_test.rb:43:in `block in &lt;class:HotelsControllerTest&gt;' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in `call' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in `merge_block' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:301:in `initialize' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:199:in `new' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:199:in `context' from /Users/Eric/Work/webapp/test/functional/api/hotels_controller_test.rb:37:in `&lt;class:HotelsControllerTest&gt;' from /Users/Eric/Work/webapp/test/functional/api/hotels_controller_test.rb:3:in `&lt;top (required)&gt;' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in &lt;main&gt;' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in &lt;main&gt;' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select' from /Users/Eric/Work/webapp/.bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `&lt;main&gt;' ** Invoke test:integration (first_time) ** Invoke test:prepare ** Execute test:integration Errors running test:functionals! rake test TESTOPTS="-v" --trace 14.58s user 1.96s system 89% cpu 18.499 total </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload