Nicolae Claudius
13 years ago
9 changed files with 77 additions and 27 deletions
@ -1,8 +1,34 @@ |
|||||||
require 'spec_helper' |
require 'spec_helper' |
||||||
|
|
||||||
describe Domain do |
describe Domain do |
||||||
let(:domain){Factory(:domain)} |
let(:domain){ |
||||||
it "is" do |
domain = Factory.build(:domain) |
||||||
domain.should be_valid |
domain.setup(FactoryGirl.generate(:email)) |
||||||
|
domain.save! |
||||||
|
domain |
||||||
|
} |
||||||
|
|
||||||
|
it "has correct soa record" do |
||||||
|
domain.soa_record.should be_present |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct ns records" do |
||||||
|
domain.should have(2).ns_records |
||||||
|
for record in domain.ns_records |
||||||
|
record.should be_persisted |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct records" do |
||||||
|
domain.records.count.should == 3 |
||||||
|
end |
||||||
|
|
||||||
|
it "updates name to records when name changed" do |
||||||
|
domain.update_attributes(:name => "changed#{domain.name}") |
||||||
|
domain.soa_record.name.should == domain.name |
||||||
|
domain.records.all.size.should == 3 |
||||||
|
for record in domain.records.all |
||||||
|
record.name.should =~ /#{domain.name}$/ |
||||||
|
end |
||||||
end |
end |
||||||
end |
end |
||||||
|
Loading…
Reference in new issue