Sha256: 41a9b0d355825cb944c48556c2f17a455dedfefbb5fed534e6d41f583d2b6dbc

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

# rubocop:disable RSpec/DescribeClass
shared_examples_for '.search' do |attribute_hash_key_name, value, matches|
  describe '.search' do

    describe 'search' do
      context "with no matches" do
        subject do
          VCR.use_cassette( "#{ vcr_dir }/search_miss" ) do
            repository.search( attribute_hash_key_name => 'nothing' )
          end
        end

        it{ is_expected.to be_instance_of( Array ) }
        it{ is_expected.to have(0).entries }
      end

      context "with #{ matches } match(es)" do
        subject do
          VCR.use_cassette( "#{ vcr_dir }/search_by_name" ) do
            repository.search( attribute_hash_key_name => value )
          end
        end

        it{ is_expected.to be_instance_of( Array) }
        it{ is_expected.to have(matches).entries }
      end

    end
  end
end
# rubocop:enable RSpec/DescribeClass

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fortnox-api-0.2.0 spec/fortnox/api/repositories/examples/search.rb