Sha256: 4bb7613f85962e606dd6023e23aa00258f24e859d43d2c059c3b54bf09bd1ccb

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

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

module Troo
  module External
    describe MemberAdaptor do
      let(:described_class) { MemberAdaptor }
      let(:resource) { OpenStruct.new({
        id:        "5195fdb5a8c01a2318004f5d",
        username:  "gavinlaking1",
        email:     "gavinlaking@gmail.com",
        full_name: "Gavin Laking",
        initials:  "GL",
        avatar_id: "some_avatar_id",
        bio:       "some bio",
        url:       "http://www.gavinlaking.name/"
      }) }

      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_member_id: "5195fdb5a8c01a2318004f5d",
            username:           "gavinlaking1",
            email:              "gavinlaking@gmail.com",
            full_name:          "Gavin Laking",
            initials:           "GL",
            avatar_id:          "some_avatar_id",
            bio:                "some bio",
            url:                "http://www.gavinlaking.name/",
          })
        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/member_adaptor_test.rb
troo-0.0.6 test/lib/troo/external/member_adaptor_test.rb
troo-0.0.5 test/lib/troo/external/member_adaptor_test.rb
troo-0.0.4 test/lib/troo/external/member_adaptor_test.rb
troo-0.0.3 test/lib/troo/external/member_adaptor_test.rb
troo-0.0.2 test/lib/troo/external/member_adaptor_test.rb