Sha256: 4cadcb596bc2267ceab2c4996d65eb0cd7422db418a6ff2e838780d59278dbaf

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require_relative "../../../test_helper"

module Troo
  module External
    describe ListAdaptor do
      let(:described_class) { ListAdaptor }
      let(:resource) { OpenStruct.new({
        board_id: "526d8e130a14a9d846001d96",
        id:       "526d8e130a14a9d846001d97",
        name:     "My Test List",
        pos:      32768,
        closed:   false,
      }) }

      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 suitable 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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 test/lib/troo/external/list_adaptor_test.rb
troo-0.0.6 test/lib/troo/external/list_adaptor_test.rb
troo-0.0.5 test/lib/troo/external/list_adaptor_test.rb
troo-0.0.4 test/lib/troo/external/list_adaptor_test.rb
troo-0.0.3 test/lib/troo/external/list_adaptor_test.rb
troo-0.0.2 test/lib/troo/external/list_adaptor_test.rb