Sha256: 0afe39d8fcedd11d028316467900367887f5f55d9cb56692337381829ea22078
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# TODO: This will not work until we solve issue #62. # Until then, these tests are pending. # rubocop:disable RSpec/DescribeClass shared_examples_for '.save with nested model' do |required_hash, nested_model_key, nested_model_hash, nested_entity| describe '.save with nested model' do let( :repository ){ described_class.new } let( :new_hash ) do required_hash.merge( nested_model_key => nested_entity ) end let( :response ) do VCR.use_cassette( "#{ vcr_dir }/save_with_nested_model" ) do model = described_class::MODEL.new( new_hash ) repository.save( model ) end end it 'does not raise any errors' do expect{ response }.not_to raise_error end describe 'returned entity\'s nested model' do subject(:returned_nested_model){ response.send(nested_model_key).first } it 'has the wanted attributes' do nested_model_hash.each do |attribute, value| expect(returned_nested_model.send(attribute)).to eq(value) end end end end end # rubocop:enable RSpec/DescribeClass
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fortnox-api-0.3.0 | spec/fortnox/api/repositories/examples/save_with_nested_model.rb |
fortnox-api-0.2.0 | spec/fortnox/api/repositories/examples/save_with_nested_model.rb |