From 90d960bac7e0dd46517db494a8c84bf60b53548b Mon Sep 17 00:00:00 2001 From: Pistos Date: Tue, 4 Oct 2011 01:48:59 -0400 Subject: [PATCH] Some reshare_link specs. --- spec/helpers/reshares_helper_spec.rb | 45 +++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/spec/helpers/reshares_helper_spec.rb b/spec/helpers/reshares_helper_spec.rb index af5bac1e1..a7baceb5a 100644 --- a/spec/helpers/reshares_helper_spec.rb +++ b/spec/helpers/reshares_helper_spec.rb @@ -1,15 +1,5 @@ require 'spec_helper' -# Specs in this file have access to a helper object that includes -# the ResharesHelper. For example: -# -# describe ResharesHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end describe ResharesHelper do include StreamHelper @@ -20,5 +10,40 @@ describe ResharesHelper do reshare_link(reshare) }.should_not raise_error end + + describe 'for a typical post' do + before :each do + aspect = alice.aspects.first + @post = alice.build_post :status_message, :text => "ohai", :to => aspect.id, :public => true + @post.save! + alice.add_to_streams(@post, [aspect]) + alice.dispatch_post @post, :to => aspect.id + end + + describe 'which has not been reshared' do + before :each do + @post.reshare_count.should == 0 + end + + it 'has "Reshare original" as the English text' do + reshare_link(@post).should =~ %r{>Reshare original} + end + end + + describe 'which has been reshared' do + before :each do + @reshare = Factory.create(:reshare, :root => @post) + @post.reshare_count.should == 1 + end + + it 'has "Reshare original" as the English text' do + reshare_link(@post).should =~ %r{>Reshare original} + end + + it 'its reshare has "Reshare original" as the English text' do + reshare_link(@reshare).should =~ %r{>Reshare original} + end + end + end end end