Skip to content

Instantly share code, notes, and snippets.

@markburns
Last active December 12, 2015 02:09
Show Gist options
  • Save markburns/4696900 to your computer and use it in GitHub Desktop.
Save markburns/4696900 to your computer and use it in GitHub Desktop.
subject { App.new }
App::PURPOSES.each do |p,_|
context do
before { subject.purpose = p }
its(:purpose){ should == p }
end
end
App::PLATFORMS.each do |p,_|
context do
before { subject.platform = p }
its(:platform){ should == p }
end
end
subject { App.new }
%w(purpose platform).each do |meth|
describe "#{meth}=" do
App.const_get(meth.pluralize.upcase).keys.each do |attribute|
it "accepts #{attribute} as a valid value" do
app = App.new
app.send "#{meth}=", attribute
app.send(meth).should == attribute
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment