diff --git a/config/database-example-development.yml b/config/database-example-development.yml index 8bcaf097f..ba798d7e0 100644 --- a/config/database-example-development.yml +++ b/config/database-example-development.yml @@ -18,11 +18,6 @@ api_log_development: <<: *default database: registry_api_log_development -registrant_write_development: - <<: *default - database: registry_development - - test: <<: *default database: registry_test @@ -34,8 +29,3 @@ whois_test: api_log_test: <<: *default database: registry_api_log_test - -registrant_write_test: - <<: *default - database: registry_test - diff --git a/config/database-example-registrant.yml b/config/database-example-registrant.yml index 693c25115..7aaaf9216 100644 --- a/config/database-example-registrant.yml +++ b/config/database-example-registrant.yml @@ -25,14 +25,6 @@ staging: username: registrant_read_only password: registrant_read_only_pwd -registrant_write_staging: - <<: *default - database: registry_development # registry real database - host: localhost - username: registrant_write # user should have write access only to registrant_verifications table - password: registrant_write_pwd - - # # Production config for Registrant # @@ -43,10 +35,3 @@ production: host: localhost # registry production mirror location username: registrant_read_only password: registrant_read_only_pwd - -registrant_write_production: - <<: *default - database: registry_production # registry production database name - host: localhost # registry database location - username: registrant_write # user should have write access only to registrant_verifications table - password: registrant_write_pwd diff --git a/config/database-robot.yml b/config/database-robot.yml index f6eabc6cd..1a7809ccb 100644 --- a/config/database-robot.yml +++ b/config/database-robot.yml @@ -18,11 +18,6 @@ api_log_test: <<: *default database: registry_api_log_test -registrant_write_test: - <<: *default - database: registry_test - -# only for testing assets production: <<: *default database: registry_test @@ -34,7 +29,3 @@ whois_test: api_log_test: <<: *default database: registry_api_log_test - -registrant_write_test: - <<: *default - database: registry_test diff --git a/config/database-travis.yml b/config/database-travis.yml index 8bd81faa4..b79e2c453 100644 --- a/config/database-travis.yml +++ b/config/database-travis.yml @@ -17,7 +17,3 @@ whois_test: api_log_test: <<: *default database: registry_api_log_test - -registrant_write_test: - <<: *default - database: registry_test diff --git a/spec/factories/dnskey.rb b/spec/factories/dnskey.rb index e06387487..ed90b7549 100644 --- a/spec/factories/dnskey.rb +++ b/spec/factories/dnskey.rb @@ -4,7 +4,6 @@ FactoryGirl.define do flags Dnskey::FLAGS.first protocol Dnskey::PROTOCOLS.first ds_digest_type 2 - domain public_key 'AwEAAaOf5+lz3ftsL+0CCvfJbhUF/NVsNh8BKo61oYs5fXVbuWDiH872 '\ 'LC8uKDO92TJy7Q4TF9XMAKMMlf1GMAxlRspD749SOCTN00sqfWx1OMTu '\ 'a28L1PerwHq7665oDJDKqR71btcGqyLKhe2QDvCdA0mENimF1NudX1BJ '\ diff --git a/spec/factories/registrant_user.rb b/spec/factories/registrant_user.rb new file mode 100644 index 000000000..38f883067 --- /dev/null +++ b/spec/factories/registrant_user.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :registrant_user do + + end +end diff --git a/spec/factory_lint_spec.rb b/spec/factory_lint_spec.rb index 6269e3ec3..619779827 100644 --- a/spec/factory_lint_spec.rb +++ b/spec/factory_lint_spec.rb @@ -6,6 +6,10 @@ RSpec.describe 'FactoryGirl', db: true do end 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 diff --git a/spec/models/legal_documents_spec.rb b/spec/models/legal_document_spec.rb similarity index 95% rename from spec/models/legal_documents_spec.rb rename to spec/models/legal_document_spec.rb index e411c923d..58774df4b 100644 --- a/spec/models/legal_documents_spec.rb +++ b/spec/models/legal_document_spec.rb @@ -60,12 +60,9 @@ describe LegalDocument do original.path.should_not == admin_skipping_as_different.path original.path.should == 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 end end -end \ No newline at end of file +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index b4a4443ee..771052f4b 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -13,6 +13,7 @@ require 'support/matchers/active_job' require 'support/matchers/epp/code' require 'support/capybara' +require 'support/devise' require 'support/factory_girl' require 'support/database_cleaner' require 'support/paper_trail' diff --git a/spec/requests/registrar/domains_controller_spec.rb b/spec/requests/registrar/domains_controller_spec.rb index 630703c6b..eadb060c0 100644 --- a/spec/requests/registrar/domains_controller_spec.rb +++ b/spec/requests/registrar/domains_controller_spec.rb @@ -21,8 +21,4 @@ RSpec.describe Registrar::DomainsController, db: true do expect(response).to have_http_status(:success) 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 diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index a65caba89..581f5ac7c 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -1,5 +1,5 @@ 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 DatabaseCleaner.strategy = :truncation diff --git a/spec/support/devise.rb b/spec/support/devise.rb new file mode 100644 index 000000000..4dcb76759 --- /dev/null +++ b/spec/support/devise.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include Warden::Test::Helpers +end diff --git a/spec/support/features/session_helpers.rb b/spec/support/features/session_helpers.rb index 63e8bd072..a3ea7c2ae 100644 --- a/spec/support/features/session_helpers.rb +++ b/spec/support/features/session_helpers.rb @@ -17,5 +17,10 @@ module Features click_button 'Login' end + + def sign_in_to_registrant_area + user = create(:registrant_user) + login_as(user, scope: :user) + end end end diff --git a/spec/support/requests/session_helpers.rb b/spec/support/requests/session_helpers.rb index 9d8c69dc3..c58741946 100644 --- a/spec/support/requests/session_helpers.rb +++ b/spec/support/requests/session_helpers.rb @@ -32,5 +32,9 @@ module Requests def sign_in_to_admin_area(user: FactoryGirl.create(:admin_user)) post admin_sessions_path, admin_user: { username: user.username, password: user.password } 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