summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-01 22:05:11 -0700
committermo khan <mo@mokhan.ca>2015-02-01 22:05:11 -0700
commit43b4f0cab83fbeaa5ed51c5c1058d0b4629bc14a (patch)
treea0ad828b41a8767404e64366c48db1608fa9fc64 /spec
parent893b13b10a515ab54816b356e659cf302831fd13 (diff)
move translations to separate files.
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/my/passwords_controller_spec.rb28
-rw-r--r--spec/features/change_password_spec.rb15
2 files changed, 26 insertions, 17 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
diff --git a/spec/features/change_password_spec.rb b/spec/features/change_password_spec.rb
index 639ac4ac..3c12e4f0 100644
--- a/spec/features/change_password_spec.rb
+++ b/spec/features/change_password_spec.rb
@@ -6,22 +6,23 @@ describe "changing my password", js: true do
before :each do
visit login_path
- within('.form-inline') do
- fill_in('session_username', :with => user.email)
- fill_in('session_password', :with => "password")
+ within(".form-inline") do
+ fill_in("session_username", :with => user.email)
+ fill_in("session_password", :with => "password")
end
click_button("Sign In")
visit my_dashboard_path
click_link("Account")
within(".form-horizontal") do
- fill_in('user_password', :with => "mopass")
- fill_in('user_password_confirmation', :with => "mopass")
+ fill_in("user_password", :with => "mopass")
+ fill_in("user_password_confirmation", :with => "mopass")
end
click_button "Update password"
end
- it "should display a confirmation message" do
- expect(page).to have_content(I18n.translate('passwords.updated'))
+ it "displays a confirmation message" do
+ confirmation_message = I18n.translate("my.passwords.updated")
+ expect(page).to have_content(confirmation_message)
end
end
end