From 204e5c3a739a2bedf927b2f6aa82c373731bbda8 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Sat, 3 Sep 2011 11:44:34 +0100 Subject: Store user's locale against profile, so we can send them localised track emails. Also internationalize more strings at the same time. Fixes #163. --- spec/controllers/track_controller_spec.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'spec/controllers/track_controller_spec.rb') diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 2f3f903f9..c3dc98a67 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -16,6 +16,7 @@ describe TrackController, "when making a new track on a request" do @user = mock_model(User) User.stub!(:find).and_return(@user) + @user.stub!(:locale).and_return("en") end it "should require login when making new track" do @@ -69,7 +70,6 @@ describe TrackController, "when sending alerts for a track" do mail.body.should include('added an annotation') # comment included mail.body.should =~ /This a the daftest comment the world has ever seen/ # comment text included - # Check subscription managing link # XXX We can't do this, as it is redirecting to another controller. I'm # apparently meant to be writing controller unit tests here, not functional @@ -93,6 +93,19 @@ describe TrackController, "when sending alerts for a track" do deliveries.size.should == 0 end + it "should send localised alerts" do + # set the time the comment event happened at to within the last week + ire = info_request_events(:silly_comment_event) + ire.created_at = Time.now - 3.days + ire.save! + user = users(:silly_name_user) + user.locale = "es" + user.save! + TrackMailer.alert_tracks + deliveries = ActionMailer::Base.deliveries + mail = deliveries[0] + mail.body.should include('el equipo de Alaveteli') + end end describe TrackController, "when viewing RSS feed for a track" do -- cgit v1.2.3 From 641700a371001e7c60bb100d81dec8d44189a814 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Sat, 3 Sep 2011 15:21:04 +0200 Subject: Remove hardcoded site name from test --- spec/controllers/track_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/controllers/track_controller_spec.rb') diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index c3dc98a67..8c2e19c58 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -104,7 +104,7 @@ describe TrackController, "when sending alerts for a track" do TrackMailer.alert_tracks deliveries = ActionMailer::Base.deliveries mail = deliveries[0] - mail.body.should include('el equipo de Alaveteli') + mail.body.should include('el equipo de ') end end -- cgit v1.2.3 From e00da51de4d0909a48b2569f1c66c0655f7bc63d Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Thu, 8 Sep 2011 00:34:05 +0100 Subject: yet another missing fixture declaration! --- spec/controllers/track_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/controllers/track_controller_spec.rb') diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 2f3f903f9..32cacb0a8 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -35,7 +35,7 @@ end describe TrackController, "when sending alerts for a track" do integrate_views - fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails, :public_bodies, :public_body_translations + fixtures :comments, :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails, :public_bodies, :public_body_translations include LinkToHelper # for main_url before(:each) do -- cgit v1.2.3