On May 20, 2010, at 11:49 AM, Tom Ten Thij wrote: > The 'its' construct seems to not be working for me. I have narrowed it > down to a basic example that I think should be working. Note that when I > use a normal 'it' block with a subject in it, that works fine. > > Any insights would be welcome: http://gist.github.com/407789 > > Cheers, Tom. > > == Below is just a copy of the content of the gist == > >> : 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 = "[email protected]" > mail > end > > # This passes as expected. > it "should have the correct from address" do > subject.from.should == ['[email protected]'] > end > > # I don't understand why this fails. > its(:from) { should == ['[email protected]'] } > end > end > >> : ./script/spec spec/controllers/simple_spec.rb -b
Please file a bug at https://rspec.lighthouseapp.com/projects/5645-rspec if there's not one already. Thanks, David > .F > > 1) > NoMethodError in 'HomeController looking at an email from should == > ["[email protected]"]' > 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 > > Attachments: > http://www.ruby-forum.com/attachment/4745/simple_spec.rb > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
