Estoy configurando mi entorno de prueba con Rspec + Capybara, pero obtengo esta última respuesta indefinida. Estaba buscando en la web y SO. Encontré un par de cosas sobre la versión, uso git repo en lugar de rubygem source, etc ... Pero no cambia una pista para mí.Rspec + Capybara: undefined last_response
Aquí el trazado inverso: rspec especificación --backtrace/controladores/api/plist/providers_listing_spec.rb fracasos:
1) Api::Plist::ProvidersController should return a successfull plist containing a list of providers
Failure/Error: last_response.status.shoud be_success
NameError:
undefined local variable or method `last_response' for #<RSpec::Core::ExampleGroup::Nested_1:0x105658e10>
# ./.gems/ruby/1.8/gems/rspec-expectations-2.6.0/lib/rspec/matchers/method_missing.rb:9:in `method_missing'
# ./.gems/ruby/1.8/gems/actionpack-3.0.5/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
# ./spec/controllers/api/plist/providers_listing_spec.rb:19
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
# /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'`
Aquí está mi configuración de la gema para la prueba:
gem 'ruby-prof' # perf
gem 'rspec-rails', :git => 'git://github.com/rspec/rspec-rails.git'
gem 'shoulda' # Shoulda
gem 'factory_girl_rails' #=> mocking
gem 'capybara', :git => "http://github.com/jnicklas/capybara.git"
gem 'database_cleaner'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i #guard mac dependency
gem 'guard-livereload' # browser reloading
gem 'guard-rspec'
gem 'guard-test'
gem 'growl' #grow notification
I Estoy usando database_clearner para tratar con mongo db ...
Y hasta ahora no uso:
require 'spec_helper'
describe Api::Plist::ProvidersController, :type => :api do
let (:user) {Factory(:confirmed_user)}
let (:api_account) {user.new_api_account}
let (:api_token) {api_account.authentication_token}
let (:email) {api_account.email}
it "should return a successfull plist containing a list of providers" do
get 'index', :auth_token => api_token, :email => email
last_response.status.shoud be_success
last_response.body.should eql({:sucess => true}.to_plist.to_s)
end
end
Estos son los mensajes que ya ha leído, incluso si hablan principalmente acerca webrat ...:
- http://codingfrontier.com/integration-testing-setup-with-rspec-2-and-ca
- https://github.com/rspec/rspec-rails/issues/174
- ...
Si Alguien tiene una idea de qué hacer, qué versión de gema usar?