Sha256: c978611282c5501e2a1f41564f8bd0c17e4a4de247b192541a3451a985d4a69b

Contents?: true

Size: 684 Bytes

Versions: 25

Compression:

Stored size: 684 Bytes

Contents

require 'rails_helper'

describe LHS::Data do

  before(:each) do
    class SomeService < LHS::Service
      map :test_mapping?, ->(item){ true }
    end
  end

  context '#respond_to?' do

    it 'it is true for mappings that are defined' do
      data = described_class.new({'campaign' => {'id' => 123}}, nil, SomeService)

      expect(data.respond_to?(:test_mapping?)).to be(true)
    end

    # proxy for this example is LHC::Collection which implements total
    it 'it is true for calls forwarded to proxy' do
      data = described_class.new({'items' => [{'campaign' => {'id' => 123}}]}, nil, SomeService)

      expect(data.respond_to?(:total)).to be(true)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
lhs-2.2.2 spec/data/respond_to_spec.rb
lhs-1.6.1 spec/data/respond_to_spec.rb
lhs-2.2.1 spec/data/respond_to_spec.rb
lhs-2.2.0 spec/data/respond_to_spec.rb
lhs-1.6.0 spec/data/respond_to_spec.rb
lhs-2.1.1 spec/data/respond_to_spec.rb
lhs-2.1.0 spec/data/respond_to_spec.rb
lhs-2.0.5 spec/data/respond_to_spec.rb
lhs-2.0.4 spec/data/respond_to_spec.rb
lhs-2.0.3 spec/data/respond_to_spec.rb
lhs-2.0.2 spec/data/respond_to_spec.rb
lhs-2.0.1 spec/data/respond_to_spec.rb
lhs-2.0.0 spec/data/respond_to_spec.rb
lhs-1.5.0 spec/data/respond_to_spec.rb
lhs-1.4.0 spec/data/respond_to_spec.rb
lhs-1.3.1 spec/data/respond_to_spec.rb
lhs-1.3.0 spec/data/respond_to_spec.rb
lhs-1.2.3 spec/data/respond_to_spec.rb
lhs-1.2.2 spec/data/respond_to_spec.rb
lhs-1.2.1 spec/data/respond_to_spec.rb