summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-07-04 14:52:06 -0600
committermo khan <mo@mokhan.ca>2016-07-04 14:59:24 -0600
commit2eebbd33137c7e45c81bc36b9c4fc0ee0578032a (patch)
tree1ae0fb7b14673883be3b129fd3f794028c5e7958 /spec/controllers
parent2bb11c60de4ec1feebad704b285c0c0fe9d6584f (diff)
hound happy.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/profiles_controller_spec.rb8
-rw-r--r--spec/controllers/sessions_controller_spec.rb20
2 files changed, 21 insertions, 7 deletions
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 9c2ab05..a5bb00a 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -45,7 +45,9 @@ describe ProfilesController do
describe "#update" do
it "updates the user profile" do
- patch :update, params: { id: user.to_param, profile: { gender: "male" } }
+ patch :update, params: {
+ id: user.to_param, profile: { gender: "male" }
+ }
user.reload
expect(user.profile.male?).to be_truthy
expect(response).to redirect_to(profile_path(user.profile))
@@ -54,7 +56,9 @@ describe ProfilesController do
it 'saves the users home gym' do
gym = create(:gym)
- patch :update, params: { id: user.to_param, profile: { gym_id: gym.id } }
+ patch :update, params: {
+ id: user.to_param, profile: { gym_id: gym.id }
+ }
expect(user.reload.profile.gym).to eql(gym)
end
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index ea96a1a..385c613 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -23,29 +23,39 @@ describe SessionsController do
context "when credentials are correct" do
it "logs you in with email" do
- post :create, params: { user: { username: user.email, password: "password" } }
+ post :create, params: {
+ user: { username: user.email, password: "password" }
+ }
expect(session[:user_id]).to eql(UserSession.last.id)
end
it "logs you in with username" do
- post :create, params: { user: { username: user.username, password: "password" } }
+ post :create, params: {
+ user: { username: user.username, password: "password" }
+ }
expect(session[:user_id]).to eql(UserSession.last.id)
end
it "redirects to the dashboard" do
- post :create, params: { user: { username: user.username, password: "password" } }
+ post :create, params: {
+ user: { username: user.username, password: "password" }
+ }
expect(response).to redirect_to(dashboard_path)
end
end
context "when credentials are incorrect" do
it "displays errors" do
- post :create, params: { user: { username: user.username, password: "wrong" } }
+ post :create, params: {
+ user: { username: user.username, password: "wrong" }
+ }
expect(flash[:warning]).to_not be_empty
end
it "redirects to the login page" do
- post :create, params: { user: { username: user.username, password: "wrong" } }
+ post :create, params: {
+ user: { username: user.username, password: "wrong" }
+ }
expect(response).to redirect_to(new_session_path)
end
end