Sha256: 9b9e807f22dc7b223ae114ae9593e0a9da6cdca7b3128b591e4a0021d74eedce

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

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

module Troo
  module Remote
    describe Member do
      let(:described_class)    { Member }
      let(:resource) do
        mock_trello_response('member.json', Troo::Remote::Member)
      end
      let(:described_instance) { described_class.new(resource) }

      describe '.remote_options' do
        subject { described_class.remote_options }

        it 'returns the default remote options' do
          subject.fetch(:mode).must_equal(:member)
        end
      end

      describe '.by_board_id' do
        subject { described_class.by_board_id }

        it 'returns the resource parameters' do
          subject.fetch(:endpoint).must_equal(:members_by_board_id)
        end
      end

      describe '.by_member_id' do
        subject { described_class.by_member_id }

        it 'returns the resource parameters' do
          subject.fetch(:endpoint).must_equal(:member_by_id)
        end
      end

      describe '#associations' do
        subject { described_instance.associations }

        it { subject.must_equal [] }
      end

      describe '#local_model' do
        subject { described_instance.local_model }

        it { subject.must_equal Troo::Member }
      end

      describe '#adapted' do
        subject { described_instance.adapted }

        it 'returns an adapted resource for local persistence' do
          subject.must_equal(
            external_id: '20050',
            username:    'gavinlaking1',
            email:       'gavinlaking@gmail.com',
            full_name:   'Gavin Laking',
            initials:    'GL',
            avatar_id:   '20001',
            bio:         'some bio',
            url:         '<Trello URL>'
          )
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.10 test/lib/troo/remote/member_test.rb