Skip to content

Commit

Permalink
Require Rails frameworks before using
Browse files Browse the repository at this point in the history
Jbuilder since #501 depends on Action View so we need to make it a
dependency.

Also we should be requiring both action_view and active_support before
using it.

Closes #518.
  • Loading branch information
rafaelfranca committed Dec 21, 2021
1 parent 68a0911 commit a2aacff
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions jbuilder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.2.2'

s.add_dependency 'activesupport', '>= 5.0.0'
s.add_dependency 'actionview', '>= 5.0.0'

if RUBY_ENGINE == 'rbx'
s.add_development_dependency('racc')
Expand Down
1 change: 1 addition & 0 deletions lib/jbuilder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'active_support'
require 'jbuilder/jbuilder'
require 'jbuilder/blank'
require 'jbuilder/key_formatter'
Expand Down
1 change: 1 addition & 0 deletions lib/jbuilder/collection_renderer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'delegate'
require 'active_support/concern'
require 'action_view'

begin
require 'action_view/renderer/collection_renderer'
Expand Down
2 changes: 1 addition & 1 deletion lib/jbuilder/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'rails/railtie'
require 'rails'
require 'jbuilder/jbuilder_template'

class Jbuilder
Expand Down
7 changes: 2 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
require "bundler/setup"

require "active_support"
require "jbuilder"

require "active_support/core_ext/array/access"
require "active_support/cache/memory_store"
require "active_support/json"
require "active_model"
require "action_view"
require "rails/version"

require "jbuilder"

require "active_support/testing/autorun"
require "mocha/minitest"
Expand Down

0 comments on commit a2aacff

Please sign in to comment.