Skip to content

Commit

Permalink
Merge pull request #612 from internetee/registry-611
Browse files Browse the repository at this point in the history
Registry 611
  • Loading branch information
vohmar authored Oct 12, 2017
2 parents 42fefcc + 56d909c commit be4c60a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/zonefiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ZonefilesController < BaseController
# TODO: Refactor this

def create
if DNS::Zone.origins.include?(params[:origin])
if ::DNS::Zone.origins.include?(params[:origin])

@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{params[:origin]}')"
Expand Down
23 changes: 2 additions & 21 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# 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
# 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
# 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.
config.eager_load = false
config.eager_load = true

# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_files = true
Expand Down Expand Up @@ -41,25 +41,6 @@
# The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown,
# corresponding to the log level numbers from 0 up to 5 respectively
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.logger = ActiveSupport::Logger.new(nil)
end
Expand Down
14 changes: 14 additions & 0 deletions spec/requests/admin/zonefiles/create_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit be4c60a

Please sign in to comment.