From a28a861509135dc89036a0d078a64f5bb122783e Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Mon, 24 Jan 2011 18:01:40 -0800
Subject: [PATCH] fix url helpers on fakes

---
 lib/fake.rb           |  5 +++++
 spec/lib/fake_spec.rb | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/lib/fake.rb b/lib/fake.rb
index b462a44d2c..bb0475cdc3 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 fc35ef8d7d..f39880ce6a 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
 
-- 
GitLab