Skip to content

Instantly share code, notes, and snippets.

@karthiks
Created October 21, 2011 17:00
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/1304323 to your computer and use it in GitHub Desktop.
Save karthiks/1304323 to your computer and use it in GitHub Desktop.
leveraging Subject in RSpec - 1
describe Address do
describe "#validations" do
it "must have a city" do
a = Address.new
a.should_not be_valid
a.errors_on(:city).should_not be_nil
end
it "must have a state" do
a = Address.new
a.should_not be_valid
a.errors_on(:state).should_not be_nil
end
it "must have a country" do
a = Address.new
a.should_not be_valid
a.errors_on(:country).should_not be_nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment