Sha256: 812ab01af3d3979dbd31bab06821917e3146fbd1ac5c7b138a4c2759d5c6f6de

Contents?: true

Size: 871 Bytes

Versions: 34

Compression:

Stored size: 871 Bytes

Contents

require_relative 'test_helper'

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

34 entries across 34 versions & 1 rubygems

Version Path
meducation_sdk-2.2.2 test/mocker_test.rb
meducation_sdk-2.2.1 test/mocker_test.rb
meducation_sdk-2.2.0 test/mocker_test.rb
meducation_sdk-2.1.4 test/mocker_test.rb
meducation_sdk-2.1.3 test/mocker_test.rb
meducation_sdk-2.1.2 test/mocker_test.rb
meducation_sdk-2.1.1 test/mocker_test.rb
meducation_sdk-2.1.0 test/mocker_test.rb
meducation_sdk-2.0.5 test/mocker_test.rb
meducation_sdk-2.0.4 test/mocker_test.rb
meducation_sdk-2.0.3 test/mocker_test.rb
meducation_sdk-2.0.2 test/mocker_test.rb
meducation_sdk-2.0.1 test/mocker_test.rb
meducation_sdk-2.0.0 test/mocker_test.rb
meducation_sdk-1.6.16 test/mocker_test.rb
meducation_sdk-1.6.15 test/mocker_test.rb
meducation_sdk-1.6.14 test/mocker_test.rb
meducation_sdk-1.6.13 test/mocker_test.rb
meducation_sdk-1.6.12 test/mocker_test.rb
meducation_sdk-1.6.11 test/mocker_test.rb