You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

13 years ago
shared_context "data" do
let(:admin){create(:user)} # admin is a user that owns host domains
let(:user){create(:user)} # a regular user
let(:user2){create(:user)}
let(:user3){create(:user)}
13 years ago
def make_domain(options)
domain = build(:domain, options)
13 years ago
domain.setup(FactoryGirl.generate(:email))
domain.save!
domain.soa_record.update_serial!
domain
end
# user's domains
let(:domain){make_domain(:user => user)}
let(:subdomain){make_domain(:name => "sub.#{domain.name}", :user => user)}
let(:subsubdomain){make_domain(:name => "sub.#{subdomain.name}", :user => user)}
# third user's domains
let(:domain3){make_domain(:user => user3)}
let(:subdomain3){make_domain(:name => "sub.#{domain.name}", :user => user3)}
let(:subsubdomain3){make_domain(:name => "sub.#{subdomain.name}", :user => user3)}
# admin's host domain (like entrydns.org)
let(:host_domain){make_domain(:user => admin, :name => Settings.host_domains.first)}
let(:a_record){create(:a, :content => '127.0.0.1', :domain => domain)}
let(:soa_record){domain.soa_record}
let(:host_a_record){create(:a, :content => '127.0.0.1', :domain => host_domain, :user => user)}
let(:permission){create(:permission, :domain => domain, :user => user2)}
let(:permission3){create(:permission, :domain => domain3, :user => user)}
12 years ago
let(:blacklisted_domain){create(:blacklisted_domain)}
11 years ago
# admin model
let(:admin_admin){create(:admin)}
13 years ago
end