Sha256: 241de8726ef4d4b2dc51b35268131ac996876b650ec30c5b3b8187383a8f955b

Contents?: true

Size: 723 Bytes

Versions: 26

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'

describe Betterdocs::Dsl::Result::CollectionProperty do
  let :result do
    {}
  end

  let :representer do
    double('Betterdocs::ResultRepresenter')
  end

  let :sub_representer do
    double(
      'Betterdocs::ResultRepresenter',
      hashify: { 'a' => 'hash' },
      '<': true
    )
  end

  let :property do
    sr = sub_representer
    described_class.new(representer, 'test', {}) do
      represent_with sr
    end
  end

  let :members do
    [ double('Member'), double('Member') ]
  end

  it 'calls representer for every member' do
    property.assign(result, double(test: members))
    expect(result['test']).to eq [
      { 'a' => 'hash' },
      { 'a' => 'hash' },
    ]
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
betterdocs-0.13.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.5 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.4 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.3 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.2 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.1 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.12.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.11.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.10.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.9.2 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.9.1 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.9.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.8.1 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.8.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.7.1 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.7.0 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.6.8 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.6.7 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.6.6 spec/betterdocs/dsl/result/collection_property_spec.rb
betterdocs-0.6.5 spec/betterdocs/dsl/result/collection_property_spec.rb