rails 2.3 rspec 1.3 undefined method `get' for #<RSpec::ExampleGroups:: -


i keep getting error message.

  1) worker::homecontroller #index has 200 status code      failure/error: :home      nomethoderror:        undefined method `get' #<rspec::examplegroups::workerhomecontroller::getindex:0x2ba04c836f18>      # ./spec/controllers/worker/home_controller_spec.rb:14  finished in 0.12277 seconds (files took 2 minutes 59.7 seconds load) 1 example, 1 failure 

i using these gems

group :development, :test   gem "rspec", "~> 1.3"   gem "rspec-rails", "~> 1.3"   gem "nokogiri", "1.3.3"   gem "rubyzip", "0.9.7"   gem "capybara", "2.0.0"   gem "database_cleaner", "1.4.1"   gem "factory_girl", "2.5.0"   gem "rspec-core", "3.3.0" end 

this issue related rspec config far understand

following spec file

require 'spec_helper' require 'factory_girl' require 'date'  rspec.describe worker::homecontroller, :type => :controller    before :each     factory.create(:zipcode, :zip => "60290")   end    describe "get #index"      "has 200 status code"       :home       response.code.should eq("200")     end   end end 

the project directory structure :

app   controllers     worker       home_controller.rb spec   controllers     worker       home_controller_spec.rb 

rspec 2.x assume in controllers directory controller spec.

this changed in rspec 3:

file-type inference disabled default

previously automatically inferred spec type file location, surprising behaviour new users , undesirable veteran users rspec 3 onwards behaviour must explicitly opted with:

rspec.configure |config|   config.infer_spec_type_from_file_location! end 

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#file-type-inference-disabled

also not forgot require 'rspec/rails'


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -