summaryrefslogtreecommitdiff
path: root/spec
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
parent2bb11c60de4ec1feebad704b285c0c0fe9d6584f (diff)
hound happy.
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/profiles_controller_spec.rb8
-rw-r--r--spec/controllers/sessions_controller_spec.rb20
-rw-r--r--spec/factories.rb2
-rw-r--r--spec/models/exercise_set_spec.rb2
4 files changed, 23 insertions, 9 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
diff --git a/spec/factories.rb b/spec/factories.rb
index a6addf2..6643b0a 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -7,7 +7,7 @@ FactoryGirl.define do
association :workout
target_repetitions { rand(12) }
target_weight { rand(400) }
- factory :work_set, class: 'WorkSet'
+ factory :work_set, class: "WorkSet"
end
factory :program do
name { FFaker::Internet.user_name }
diff --git a/spec/models/exercise_set_spec.rb b/spec/models/exercise_set_spec.rb
index 4d61955..7153081 100644
--- a/spec/models/exercise_set_spec.rb
+++ b/spec/models/exercise_set_spec.rb
@@ -21,7 +21,7 @@ describe ExerciseSet do
it "returns all sets for the exercise only" do
squat_set = create(:work_set, exercise: squat)
- dip_set = create(:work_set, exercise: dip)
+ _ = create(:work_set, exercise: dip)
expect(ExerciseSet.for(squat)).to match_array([squat_set])
end