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
@model.id
end
def to_s
@model.id.to_s
end
def person
@fakes_collection.people_hash[@model.person_id]
end

View file

@ -30,6 +30,7 @@ describe PostsFake do
end
end
describe PostsFake::Fake do
include Rails.application.routes.url_helpers
before do
@post = mock()
@fakes = mock()
@ -48,6 +49,15 @@ describe PostsFake do
@post.should_receive(:text)
@fake.text
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