From 7796e1fb8d6238ed13b1a4b5ef3ccf91499a9b4b Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Wed, 24 Aug 2011 16:02:28 +0100 Subject: Anneal brittle test --- spec/controllers/user_controller_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/controllers/user_controller_spec.rb') diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index c974c8a0d..438fb8c0c 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -179,7 +179,9 @@ describe UserController, "when signing up" do deliveries = ActionMailer::Base.deliveries deliveries.size.should == 1 - deliveries[0].body.should include("when you already have an") + + # This text may span a line break, depending on the length of the SITE_NAME + deliveries[0].body.should match(/when\s+you\s+already\s+have\s+an/) end # XXX need to do bob@localhost signup and check that sends different email -- cgit v1.2.3 From 547394f4aa7d48b42b14a4b08c98e3c60a33db46 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Thu, 1 Sep 2011 18:15:57 +0100 Subject: Provide a search function on the user profile pages. Closes #138. --- spec/controllers/user_controller_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/controllers/user_controller_spec.rb') diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 438fb8c0c..e373c8df6 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -32,6 +32,13 @@ describe UserController, "when showing a user" do assigns[:display_user].should == users(:bob_smith_user) end + it "should search the user's contributions" do + get :show, :url_name => "bob_smith" + assigns[:xapian_requests].results.count.should == 2 + get :show, :url_name => "bob_smith", :user_query => "money" + assigns[:xapian_requests].results.count.should == 1 + end + # Error handling not quite good enough for this yet # it "should not show unconfirmed users" do # get :show, :url_name => "silly_emnameem" -- cgit v1.2.3 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/user_controller_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/controllers/user_controller_spec.rb') 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' } -- cgit v1.2.3 From 55ab78f81b66edbf34c806df48677a1156c499d8 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Thu, 8 Sep 2011 00:39:13 +0100 Subject: Fix User.should_be_emailed? The User.should_be_emailed? method needs to be public. It should also be tested. --- spec/controllers/user_controller_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/controllers/user_controller_spec.rb') diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 438fb8c0c..a12d79e82 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -104,7 +104,7 @@ describe UserController, "when signing in" do get :signin, :r => "/list" response.should render_template('sign') post_redirect = get_last_postredirect - post :signin, { :user_signin => { :email => 'silly@localhost', :password => 'jonespassword' }, + post :signin, { :user_signin => { :email => 'unconfirmed@localhost', :password => 'jonespassword' }, :token => post_redirect.token } response.should render_template('confirm') @@ -116,7 +116,7 @@ describe UserController, "when signing in" do get :signin, :r => "/list" post_redirect = get_last_postredirect - post :signin, { :user_signin => { :email => 'silly@localhost', :password => 'jonespassword' }, + post :signin, { :user_signin => { :email => 'unconfirmed@localhost', :password => 'jonespassword' }, :token => post_redirect.token } response.should send_email @@ -136,7 +136,7 @@ describe UserController, "when signing in" do # check confirmation URL works session[:user_id].should be_nil get :confirm, :email_token => post_redirect.email_token - session[:user_id].should == users(:silly_name_user).id + session[:user_id].should == users(:unconfirmed_user).id response.should redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1) end -- cgit v1.2.3