Hi
I've got this spec:
describe "when the story exists" do
before(:each) do
@story = mock(Story, :latest_version => :version)
Story.stub!(:get_trying_guid).and_return(@story)
end
# ... examples
it "should assign the Story's latest version to the view" do
do_get
assigns(:story_version).should == :version
end
end
And this implementation:
class Stories < Application
def show(id)
@story = Story.get_trying_guid(URI.unescape(id))
raise NotFound unless @story
@story_version = @story.latest_version
display @story
end
end
But the spec fails:
'Stories#show when the story exists should assign the Story's latest
version to the view' FAILED
expected: :version,
got: nil (using ==)
./spec/controllers/stories_spec.rb:42:
even though the view does what I expect it to.
However, if I set an expectation that @story (the object that gets
passed to #display) should be assigned, that works.
Am I doing something wrong or is this a bug?
Thanks for any help
Ashley
--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---