[rspec-users] Looking for help on two issues with Rails 2.1 and RSpec 1.14

Steve Downey steve.downtown at gmail.com
Mon Jun 2 15:59:04 EDT 2008


I have specs that ran fine in Rails 2.02/RSpec 1.13 that are failing on
Rails 2.1/RSpec 1.14.

There is one problem and one issue:

problem: sometimes (but not always) I get a NoMethodError referencing a
has_many association

issue: in helper specs, instance variables don't get set unless the
HelperModule is included.  Using the preferred helper.<method> I can't seem
to find a way to check that an instance variable is set:

I have several specs that used to look like:

  it "page_title should assign @browser_title" do
    page_title("foo")
    @browser_title.should == "foo"
  end


Now changed to:

  it "page_title should assign @browser_title" do
    helper.page_title("foo")
    helper.assigns[:browser_title].should == "foo"
    # also tried: assigns[:browser_title].should == "foo"
  end

The output is:

expected: "foo",
     got: nil (using ==)


Any help appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080602/6195192b/attachment.html>


More information about the rspec-users mailing list