fix url helpers on fakes

This commit is contained in:
maxwell 2011-01-24 18:01:40 -08:00
parent 8b3beba93f
commit a28a861509
2 changed files with 15 additions and 0 deletions

View file

@ -37,6 +37,11 @@ class PostsFake
def id def id
@model.id @model.id
end end
def to_s
@model.id.to_s
end
def person def person
@fakes_collection.people_hash[@model.person_id] @fakes_collection.people_hash[@model.person_id]
end end

View file

@ -30,6 +30,7 @@ describe PostsFake do
end end
end end
describe PostsFake::Fake do describe PostsFake::Fake do
include Rails.application.routes.url_helpers
before do before do
@post = mock() @post = mock()
@fakes = mock() @fakes = mock()
@ -48,6 +49,15 @@ describe PostsFake do
@post.should_receive(:text) @post.should_receive(:text)
@fake.text @fake.text
end end
it 'works with url helpers' do
sm = Factory(:status_message)
fake = PostsFake::Fake.new(sm, @fakes)
puts status_message_path(fake)
status_message_path(fake).should == status_message_path(sm)
end
end end
end end