Sha256: 69ca6a493befa357185e49c13c5852b7049c664ad2a96156c2a51342070123e4
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Arstotzka::Config do describe 'yard' do subject(:config) { Arstotzka.config } after { Arstotzka.reset_config } describe 'Redefining json method and case type' do let(:office) { Office.new(hash) } let(:hash) do { employes: [{ first_name: 'Rob' }, { first_name: 'Klara' }] } end let(:error_message) do "undefined method `json' for #{office}\nDid you mean? JSON" end it do expect { office.employes } .to raise_error(NoMethodError, error_message) end context 'when json option is defined' do before { Arstotzka.configure { json :@hash } } it do expect { Arstotzka.configure { |c| c.case :snake } } .to change(office, :employes) .from([]).to(%w[Rob Klara]) end end end describe '#options' do let(:overrides) { { klass: Person } } let(:expected) do { after: false, after_each: nil, cached: false, case: :snake, compact: false, default: nil, flatten: false, json: :json, klass: Person, type: :none } end before do Arstotzka.configure do |config| config.case :snake end end it 'configure options to use snake case' do expect(config.options(overrides).to_h).to eq(expected) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems