Created
September 25, 2011 22:52
-
-
Save batasrki/1241284 to your computer and use it in GitHub Desktop.
Example model display 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
| describe Job do | |
| before :each do | |
| @mock_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 "display name" do | |
| it "should display the name according to business rules" do | |
| @job.display_name.should == "Job#: 00000 / Tester : test job" | |
| end | |
| it "should display the short name according to its business rules when the name exists" do | |
| @job.display_shortname.should == "test job(Tester)" | |
| end | |
| it "should display a default short name if a name hasn't been set" do | |
| @job.name = nil | |
| @job.display_shortname.should == "Job#: 00000" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment