Sha256: 8b57fbe5b5c5b625f0458504f020962522e9692105d5cf98de9bec5811cbf009

Contents?: true

Size: 902 Bytes

Versions: 10

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true

# 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

10 entries across 10 versions & 1 rubygems

Version Path
fortnox-api-0.8.2 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.8.1 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.8.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.7.2 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.7.1 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.7.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.6.3 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.6.2 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.6.1 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb
fortnox-api-0.6.0 spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb