Skip to content

Commit

Permalink
change to_h to to_hash in specs for 1.9.3 and rails 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
msimonborg committed Aug 5, 2017
1 parent b70fd09 commit b24d991
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions spec/rails/action_controller/parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
end

it 'only allows the named keys if they have the specified value' do
expect(params.allow(hi: 'hi', hello: 'goodbye').to_h).to eq('hi' => 'hi')
expect(params.allow(hi: 'hi', hello: 'goodbye').to_hash).to eq('hi' => 'hi')
end

it 'works with arrays of values' do
expect(
params.allow(hi: %w[hi hey], hello: %w[bye goodbye]).to_h
params.allow(hi: %w[hi hey], hello: %w[bye goodbye]).to_hash
).to eq('hi' => 'hi')
end

it 'does not mutate the original object' do
expect(params.allow(hi: 'hi', hello: 'goodbye').to_h).to eq('hi' => 'hi')
expect(params.to_h).to eq('hi' => 'hi', 'hello' => 'hello')
expect(params.allow(hi: 'hi', hello: 'goodbye').to_hash).to eq('hi' => 'hi')
expect(params.to_hash).to eq('hi' => 'hi', 'hello' => 'hello')
end
end

Expand All @@ -43,18 +43,18 @@
end

it 'only allows the named keys if they have the specified value' do
expect(params.allow!(hi: 'hi', hello: 'goodbye').to_h).to eq('hi' => 'hi')
expect(params.allow!(hi: 'hi', hello: 'goodbye').to_hash).to eq('hi' => 'hi')
end

it 'works with arrays of values' do
expect(
params.allow!(hi: %w[hi hey], hello: %w[bye goodbye]).to_h
params.allow!(hi: %w[hi hey], hello: %w[bye goodbye]).to_hash
).to eq('hi' => 'hi')
end

it 'does mutate the original object' do
expect(params.allow!(hi: 'hi', hello: 'goodbye').to_h).to eq('hi' => 'hi')
expect(params.to_h).to eq('hi' => 'hi')
expect(params.allow!(hi: 'hi', hello: 'goodbye').to_hash).to eq('hi' => 'hi')
expect(params.to_hash).to eq('hi' => 'hi')
end
end

Expand All @@ -64,18 +64,18 @@
end

it 'only forbids the named keys if they have the specified value' do
expect(params.forbid(hi: 'bye', hello: 'hello').to_h).to eq('hi' => 'hi')
expect(params.forbid(hi: 'bye', hello: 'hello').to_hash).to eq('hi' => 'hi')
end

it 'works with arrays of values' do
expect(
params.forbid(hi: %w[bye byebye], hello: %w[hello hey]).to_h
params.forbid(hi: %w[bye byebye], hello: %w[hello hey]).to_hash
).to eq('hi' => 'hi')
end

it 'does not mutate the original object' do
expect(params.forbid(hi: 'bye', hello: 'hello').to_h).to eq('hi' => 'hi')
expect(params.to_h).to eq('hi' => 'hi', 'hello' => 'hello')
expect(params.forbid(hi: 'bye', hello: 'hello').to_hash).to eq('hi' => 'hi')
expect(params.to_hash).to eq('hi' => 'hi', 'hello' => 'hello')
end
end

Expand All @@ -85,18 +85,18 @@
end

it 'only forbids the named keys if they have the specified value' do
expect(params.forbid!(hi: 'bye', hello: 'hello').to_h).to eq('hi' => 'hi')
expect(params.forbid!(hi: 'bye', hello: 'hello').to_hash).to eq('hi' => 'hi')
end

it 'works with arrays of values' do
expect(
params.forbid!(hi: %w[bye byebye], hello: %w[hello hey]).to_h
params.forbid!(hi: %w[bye byebye], hello: %w[hello hey]).to_hash
).to eq('hi' => 'hi')
end

it 'does mutate the original object' do
expect(params.forbid!(hi: 'bye', hello: 'hello').to_h).to eq('hi' => 'hi')
expect(params.to_h).to eq('hi' => 'hi')
expect(params.forbid!(hi: 'bye', hello: 'hello').to_hash).to eq('hi' => 'hi')
expect(params.to_hash).to eq('hi' => 'hi')
end
end
end

0 comments on commit b24d991

Please sign in to comment.