spec/integration/yard/arstotzka/reader_spec.rb in arstotzka-1.0.4 vs spec/integration/yard/arstotzka/reader_spec.rb in arstotzka-1.1.0
- old
+ new
@@ -2,13 +2,13 @@
require 'spec_helper'
describe Arstotzka::Reader do
describe 'yard' do
- subject(:reader) { described_class.new(path: path, case_type: case_type) }
+ subject(:reader) { described_class.new(keys: keys, case: case_type) }
- let(:path) { %w[person full_name] }
+ let(:keys) { %w[person full_name] }
let(:case_type) { :snake }
describe '#read' do
let(:hash) do
{
@@ -25,11 +25,11 @@
it 'fetches the value using snake case key' do
expect(reader.read(hash, 1)).to eq('John')
end
context 'when key is missing' do
- let(:path) { %w[person car_collection model] }
+ let(:keys) { %w[person car_collection model] }
it do
expect do
reader.read(hash, 1)
end.to raise_error(Arstotzka::Exception::KeyNotFound)
@@ -37,11 +37,11 @@
end
end
context 'when using lowerCamel' do
let(:case_type) { :lower_camel }
- let(:path) { %w[person car_collection model] }
+ let(:keys) { %w[person car_collection model] }
it 'fetches the value using lower camel case key' do
expected = [
{ maker: 'Ford', 'model' => 'Model A' },
{ maker: 'BMW', 'model' => 'Jetta' }
@@ -50,10 +50,10 @@
end
end
context 'when using UpperCamel' do
let(:case_type) { :upper_camel }
- let(:path) { %w[person age] }
+ let(:keys) { %w[person age] }
it 'fetches the value using uper camel case key' do
expect(reader.read(hash, 1)).to eq(23)
end
end