Skip to content

Commit

Permalink
Use free boolean methods, restore some janky adapter loading stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
djberg96 committed Mar 21, 2024
1 parent e965f54 commit f1995ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion spec/multi_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
end

context "automatic adapter loading" do
before{ MultiJson::OptionsCache.reset }
before do
if described_class.instance_variable_defined?(:@adapter)
described_class.send(:remove_instance_variable, :@adapter)
end
end

it "defaults to the best available gem" do
if RUBY_PLATFORM == 'java' && jrjackson?
Expand Down
13 changes: 7 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
c.syntax = :expect
end

# You must run 'bundle exec rake' for this to work properly
loaded_specs = Gem.loaded_specs

config.add_setting :java, :default => RUBY_PLATFORM == 'java'
Expand All @@ -17,12 +18,12 @@
config.add_setting :oj, :default => loaded_specs.has_key?('oj')
config.add_setting :yajl, :default => loaded_specs.has_key?('yajl')

config.filter_run_excluding(:gson) unless config.gson
config.filter_run_excluding(:json) unless config.json
config.filter_run_excluding(:json_pure) unless config.json_pure
config.filter_run_excluding(:ok_json) unless config.ok_json
config.filter_run_excluding(:oj) unless config.oj
config.filter_run_excluding(:yajl) unless config.yajl
config.filter_run_excluding(:gson) unless config.gson?
config.filter_run_excluding(:json) unless config.json?
config.filter_run_excluding(:json_pure) unless config.json_pure?
config.filter_run_excluding(:ok_json) unless config.ok_json?
config.filter_run_excluding(:oj) unless config.oj?
config.filter_run_excluding(:yajl) unless config.yajl?

unless config.java
config.filter_run_excluding(:java)
Expand Down

0 comments on commit f1995ad

Please sign in to comment.