Sha256: 9f9b34fe900957c5424f44e60d62f0f1695ca3d223403b2eff58fadfe189c92c

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

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

module Troo
  module Remote
    describe Comment do
      let(:described_class) { Comment }
      let(:json) do
        "{\"id\":\"52f51fb0b6e6b1fb2de2949e\"," \
        "\"idMemberCreator\":\"5195fdb5a8c01a2318004f5d\"," \
        "\"data\":{\"text\":\"This is a comment.\"," \
        "\"card\":{\"id\":\"526d8f19ddb279532e005259\"}," \
        "\"board\":{\"id\":\"526d8e130a14a9d846001d96\"}}," \
        "\"date\":\"2014-02-07T18:02:24.297Z\"}"
      end

      describe '#id' do
        subject { described_class.create(json).id }

        it 'returns the comment ID' do
          subject.must_equal('52f51fb0b6e6b1fb2de2949e')
        end
      end

      describe '#member_creator_id' do
        subject { described_class.create(json).member_creator_id }

        it 'returns the member creator ID' do
          subject.must_equal('5195fdb5a8c01a2318004f5d')
        end
      end

      describe '#date' do
        subject { described_class.create(json).date }

        it 'returns the date the comment was created' do
          subject.must_equal('2014-02-07T18:02:24.297Z')
        end
      end

      describe '#data' do
        subject { described_class.create(json).data }

        it 'returns a hash of useful data' do
          subject.must_equal(
            'text' => 'This is a comment.',
            'card' => {
              'id' => '526d8f19ddb279532e005259'
            },
            'board' => {
              'id' => '526d8e130a14a9d846001d96'
            })
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 test/lib/troo/models/remote/comment_test.rb