Sha256: 26cce76f5f61fd0bacb968abec7b5938d637c2495d62f11b2c1b3dd91b38075b

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

def mock_server_and_api
  # standard server mocks
  @api_mock = mock(BigBlueButton::BigBlueButtonApi)
  @server_mock = mock_model(BigbluebuttonServer)
  @server_mock.stub(:api) { @api_mock }
  BigbluebuttonServer.stub(:find) { @server_mock }
  BigbluebuttonServer.stub(:find_by_param) { @server_mock }

  # when testing rooms
  if defined?(room) and not room.nil?
    room.stub(:server) { @server_mock }
    BigbluebuttonRoom.stub(:find_by_param) { room }
    BigbluebuttonRoom.stub(:find) { room }
  end

  # when testing recordings
  unless not defined?(recording) or recording.nil?
    recording.room.stub(:server) { nil } # to make sure room.server is not used!
    recording.stub(:server) { @server_mock }
    BigbluebuttonRecording.stub(:find_by_recordid) { recording }
    BigbluebuttonRecording.stub(:find) { recording }
  end
end

def mocked_server
  @server_mock
end

def mocked_api
  @api_mock
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bigbluebutton_rails-1.3.0.mweb1 spec/support/mocked_server.rb
bigbluebutton_rails-1.3.0 spec/support/mocked_server.rb
bigbluebutton_rails-1.3.0.beta1 spec/support/mocked_server.rb