diff options
author | David Cabo <david@calibea.com> | 2011-10-13 00:29:51 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-10-13 00:29:51 +0200 |
commit | c8983b923e4dc7db9ba22156daaddd94d2b5ed4d (patch) | |
tree | 7741c3655fe5e3cbc90dd20a4626ac7acc1bf6b0 /spec/controllers/user_controller_spec.rb | |
parent | a29b3aaf0ae77af49d38813b62dddcb6889c1ebe (diff) | |
parent | e13127a8ebc8bf8379d92f778af5a2bb6931d80c (diff) |
Merge branch 'release/0.4'0.4
Diffstat (limited to 'spec/controllers/user_controller_spec.rb')
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index c974c8a0d..b4cc0d6e3 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" @@ -104,7 +111,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 +123,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 +143,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 @@ -171,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' } @@ -179,7 +199,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 |