Sha256: 32c73d1bb0e028ddabf586608acb371d4f5e681e03aadf29bb47b675dcf84464

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

module Troo
  module Decorators
    describe Member do
      let(:described_class) { Member }
      let(:options) { {} }

      before { @member = Fabricate(:member) }
      after  { database_cleanup }

      describe '#initialize' do
        subject { described_class.new(@member, options) }

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

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

      describe '#username' do
        subject { described_class.new(@member).username }

        it "returns the member's username" do
          subject.must_equal("@#{@member.username}")
        end
      end

      describe '#name' do
        subject { described_class.new(@member).name }

        it "returns the member's full name" do
          subject.must_equal(@member.full_name)
        end
      end

      describe '#initials' do
        subject { described_class.new(@member).initials }

        it "returns the member's initials" do
          subject.must_equal(@member.initials)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 test/lib/troo/decorators/member_test.rb