forked from hashie/hashie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hashie#559 - #deep_symbolize_keys is inconsistent in Rails 7
- Loading branch information
1 parent
3e57eb5
commit ffd328e
Showing
8 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--colour | ||
--format=documentation | ||
--pattern=*_spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'hashie', path: '../../..' | ||
gem 'rails', '~> 7.0.2.3' | ||
gem 'rspec', '~> 3.11.0' | ||
gem 'rspec-rails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'action_controller/railtie' | ||
require 'action_view/railtie' | ||
require 'action_view/testing/resolvers' | ||
require 'rails/test_unit/railtie' | ||
|
||
module RailsApp | ||
class Application < ::Rails::Application | ||
config.eager_load = false | ||
config.secret_key_base = 'hashieintegrationtest' | ||
end | ||
end | ||
|
||
Bundler.require(:default, Rails.env) | ||
|
||
RailsApp::Application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
ENV['RAILS_ENV'] = 'test' | ||
|
||
require 'rspec/core' | ||
|
||
RSpec.describe 'rails' do | ||
before do | ||
require 'bundler' | ||
require_relative 'app' | ||
require 'rspec/rails' | ||
end | ||
|
||
it 'uses rails7' do | ||
expect(Rails.version).to(eq("7.0.2.3")) | ||
end | ||
|
||
context '#deep_symbolize_keys' do | ||
let(:mash) do | ||
Hashie::Mash.new("shallow" => 1, "top-level" => { "deep" => 3, "nested" => 4 }) | ||
end | ||
|
||
subject { mash.deep_symbolize_keys } | ||
|
||
it 'symbolizes keys by access' do | ||
expect(mash[:'top-level'][:deep]).to(eq(3)) | ||
end | ||
|
||
it 'does not play well with #without, which calls each element directly' do | ||
expect(mash[:'top-level'].without(:deep, :nested)).to(be_blank) | ||
end | ||
|
||
it 'does play well with #except, which monkey-patches Hash' do | ||
expect(mash[:'top-level'].except(:deep, :nested)).to(be_blank) | ||
end | ||
end | ||
end |