Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Repair equipment_model generator to handle ordering #1663

Merged
merged 1 commit into from
Feb 11, 2017

Conversation

zeffman
Copy link
Contributor

@zeffman zeffman commented Feb 8, 2017

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

@zeffman zeffman force-pushed the 1662_fix_ordering_generator branch 2 times, most recently from b29e729 to d6a598a Compare February 8, 2017 19:11
Copy link
Collaborator

@esoterik esoterik left a 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

@@ -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
Copy link
Collaborator

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)

@@ -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
Copy link
Collaborator

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

@zeffman zeffman force-pushed the 1662_fix_ordering_generator branch from 8707c08 to e487979 Compare February 9, 2017 00:44
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
@zeffman zeffman force-pushed the 1662_fix_ordering_generator branch from e487979 to 57f4215 Compare February 9, 2017 00:58
@esoterik
Copy link
Collaborator

merging!

@esoterik esoterik merged commit a50e6f4 into master Feb 11, 2017
@esoterik esoterik deleted the 1662_fix_ordering_generator branch February 11, 2017 18:25
@esoterik
Copy link
Collaborator

@zeffman can you add this to the changelog?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ordering generator
3 participants