-
Notifications
You must be signed in to change notification settings - Fork 57
Repair equipment_model generator to handle ordering #1663
Conversation
b29e729
to
d6a598a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noticed something in the new test
spec/lib/generator_spec.rb
Outdated
@@ -8,25 +8,30 @@ | |||
expect(Generator.send(method)).to be_truthy | |||
end | |||
end | |||
shared_examples 'generates multiple valid' do |method| | |||
it method.to_s do | |||
expect(5.times { Generator.send(method) }).to be_truthy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test should probably also take the model name so we can actually test that the correct number are saved to the database -- expect(klass.count).to eq(5)
spec/lib/generator_spec.rb
Outdated
@@ -37,7 +42,7 @@ | |||
Generator.equipment_model | |||
Generator.equipment_item | |||
end | |||
it_behaves_like 'generates a valid', :reservation | |||
it_behaves_like 'generates multiple valid', :reservation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't do this because sometimes random reservation generation will fail -- we catch the exception because its less complicated than ensuring valid data
8707c08
to
e487979
Compare
Resolves #1662 - set ordering to number of existing models in equipment_model generation - add validations for generating multiple objects - resolves error that can occur when randomly generating reservations for equipment_model with max_checkout_length = 1
e487979
to
57f4215
Compare
merging! |
@zeffman can you add this to the changelog? |
Resolves #1662
equipment_model with max_checkout_length = 1