diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 1 | ||||
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 15 | ||||
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 13 |
3 files changed, 28 insertions, 1 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index f3084af12..55b5fc5e3 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -450,6 +450,7 @@ describe RequestController, "when making a new request" do @user.stub!(:get_undescribed_requests).and_return([]) @user.stub!(:can_leave_requests_undescribed?).and_return(false) @user.stub!(:can_file_requests?).and_return(true) + @user.stub!(:locale).and_return("en") User.stub!(:find).and_return(@user) @body = mock_model(PublicBody, :id => 314, :eir_only? => false, :is_requestable? => true, :name => "Test Quango") 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 diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index e373c8df6..0ba542630 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -178,6 +178,19 @@ describe UserController, "when signing up" do deliveries[0].body.should include("not reveal your email") end + it "should send confirmation mail in other languages or different locales" do + session[:locale] = "es" + post :signup, {:user_signup => { :email => 'new@localhost', :name => 'New Person', + :password => 'sillypassword', :password_confirmation => 'sillypassword', + } + } + response.should render_template('confirm') + + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 1 + deliveries[0].body.should include("No revelaremos su dirección de correo") + end + it "should send special 'already signed up' mail if you fill the form in with existing registered email " do post :signup, { :user_signup => { :email => 'silly@localhost', :name => 'New Person', :password => 'sillypassword', :password_confirmation => 'sillypassword' } |