diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/track_helper_spec.rb | 60 |
2 files changed, 61 insertions, 1 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 7c2e1b369..d2b45b6bf 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -5,7 +5,7 @@ describe TrackController, "when making a new track on a request" do @ir = mock_model(InfoRequest, :url_title => 'myrequest', :title => 'My request') @track_thing = mock_model(TrackThing, :save! => true, - :params => {:list_description => 'list description'}, + :params => {}, :track_medium= => nil, :tracking_user_id= => nil) TrackThing.stub!(:create_track_for_request).and_return(@track_thing) diff --git a/spec/helpers/track_helper_spec.rb b/spec/helpers/track_helper_spec.rb index a009f87ac..d2c277993 100644 --- a/spec/helpers/track_helper_spec.rb +++ b/spec/helpers/track_helper_spec.rb @@ -16,6 +16,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about <a href="/search/Example%20Query/newest/advanced">this search</a>) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about <a href="/search/Example%20Query/newest/advanced">this search</a>) + subscribe_follow_notice(@track_thing).should == expected + end + end describe 'when displaying notices for a user track' do @@ -29,6 +39,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about '#{user_link(@track_thing.tracked_user)}', a person) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about '#{user_link(@track_thing.tracked_user)}', a person) + subscribe_follow_notice(@track_thing).should == expected + end + end describe 'when displaying notices for a public body track' do @@ -42,6 +62,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about '#{public_body_link(@track_thing.public_body)}', a public authority) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about '#{public_body_link(@track_thing.public_body)}', a public authority) + subscribe_follow_notice(@track_thing).should == expected + end + end describe 'when displaying notices for a successful request track' do @@ -55,6 +85,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about <a href="/list/successful">successful requests</a>) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about <a href="/list/successful">successful requests</a>) + subscribe_follow_notice(@track_thing).should == expected + end + end describe 'when displaying notices for a new request track' do @@ -68,6 +108,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about any <a href="/list">new requests</a>) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about <a href="/list">new requests</a>) + subscribe_follow_notice(@track_thing).should == expected + end + end describe 'when displaying notices for a request update track' do @@ -81,6 +131,16 @@ describe TrackHelper do already_subscribed_notice(@track_thing).should == expected end + it 'should create an email subscription notice' do + expected = %Q(You will now be emailed updates about '#{request_link(@track_thing.info_request)}', a request) + subscribe_email_notice(@track_thing).should == expected + end + + it 'should create a following subscription notice' do + expected = %Q(You are now <a href="#{show_user_wall_path(:url_name => @track_thing.tracking_user.url_name)}">following</a> updates about '#{request_link(@track_thing.info_request)}', a request) + subscribe_follow_notice(@track_thing).should == expected + end + end end |