diff --git a/lib/fake.rb b/lib/fake.rb index b462a44d2..bb0475cdc 100644 --- a/lib/fake.rb +++ b/lib/fake.rb @@ -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 diff --git a/spec/lib/fake_spec.rb b/spec/lib/fake_spec.rb index fc35ef8d7..f39880ce6 100644 --- a/spec/lib/fake_spec.rb +++ b/spec/lib/fake_spec.rb @@ -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