Sha256: ec21bd9f67d25140f0589931f0ba3720e7745d3b530c6b236e460a1c940b1ecf

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../../test_helper'

module Troo
  describe Adaptors::List do
    let(:described_class) { Adaptors::List }
    let(:resource) do
      OpenStruct.new(
        board_id: '526d8e130a14a9d846001d96',
        id:       '526d8e130a14a9d846001d97',
        name:     'My Test List',
        pos:      32_768,
        closed:   false)
    end

    describe '#initialize' do
      subject { described_class.new(resource) }

      it 'assigns the resource to an instance variable' do
        subject.instance_variable_get('@resource')
          .must_equal(resource)
      end
    end

    describe '#adapted' do
      subject { described_class.adapt(resource) }

      it 'returns an adapted resource for local persistence' do
        subject.must_equal(
          external_board_id: '526d8e130a14a9d846001d96',
          external_list_id:  '526d8e130a14a9d846001d97',
          name:              'My Test List',
          position:          '32768',
          closed:            'false'
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 test/lib/troo/adaptors/list_test.rb