Sha256: ef0704630b2327c2c5a2f4bc2a4603385069ee7d86a0c20c3bccb7fc3f18feec

Contents?: true

Size: 932 Bytes

Versions: 2

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

describe Bidu::Mercy::ReportConfig do
  let(:config) { {} }
  let(:parameters) { {} }
  let(:subject) { described_class.new(config) }

  describe '#build' do
    context 'when no config is given' do
      it do
        expect(subject.build(parameters)).to be_a(Bidu::Mercy::Report::Error)
      end
    end

    context 'when a dummy type is given' do
      let(:config) { { type: :dummy } }

      it do
        expect(subject.build(parameters)).to be_a(Bidu::Mercy::Report::Dummy)
      end
    end

    context 'when a class is given as type' do
      let(:config) { { type: Bidu::Mercy::Report::Dummy } }

      it do
        expect(subject.build(parameters)).to be_a(Bidu::Mercy::Report::Dummy)
      end
    end

    context 'when a global class is given as type' do
      let(:config) { { type: Dummy } }

      it do
        expect(subject.build(parameters)).to be_a(Dummy)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mercy-1.3.0 spec/lib/bidu/mercy/report/report_config_spec.rb
bidu-mercy-1.3.0 spec/lib/bidu/mercy/report/report_config_spec.rb