My app is builded with rails 2.3.12, rspec-rails 1.3.2, webrat 0.7.3.
My spec_helper.rb
ENV[“RAILS_ENV”] ||= ‘test’
require
File.expand_path(File.join(File.dirname(FILE),’…’,‘config’,‘environment’))
require ‘spec/autorun’
require ‘spec/rails’
require ‘webrat’
Dir[File.expand_path(File.join(File.dirname(FILE),‘support’,’**’,’*.rb’))].each
{|f| require f}
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false # prevents webrat from opening the
browser
end
Uncomment the next line to use webrat’s matchers
require ‘webrat/integrations/rspec-rails’
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + ‘/spec/fixtures/’
include Webrat::Methods
#config.include Webrat::Matchers, :type => :views
end
My spec:
require ‘spec_helper’
describe “Campaign” do
describe “in first step” do
before(:each) do
@user = Factory(:user)
@campaign = Factory(:campaign, :owner => @user)
end
it "should have an owner" do
@campaign.owner.should == @user
end
it "testing request" do
visit "/"
end
end
end
I get:
ActionView::TemplateError in ‘Campaign in first step should have an
owner’
super: no superclass method `response’ for #<DeviseMailer:
0x7f29a3a07610>
In app/views/devise_mailer/confirmation_instructions.html.erb
webrat (0.7.3) lib/webrat/core/methods.rb:31:in `response'
/usr/lib/ruby/gems/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/
extensions/action_view/base.rb:27:in render' devise (1.0.9) app/models/devise_mailer.rb:42:in
render_with_scope’
devise (1.0.9) app/models/devise_mailer.rb:31:in setup_mail' devise (1.0.9) app/models/devise_mailer.rb:7:in
confirmation_instructions’
devise (1.0.9) lib/devise/models/confirmable.rb:61:in
send_confirmation_instructions' /usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/ proxy/create.rb:9:in
result’
/usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/
factory.rb:86:in run' /usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/ syntax/methods.rb:54:in
create’
/usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/
syntax/vintage.rb:53:in send' /usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/ syntax/vintage.rb:53:in
default_strategy’
/usr/lib/ruby/gems/1.8/gems/factory_girl-2.0.3/lib/factory_girl/
syntax/vintage.rb:146:in Factory' spec/models/campaign_spec.rb:7 rspec (1.3.0) lib/spec/example/example_methods.rb:74:in
instance_eval’
rspec (1.3.0) lib/spec/example/example_methods.rb:74:in
eval_each_fail_fast' rspec (1.3.0) lib/spec/example/example_methods.rb:74:in
each’
rspec (1.3.0) lib/spec/example/example_methods.rb:74:in
eval_each_fail_fast' rspec (1.3.0) lib/spec/example/example_group_hierarchy.rb:17:in
run_before_each’
rspec (1.3.0) lib/spec/example/example_methods.rb:107:in
run_before_each' rspec (1.3.0) lib/spec/example/example_methods.rb:128:in
before_each_example’
rspec (1.3.0) lib/spec/example/example_methods.rb:39:in execute' /usr/lib/ruby/1.8/timeout.rb:53:in
timeout’
rspec (1.3.0) lib/spec/example/example_methods.rb:37:in execute' rspec (1.3.0) lib/spec/example/example_group_methods.rb:214:in
run_examples’
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in
each' rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in
run_examples’
rspec (1.3.0) lib/spec/example/example_group_methods.rb:103:in
run' rspec (1.3.0) lib/spec/runner/example_group_runner.rb:23:in
run’
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in each' rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in
run’
rspec (1.3.0) lib/spec/runner/options.rb:152:in run_examples' rspec (1.3.0) lib/spec/runner/command_line.rb:9:in
run’
rspec (1.3.0) bin/spec:5
/usr/bin/spec:19:in `load’
/usr/bin/spec:19