Sha256: b781d737a4a07743fd19cc47b9785665c9e8df10925fefbf1776bd1e2e9fdad7

Contents?: true

Size: 893 Bytes

Versions: 35

Compression:

Stored size: 893 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

module MeducationSDK
  class MockerTest < Minitest::Test

    def test_mock_switches_classes
      MeducationSDK.mock!
      assert MeducationSDK.const_defined?(:MediaFileOriginal)
      assert MeducationSDK.const_defined?(:MediaFile)
      refute MeducationSDK.const_defined?(:MediaFileMock)
    ensure
      MeducationSDK::Mocker.unmock!
    end

    def test_mock_substitutes_in_mock_classes
      MeducationSDK.mock!

      id = 5
      Loquor::HttpAction::Get.expects(:get).never
      assert id, MediaFile.find('id').id
    ensure
      MeducationSDK::Mocker.unmock!
    end

    def test_mock_sample_returns_media_file_with_attributes
      MeducationSDK.mock!

      media_file = MediaFile.sample
      assert_equal media_file.title, "Abdominal Ultrasound Tutorial"
    ensure
      MeducationSDK::Mocker.unmock!
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
meducation_sdk-1.5.1 test/mocker_test.rb
meducation_sdk-1.5.0 test/mocker_test.rb
meducation_sdk-1.4.4 test/mocker_test.rb
meducation_sdk-1.4.3 test/mocker_test.rb
meducation_sdk-1.4.2 test/mocker_test.rb
meducation_sdk-1.4.1 test/mocker_test.rb
meducation_sdk-1.4.0 test/mocker_test.rb
meducation_sdk-1.3.0 test/mocker_test.rb
meducation_sdk-1.2.6 test/mocker_test.rb
meducation_sdk-1.2.5 test/mocker_test.rb
meducation_sdk-1.2.4 test/mocker_test.rb
meducation_sdk-1.2.3 test/mocker_test.rb
meducation_sdk-1.2.2 test/mocker_test.rb
meducation_sdk-1.2.1 test/mocker_test.rb
meducation_sdk-1.2.0 test/mocker_test.rb
meducation_sdk-1.1.2 test/mocker_test.rb
meducation_sdk-1.1.1 test/mocker_test.rb
meducation_sdk-1.1.0 test/mocker_test.rb
meducation_sdk-1.0.0 test/mocker_test.rb
meducation_sdk-0.10.1 test/mocker_test.rb