Sha256: e3f62f320a6cc449e3beb53d18ac6f3ec3d9e3891a86c2241f8fe051b6c3d2c8

Contents?: true

Size: 915 Bytes

Versions: 2

Compression:

Stored size: 915 Bytes

Contents

# rubocop:disable RSpec/DescribeClass
# Test saving model with attributes that has specially names that needs to be mapped.
#
# NOTE: VCR cassette must be discarded when repositories are updated to reflect
# the changes!
shared_examples_for '.save with specially named attribute' do |required_hash, attribute, value|
  describe '.save' do
    context 'with specially named attribute' do
      subject{ ->{ save_model } }

      let( :new_model ){ described_class::MODEL.new( required_hash.merge(attribute => value) ) }
      let( :save_model )do
        VCR.use_cassette( "#{ vcr_dir }/save_with_specially_named_attribute" ) do
            repository.save( new_model )
        end
      end

      it{ is_expected.not_to raise_error }

      describe 'response' do
        subject{ save_model.send(attribute) }
        it{ is_expected.to eq(value) }
      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_specially_named_attribute.rb
fortnox-api-0.2.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb