Sha256: 1cc9d63a581b48e76d623160647eda0553a4a3af33734c81fa93576f02a0682e

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

module VoicemailControllerSpecHelper
  def self.included(test_case)
    test_case.let(:from)    { "sip:user@server.com" }
    test_case.let(:call)    { flexmock 'Call', from: from }
    test_case.let(:config)  { Voicemail::Plugin.config }
    test_case.let(:greeting_message) { nil }
    test_case.let(:mailbox) do
      {
        id:               100,
        pin:              1234,
        greeting_message: greeting_message,
        send_email:       true,
        email_address:    'lpradovera@mojolingo.com'
      }
    end
    test_case.let(:storage_instance) { flexmock 'StorageInstance' }
    test_case.let(:metadata) do
      { :mailbox => '100', :storage => storage_instance }
    end

    test_case.subject(:controller) { flexmock test_case.described_class.new(call, metadata) }

    test_case.before(:each) do
      storage_instance.should_receive(:get_mailbox).with(metadata[:mailbox]).and_return(mailbox)
    end
  end

  def should_play(*args)
    subject.should_receive(:play).once.tap { |exp| exp.with(*args) if args.count > 0 }
  end

  def should_ask(*args)
    subject.should_receive(:ask).with(*args).once
  end

  def should_invoke(*args)
    subject.should_receive(:invoke).once.with(*args)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voicemail-1.1.1 spec/support/voicemail_controller_spec_helper.rb
voicemail-1.1.0 spec/support/voicemail_controller_spec_helper.rb
voicemail-1.0.0 spec/support/voicemail_controller_spec_helper.rb
voicemail-1.0.0.beta spec/support/voicemail_controller_spec_helper.rb
voicemail-0.2.0 spec/support/voicemail_controller_spec_helper.rb
voicemail-0.1.0 spec/support/voicemail_controller_spec_helper.rb