Skip to content

Instantly share code, notes, and snippets.

@brooksreese
Created March 17, 2013 03:54
Show Gist options
  • Save brooksreese/5179596 to your computer and use it in GitHub Desktop.
Save brooksreese/5179596 to your computer and use it in GitHub Desktop.
Basic model test using RSpec
require 'spec_helper'
describe "Provider Locations" do
before(:each) do
@provider_location = FactoryGirl.create(:provider_location)
end
it "is valid with valid attributes" do
@provider_location.should be_valid
end
describe "Required attributes" do
required_fields = %w[name address city state zip]
required_fields.each do |field|
it "requires #{field} attribute" do
provider_location = @provider_location
#provider_location.send(field << '=', "")
provider_location.send("#{field}=", "")
provider_location.should_not be_valid
end
end
end
end
@danpariente
Copy link

🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment