Sha256: b9930d297ef60032b1328ee0d27823fb642cb913db59f915d661ea9afa495e60

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

# 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!

# rubocop:disable RSpec/DescribeClass
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

4 entries across 4 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.5.1 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.5.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.4.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb