Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,10 @@ jobs:
with:
name: coverage-report
path: coverage

- name: Upload logs
uses: actions/upload-artifact@master
if: always()
with:
name: bullet-log
path: log
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source 'https://rubygems.org'
gem 'activerecord-precounter'
gem 'awesome_nested_fields'
gem 'bootsnap', '>= 1.1.0', require: false
gem 'bullet'
gem 'bootstrap', '~> 4.5.0'
gem 'bootstrap4-kaminari-views'
gem 'carrierwave-postgresql', '< 0.3.0' # Can be upgraded once https://github.com/diogob/carrierwave-postgresql/issues/33
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ GEM
rails (>= 3.1)
brakeman (4.9.0)
builder (3.2.4)
bullet (6.1.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bundler-audit (0.7.0.1)
bundler (>= 1.2.0, < 3)
thor (>= 0.18, < 2)
Expand Down Expand Up @@ -354,6 +357,7 @@ GEM
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.7.0)
uniform_notifier (1.13.0)
warden (1.2.8)
rack (>= 2.0.6)
websocket-driver (0.7.3)
Expand All @@ -371,6 +375,7 @@ DEPENDENCIES
bootstrap (~> 4.5.0)
bootstrap4-kaminari-views
brakeman
bullet
bundler-audit
carrierwave-postgresql (< 0.3.0)
chartkick
Expand Down
4 changes: 4 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
end
end
5 changes: 5 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@

# Set default URL for mailer to mimic production
config.action_mailer.default_url_options = { host: 'test.mitrecyberacademy.org' }

config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
end
end
30 changes: 30 additions & 0 deletions test/integration/team_summary_display_modes_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'test_helper'

class TeamSummaryDisplayModesTest < ActionDispatch::IntegrationTest
include TeamsHelper
include Devise::Test::IntegrationHelpers

test "test bullet discovers n+1 query on summary page" do
create(:active_game, board_layout: :jeopardy)
team = create(:team)

chal1 = create(:standard_challenge, point_value: 100, category_count: 2)
chal2 = create(:standard_challenge, point_value: 100, category_count: 0)
chal3 = create(:standard_challenge, point_value: 150, category_count: 1)
chal4 = create(:standard_challenge, point_value: 100, category_count: 0)
chal5 = create(:standard_challenge, point_value: 100, category_count: 0)

solved_chal1 = create(:standard_solved_challenge, team: team, challenge: chal1)
solved_chal2 = create(:standard_solved_challenge, team: team, challenge: chal2)
solved_chal3 = create(:standard_solved_challenge, team: team, challenge: chal3)
solved_chal4 = create(:standard_solved_challenge, team: team, challenge: chal4)
solved_chal5 = create(:standard_solved_challenge, team: team, challenge: chal5)

captain = team.team_captain

sign_in captain

get "/teams/#{team.id}/summary"

end
end