Skip to content

Instantly share code, notes, and snippets.

@karthiks
Created October 21, 2011 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthiks/1304391 to your computer and use it in GitHub Desktop.
Save karthiks/1304391 to your computer and use it in GitHub Desktop.
leveraging Subject in RSpec - 3
describe Address do
describe "#validations" do
before(:all) do
@a = Address.new
@a.should_not be_valid
end
%w(:city :state :country).each do |attr|
it "must have a #{attr}" do
@a.errors_on(attr).should_not be_nil
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment