Commit f2ad4cd
Changed files (4)
spec
spec/factories/training_sessions.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do
- factory :training_session do
- association :user
- end
-end
spec/factories/users.rb
@@ -1,9 +0,0 @@
-FactoryGirl.define do
- factory :user do
- username { FFaker::Internet.user_name }
- email { FFaker::Internet.email }
- password "password"
- password_confirmation "password"
- terms_and_conditions "1"
- end
-end
spec/support/stronglifts_program.rb
@@ -1,12 +1,18 @@
shared_context "stronglifts_program" do
- let!(:program) { Program.create!(name: "StrongLifts 5×5") }
- let!(:squat) { Exercise.new(name: "Squat") }
+ let!(:program) { create(:program, name: "StrongLifts 5×5") }
+ let!(:squat) { create(:exercise, name: "Squat") }
+
let!(:workout_a) { program.workouts.create name: "A" }
+ let!(:bench_press) { create(:exercise, name: "Bench Press") }
+ let!(:barbell_row) { create(:exercise, name: "Barbell Row") }
let!(:squat_workout) { workout_a.add_exercise(squat, sets: 5, repetitions: 5) }
- let!(:bench_workout) { workout_a.add_exercise(Exercise.new(name: "Bench Press"), sets: 5, repetitions: 5) }
- let!(:row_workout) { workout_a.add_exercise(Exercise.new(name: "Barbell Row"), sets: 5, repetitions: 5) }
+ let!(:bench_workout) { workout_a.add_exercise(bench_press, sets: 5, repetitions: 5) }
+ let!(:row_workout) { workout_a.add_exercise(barbell_row, sets: 5, repetitions: 5) }
+
let!(:workout_b) { program.workouts.create name: "B" }
+ let!(:overhead_press) { create(:exercise, name: "Overhead Press") }
+ let!(:deadlift) { create(:exercise, name: "Deadlift") }
let!(:squat_workout_b) { workout_b.add_exercise(squat, sets: 5, repetitions: 5) }
- let!(:overhead_press_workout) { workout_b.add_exercise(Exercise.new(name: "Overhead Press"), sets: 5, repetitions: 5) }
- let!(:deadlift_workout) { workout_b.add_exercise(Exercise.new(name: "Deadlift"), sets: 1, repetitions: 5) }
+ let!(:overhead_press_workout) { workout_b.add_exercise(overhead_press, sets: 5, repetitions: 5) }
+ let!(:deadlift_workout) { workout_b.add_exercise(deadlift, sets: 1, repetitions: 5) }
end
spec/factories.rb
@@ -0,0 +1,21 @@
+FactoryGirl.define do
+ factory :exercise do
+ name { FFaker::Internet.user_name }
+ end
+ factory :program do
+ name { FFaker::Internet.user_name }
+ end
+ factory :training_session do
+ association :user
+ end
+ factory :user do
+ username { FFaker::Internet.user_name }
+ email { FFaker::Internet.email }
+ password "password"
+ password_confirmation "password"
+ terms_and_conditions "1"
+ end
+ factory :workout do
+ name { FFaker::Internet.user_name }
+ end
+end