Skip to content

Instantly share code, notes, and snippets.

@tomtt
Created May 20, 2010 16:46
Show Gist options
  • Save tomtt/407789 to your computer and use it in GitHub Desktop.
Save tomtt/407789 to your computer and use it in GitHub Desktop.
>: cat spec/controllers/simple_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe HomeController do
context "looking at an email" do
subject do
mail = TMail::Mail.new
mail.from = "origin@example.com"
mail
end
# This passes as expected.
it "should have the correct from address" do
subject.from.should == ['origin@example.com']
end
# I don't understand why this fails.
its(:from) { should == ['origin@example.com'] }
end
end
>: ./script/spec spec/controllers/simple_spec.rb -b
.F
1)
NoMethodError in 'HomeController looking at an email from should == ["origin@example.com"]'
undefined method `from' for #<HomeController:0x102bd7c40>
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/subject.rb:25:in `send'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/subject.rb:25:in `subject'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/subject.rb:91:in `should'
./spec/controllers/simple_spec.rb:14:
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:40:in `instance_eval'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:40:in `execute'
/Users/tomtt/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/timeout.rb:53:in `timeout'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:37:in `execute'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:214:in `run_examples'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:212:in `each'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:212:in `run_examples'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:103:in `run'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:23:in `run'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `each'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `run'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/runner/options.rb:152:in `run_examples'
/my/project/vendor/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
./script/spec:10:
Finished in 0.031435 seconds
2 examples, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment