Sha256: a8c7a816cb71fe36010e98511cb9b58362356fcd0962989d60cdbf58926f9cb9

Contents?: true

Size: 662 Bytes

Versions: 5

Compression:

Stored size: 662 Bytes

Contents

require 'spec_helper'

describe AngularSprinkles::ModelDecorator do
  let(:key) { 'key' }
  let(:object) { Object.new }
  let(:attribute) { :a }
  let(:json_wrapper) { ->(key, attribute) { "#{key}+#{attribute}"} }
  let(:object_wrapper) { Array }

  subject do
    described_class.new(key: key, object: object, json_wrapper: json_wrapper, object_wrapper: object_wrapper)
  end

  describe "#bind" do
    it 'returns a binding object' do
      expect(object_wrapper).to receive(:new).with(key, attribute, json_wrapper)
      subject.bind(attribute)

      expect(object_wrapper).to receive(:new).with(key, nil, json_wrapper)
      subject.bind
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
angular_sprinkles-0.0.9 spec/angular_sprinkles/model_decorator_spec.rb
angular_sprinkles-0.0.8 spec/angular_sprinkles/model_decorator_spec.rb
angular_sprinkles-0.0.7 spec/angular_sprinkles/model_decorator_spec.rb
angular_sprinkles-0.0.6 spec/angular_sprinkles/model_decorator_spec.rb
angular_sprinkles-0.0.5 spec/angular_sprinkles/model_decorator_spec.rb