fix url helpers on fakes
This commit is contained in:
parent
8b3beba93f
commit
a28a861509
2 changed files with 15 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue