Sha256: b7b95d0fcbf9565186d65d40ffa3537be5d78ea882778bf32a764883691c723e

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 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
      media_file.title.should == "Abdominal Ultrasound Tutorial"
    ensure
      MeducationSDK::Mocker.unmock!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meducation_sdk-0.1.0 test/mocker_test.rb