Browse Source

spec support

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
15a49e00af
  1. 8
      spec/factories.rb
  2. 8
      spec/models/domain_spec.rb
  3. 12
      spec/support/application.rb
  4. 15
      spec/support/shared_context/data.rb

8
spec/factories.rb

@ -18,12 +18,16 @@ FactoryGirl.define do
factory :record do
end
factory :soa_record, :class => 'SOA' do
factory :soa do
contact {Faker::Internet.email}
end
factory :ns_record, :class => 'NS' do
factory :ns do
content {Settings.ns.sample}
end
factory :a do
content {Faker::Internet.ip_v4_address}
end
end

8
spec/models/domain_spec.rb

@ -1,13 +1,7 @@
require 'spec_helper'
describe Domain do
let(:domain){
domain = Factory.build(:domain)
domain.setup(FactoryGirl.generate(:email))
domain.save!
domain.soa_record.update_serial!
domain
}
include_context "data"
it "has correct soa record" do
domain.soa_record.should be_present

12
spec/support/application.rb

@ -0,0 +1,12 @@
module AngelNest
module TestHelpers
# def make_user
# end
end
end
RSpec.configure do |config|
config.include AngelNest::TestHelpers
end

15
spec/support/shared_context/data.rb

@ -0,0 +1,15 @@
shared_context "data" do
let(:user){Factory(:user)}
let(:domain){
domain = Factory.build(:domain, :user => user)
domain.setup(FactoryGirl.generate(:email))
domain.save!
domain.soa_record.update_serial!
domain
}
let(:a_record){Factory(:a, :content => '127.0.0.1', :domain => domain)}
end
Loading…
Cancel
Save