Created
November 6, 2012 21:48
-
-
Save adam12/4027817 to your computer and use it in GitHub Desktop.
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
Domain | |
is invalid without a unique name | |
is invalid without master if slave? | |
is invalid without a name | |
is invalid if master not a valid IP | |
is invalid if type is not NATIVE MASTER or SLAVE | |
should have a valid factory | |
#slave? | |
should be true if type == SLAVE | |
Finished in 0.1246 seconds | |
7 examples, 0 failures | |
Randomized with seed 11425 |
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 Domain do | |
it 'should have a valid factory' do | |
expect(build(:domain)).to be_valid | |
end | |
it 'is invalid without a name' do | |
domain = build(:domain, name: nil) | |
expect(domain).to_not be_valid | |
end | |
it 'is invalid without a unique name' do | |
name = create(:domain).name | |
domain = build(:domain, name: name) | |
expect(domain).to_not be_valid | |
end | |
it 'is invalid if type is not NATIVE MASTER or SLAVE' do | |
expect(build(:domain, type: 'notinlist')).to_not be_valid | |
end | |
it 'is invalid without master if slave?' do | |
expect(build(:domain, :slave, master: nil)).to_not be_valid | |
end | |
it 'is invalid if master not a valid IP' do | |
expect(build(:domain, :slave, master: 'abc')).to_not be_valid | |
end | |
describe '#slave?' do | |
it 'should be true if type == SLAVE' do | |
domain = build(:domain, type: 'SLAVE') | |
expect(domain.slave?).to be_true | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment