Skip to content

Commit

Permalink
Merge pull request #50 from CalvinWalzel/v2/add-bullet-gem
Browse files Browse the repository at this point in the history
[V2] Add `bullet` gem
  • Loading branch information
CalvinWalzel authored Aug 25, 2024
2 parents 67c5f95 + 40b9a47 commit 996e0f1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
node-version-file: ".node-version"
cache: "yarn"

- name: Install Node.js dependencies
run: yarn install --immutable

- name: Scan for security vulnerabilities in JavaScript dependencies
run: yarn npm audit

Expand Down Expand Up @@ -91,6 +94,9 @@ jobs:
node-version-file: ".node-version"
cache: "yarn"

- name: Install Node.js dependencies
run: yarn install --immutable

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ gem "pagy", "< 9"
gem "shoulda-matchers", "~> 6.4", group: :test

gem "ruby-lsp-rspec", "~> 0.1.12", group: :development, require: false

gem "bullet", "~> 7.2", group: [:development, :test]
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ GEM
brakeman (6.2.1)
racc
builder (3.3.0)
bullet (7.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bundle_update_interactive (0.7.0)
bundler (~> 2.0)
bundler-audit (>= 0.9.1)
Expand Down Expand Up @@ -333,6 +336,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uniform_notifier (1.16.0)
useragent (0.16.10)
validate_url (1.0.15)
activemodel (>= 3.0.0)
Expand Down Expand Up @@ -370,6 +374,7 @@ PLATFORMS
DEPENDENCIES
bootsnap
brakeman
bullet (~> 7.2)
bundle_update_interactive (~> 0.7.0)
capybara
debug
Expand Down
5 changes: 5 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
config.generators.apply_rubocop_autocorrect_after_generate!

config.after_initialize do
Bullet.enable = true
Bullet.raise = 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 @@ -66,4 +66,9 @@

# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true

config.after_initialize do
Bullet.enable = true
Bullet.raise = true
end
end
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#
# Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f }
require Rails.root.join("spec/support/require_helpers.rb")
require Rails.root.join("spec/support/bullet.rb")

# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
Expand Down
14 changes: 14 additions & 0 deletions spec/support/bullet.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

RSpec.configure do |config|
if Bullet.enable?
config.before(:each) do
Bullet.start_request
end

config.after(:each) do
Bullet.perform_out_of_channel_notifications if Bullet.notification?
Bullet.end_request
end
end
end

0 comments on commit 996e0f1

Please sign in to comment.