Skip to content

Instantly share code, notes, and snippets.

@mgreenly
Created November 16, 2011 04:15
Show Gist options
  • Save mgreenly/1369218 to your computer and use it in GitHub Desktop.
Save mgreenly/1369218 to your computer and use it in GitHub Desktop.
Cucumber/RSpec onion layer 3
describe WarrantyClaim do
it "validates presence of failure_date" do
warranty_claim = Factory.build(:warranty_claim)
warranty_claim.failure_date = nil
warranty_claim.valid?.should be_false
warranty_claim.failure_date = Date.today
warranty_claim.valid?.should be_true
end
it "validates presence of customer name" do
warranty_claim = Factory.build(:warranty_claim)
warranty_claim.customer_name = nil
warranty_claim.valid?.should be_false
warranty_claim.customer_name = "valid customer name"
warranty_claim.valid?.should be_true
end
it "validates presence of customer phone" do
warranty_claim = Factory.build(:warranty_claim)
warranty_claim.customer_phone = nil
warranty_claim.valid?.should be_false
warranty_claim.customer_phone = "555-555-5555"
warranty_claim.valid?.should be_true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment