Skip to content

Instantly share code, notes, and snippets.

@arv25
Created August 11, 2014 22:04
Show Gist options
  • Save arv25/636cca9f7316cb621dc7 to your computer and use it in GitHub Desktop.
Save arv25/636cca9f7316cb621dc7 to your computer and use it in GitHub Desktop.
Misc_drawer_access shared example
#spec/support/value_limited_numeric_spec.rb
-------------------------------------------------------------------------------------------
shared_examples_for 'a value limited numeric column' do |columns|
columns.each do |col|
it 'has numeric columns with max value limits' do
expect(FactoryGirl.build(col, amount: 100_000)).to be_invalid
end
it 'has numeric columns with min value limits' do
expect(FactoryGirl.build(col, amount: -100_000)).to be_invalid
end
end
end
-------------------------------------------------------------------------------------------
#spec/models/misc_drawer_access_spec.rb
-------------------------------------------------------------------------------------------
describe MiscDrawerAccess do
it_behaves_like 'a value limited numeric column', [:payout]
...
end
-------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment