Created
November 23, 2012 21:14
-
-
Save wadtech/4137352 to your computer and use it in GitHub Desktop.
example spec and result
This file contains 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' | |
describe Page do | |
it "has a valid factory" do | |
FactoryGirl.create(:page) | |
end | |
it "is invalid without a permalink" do | |
page = FactoryGirl.build(:page, :permalink => nil).should_not be_valid | |
end | |
it "is invalid without content" do | |
page = FactoryGirl.build(:page, :content => nil).should_not be_valid | |
end | |
it "must have a unique permalink" do | |
FactoryGirl.create(:page, :permalink => "Duplicate") | |
FactoryGirl.build(:page, :permalink => "Duplicate").should_not be_valid | |
end | |
context "URL" do | |
it "should match the permalink" do | |
page = FactoryGirl.build(:page) | |
page.to_param.should eq page.permalink | |
end | |
end | |
end |
This file contains 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
Page | |
is invalid without a permalink | |
is invalid without content | |
has a valid factory | |
must have a unique permalink | |
URL | |
should match the permalink | |
# coloured by pass/fail/pending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment