Sha256: 19aee0d12f4bbfa5ccfc7db8d1e644c32c7f9b134ab8c0f1ced15bb4891c333a
Contents?: true
Size: 1.42 KB
Versions: 14
Compression:
Stored size: 1.42 KB
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 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) assert_equal authors, topic.authors assert_equal authors, topic.instance_variable_get(:@authors) end def test_collection_calls_spi topic = CollectionTopic.new(collection_id: 373) MeducationSDK::Collection.expects(:find).with(373) topic.collection end def test_users_calls_spi authors = [ Author.new(user_id: 8), Author.new(user_id: 10) ] users = [ User.new(id: 8), User.new(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]).returns(users) assert_equal users, topic.users assert_equal users, topic.instance_variable_get(:@users) end end end
Version data entries
14 entries across 14 versions & 1 rubygems