diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-01 22:05:11 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-01 22:05:11 -0700 |
| commit | 43b4f0cab83fbeaa5ed51c5c1058d0b4629bc14a (patch) | |
| tree | a0ad828b41a8767404e64366c48db1608fa9fc64 /spec/controllers | |
| parent | 893b13b10a515ab54816b356e659cf302831fd13 (diff) | |
move translations to separate files.
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/my/passwords_controller_spec.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/controllers/my/passwords_controller_spec.rb b/spec/controllers/my/passwords_controller_spec.rb index 83bc69ea..776ef957 100644 --- a/spec/controllers/my/passwords_controller_spec.rb +++ b/spec/controllers/my/passwords_controller_spec.rb @@ -5,7 +5,7 @@ describe My::PasswordsController do context "when not logged in" do let(:user) { create(:user) } - it "should redirect you to the login page" do + it "redirects you to the login page" do put :update, id: user.id expect(response).to redirect_to(login_path) end @@ -17,25 +17,33 @@ describe My::PasswordsController do before { http_login(user) } context "when the new password and the confirmation password does not match" do - before { put :update, :id => user.id, :user => { :password => 'foobar', :password_confirmation => 'barfoo' } } + before :each do + put :update, id: user.id, user: { + password: "foobar", + password_confirmation: "barfoo" + } + end - it "should display an error on the page" do - expect(flash[:error]).to eql(I18n.t(:passwords_do_not_match)) + it "displays an error on the page" do + expect(flash[:error]).to eql(I18n.t("my.passwords.passwords_do_not_match")) end - it "should render the show template" do + it "renders the show template" do expect(response).to render_template(:index) end end context "when the password and confirmation match" do - let(:new_password) { 'booyakasham' } + let(:new_password) { "booyakasham" } before :each do - put :update, id: user.id, user: { password: new_password, password_confirmation: new_password } + put :update, id: user.id, user: { + password: new_password, + password_confirmation: new_password + } end - it "should update the users password" do + it "updates the users password" do expect(user.reload.authenticate(new_password)).to be_truthy end end @@ -43,7 +51,7 @@ describe My::PasswordsController do end describe "#index" do - context 'when logged in' do + context "when logged in" do let(:user) { create(:user) } before :each do @@ -52,7 +60,7 @@ describe My::PasswordsController do end context "when displaying a form to change the current password" do - it "should load the user" do + it "loads the user" do expect(assigns(:user)).to eql(user) end end |
