Created
September 25, 2011 22:12
-
-
Save batasrki/1241239 to your computer and use it in GitHub Desktop.
Example model spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper.rb' | |
| describe Job do | |
| before :each do | |
| @job_category = JobCategory.create!({:name => "Tester"}) | |
| @mock_client = mock_model(Client, {:name => "Test Client"}) | |
| @job = Job.new(:name => "test job", :client => @mock_client, | |
| :category => @mock_job_category) | |
| end | |
| describe "basic validations" do | |
| it "should not be valid without a name" do | |
| @job.name = nil | |
| @job.should_not be_valid | |
| end | |
| it "should not be valid without a category" do | |
| @job.category = nil | |
| @job.should_not be_valid | |
| end | |
| it "should not be valid without a client" do | |
| @job.client = nil | |
| @job.should_not be_valid | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment