Sha256: 82c92821749bf26fa16b2da8f0612f1b9e0d09cb5f124254e1e66f0713eb83d9

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

def mock_server_and_api
  # standard server mocks
  @api_mock = double(BigBlueButton::BigBlueButtonApi)
  @server_mock = stub_model(BigbluebuttonServer, :id => 1, :param => "any")
  @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

2 entries across 2 versions & 1 rubygems

Version Path
bigbluebutton_rails-1.4.0 spec/support/mocked_server.rb
bigbluebutton_rails-1.4.0.beta1 spec/support/mocked_server.rb