Sha256: 35f45e50b1fe675dcd7a8ca440d7d5afaeab2edd3667748dc8a2b4a485b07849

Contents?: true

Size: 910 Bytes

Versions: 12

Compression:

Stored size: 910 Bytes

Contents

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

module MeducationSDK
  class CollectionTopicTest < ResourceTest
    test_resource(CollectionTopic, '/collection_topics')

    def test_comments_calls_sdk
      topic = CollectionTopic.new(comment_ids: [7, 8, 9])
      MeducationSDK::Comment.expects(:where).with(id: [7, 8, 9])
      topic.comments
    end
    def test_authors_calls_spi
      topic = CollectionTopic.new(author_ids: [7, 8, 9])
      MeducationSDK::Author.expects(:where).with(id: [7, 8, 9])
      topic.authors
    end
    def test_users_calls_spi
      authors = [
        Author.new(user_id: 8),
        Author.new(user_id: 10)
      ]
      topic = CollectionTopic.new(author_ids: [7, 8, 9])
      MeducationSDK::Author.expects(:where).with(id: [7, 8, 9]).returns(authors)
      MeducationSDK::User.expects(:where).with(id: [8, 10])
      topic.users
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
meducation_sdk-1.6.13 test/resources/collection_topic_test.rb
meducation_sdk-1.6.12 test/resources/collection_topic_test.rb
meducation_sdk-1.6.11 test/resources/collection_topic_test.rb
meducation_sdk-1.6.10 test/resources/collection_topic_test.rb
meducation_sdk-1.6.6 test/resources/collection_topic_test.rb
meducation_sdk-1.6.5 test/resources/collection_topic_test.rb
meducation_sdk-1.6.4 test/resources/collection_topic_test.rb
meducation_sdk-1.6.3 test/resources/collection_topic_test.rb
meducation_sdk-1.6.2 test/resources/collection_topic_test.rb
meducation_sdk-1.6.1 test/resources/collection_topic_test.rb
meducation_sdk-1.6.0 test/resources/collection_topic_test.rb
meducation_sdk-1.5.7 test/resources/collection_topic_test.rb