Merge branch 'rspec' into registry-475-refactor-zones

This commit is contained in:
Artur Beljajev 2017-04-19 13:44:56 +03:00
commit b037f4efe9
11 changed files with 31 additions and 11 deletions

View file

@ -4,7 +4,6 @@ FactoryGirl.define do
flags Dnskey::FLAGS.first flags Dnskey::FLAGS.first
protocol Dnskey::PROTOCOLS.first protocol Dnskey::PROTOCOLS.first
ds_digest_type 2 ds_digest_type 2
domain
public_key 'AwEAAaOf5+lz3ftsL+0CCvfJbhUF/NVsNh8BKo61oYs5fXVbuWDiH872 '\ public_key 'AwEAAaOf5+lz3ftsL+0CCvfJbhUF/NVsNh8BKo61oYs5fXVbuWDiH872 '\
'LC8uKDO92TJy7Q4TF9XMAKMMlf1GMAxlRspD749SOCTN00sqfWx1OMTu '\ 'LC8uKDO92TJy7Q4TF9XMAKMMlf1GMAxlRspD749SOCTN00sqfWx1OMTu '\
'a28L1PerwHq7665oDJDKqR71btcGqyLKhe2QDvCdA0mENimF1NudX1BJ '\ 'a28L1PerwHq7665oDJDKqR71btcGqyLKhe2QDvCdA0mENimF1NudX1BJ '\

View file

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :registrant_user do
end
end

View file

@ -15,5 +15,11 @@ FactoryGirl.define do
create(:account, registrar: registrar, balance: 1_000_000) create(:account, registrar: registrar, balance: 1_000_000)
end end
end end
factory :registrar_with_zero_balance do
after :create do |registrar|
create(:account, registrar: registrar, balance: 0)
end
end
end end
end end

View file

@ -6,6 +6,10 @@ RSpec.describe 'FactoryGirl', db: true do
end end
it 'lints factories' do it 'lints factories' do
FactoryGirl.lint factories_to_lint = FactoryGirl.factories.reject do |factory|
%i(reserved_domain).include?(factory.name) || factory.name.to_s =~ /^domain/ # Ignore the ones with domain_name validator
end
FactoryGirl.lint factories_to_lint
end end
end end

View file

@ -60,12 +60,9 @@ describe LegalDocument do
original.path.should_not == admin_skipping_as_different.path original.path.should_not == admin_skipping_as_different.path
original.path.should == copy.path original.path.should == copy.path
original.path.should == registrant_copy.path original.path.should == registrant_copy.path
original.path.should == tech_copy.path
original.path.should == admin_copy.path
original.path.should == new_second_tech_contact.path
skipping_as_different_domain.path.should_not == new_second_tech_contact.path skipping_as_different_domain.path.should_not == new_second_tech_contact.path
end end
end end
end end

View file

@ -13,6 +13,7 @@ require 'support/matchers/active_job'
require 'support/matchers/epp/code' require 'support/matchers/epp/code'
require 'support/capybara' require 'support/capybara'
require 'support/devise'
require 'support/factory_girl' require 'support/factory_girl'
require 'support/database_cleaner' require 'support/database_cleaner'
require 'support/paper_trail' require 'support/paper_trail'

View file

@ -21,8 +21,4 @@ RSpec.describe Registrar::DomainsController, db: true do
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user))
post registrar_sessions_path, { depp_user: { tag: user.username, password: user.password } }
end
end end

View file

@ -1,5 +1,5 @@
RSpec.configure do |config| RSpec.configure do |config|
db_connection_names = %i(test whois_test api_log_test registrant_write_test) db_connection_names = ActiveRecord::Base.configurations.keys.grep(/test/).map(&:to_sym).reverse
config.before :suite do config.before :suite do
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :truncation

3
spec/support/devise.rb Normal file
View file

@ -0,0 +1,3 @@
RSpec.configure do |config|
config.include Warden::Test::Helpers
end

View file

@ -17,5 +17,10 @@ module Features
click_button 'Login' click_button 'Login'
end end
def sign_in_to_registrant_area
user = create(:registrant_user)
login_as(user, scope: :user)
end
end end
end end

View file

@ -32,5 +32,9 @@ module Requests
def sign_in_to_admin_area(user: FactoryGirl.create(:admin_user)) def sign_in_to_admin_area(user: FactoryGirl.create(:admin_user))
post admin_sessions_path, admin_user: { username: user.username, password: user.password } post admin_sessions_path, admin_user: { username: user.username, password: user.password }
end end
def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user))
post registrar_sessions_path, { depp_user: { tag: user.username, password: user.password } }
end
end end
end end