Merge pull request #612 from internetee/registry-611

Registry 611
This commit is contained in:
Timo Võhmar 2017-10-12 16:39:57 +03:00 committed by GitHub
commit be4c60a760
3 changed files with 17 additions and 22 deletions

View file

@ -4,7 +4,7 @@ module Admin
# TODO: Refactor this # TODO: Refactor this
def create def create
if DNS::Zone.origins.include?(params[:origin]) if ::DNS::Zone.origins.include?(params[:origin])
@zonefile = ActiveRecord::Base.connection.execute( @zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{params[:origin]}')" "select generate_zonefile('#{params[:origin]}')"

View file

@ -5,12 +5,12 @@ Rails.application.configure do
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there! # and recreated between test runs. Don't rely on the data there!
config.cache_classes = false config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that # just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true. # preloads Rails for running tests, you may have to set it to true.
config.eager_load = false config.eager_load = true
# Configure static asset server for tests with Cache-Control for performance. # Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true config.serve_static_files = true
@ -41,25 +41,6 @@ Rails.application.configure do
# The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, # The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown,
# corresponding to the log level numbers from 0 up to 5 respectively # corresponding to the log level numbers from 0 up to 5 respectively
config.log_level = :debug config.log_level = :debug
# for finding database optimization
config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.rails_logger = true
Bullet.raise = false # raise an error if n+1 query occurs
Bullet.unused_eager_loading_enable = false
# Currenty hard to fix, it is triggered by Epp::Domain.new_from_epp for create request
Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar
# when domain updates, then we need to update all contact linked status,
# somehow it triggers bullet counter cache for versions,
# there was no output indicating each version where fetched or counted
# thus needs more investigation
Bullet.add_whitelist type: :counter_cache, class_name: 'Contact', association: :versions
end
config.active_job.queue_adapter = :test config.active_job.queue_adapter = :test
config.logger = ActiveSupport::Logger.new(nil) config.logger = ActiveSupport::Logger.new(nil)
end end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe 'Admin area zone file generation', settings: false do
let!(:zone) { create(:zone, origin: 'com') }
before do
sign_in_to_admin_area
end
it 'generates new' do
post admin_zonefiles_path(origin: 'com')
expect(response).to be_success
end
end