Sha256: a9e83b79109a49bc2348070b4d9f95297ca2c1b0300ddf4c7451c21bb38e8e50

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 KB

Contents

require "spec_helper"
MetricFu.reporting_require { 'result' }

describe MetricFu do

  describe "#result" do
    it 'should return an instance of Result' do
      expect(MetricFu.result.instance_of?(Result)).to be(true)
    end
  end
end

describe MetricFu::Result do

  before(:each) do
    @result = MetricFu::Result.new
  end

  describe "#as_yaml" do
    it 'should call #result_hash' do
      result_hash = double('result_hash')
      expect(result_hash).to receive(:to_yaml)

      expect(@result).to receive(:result_hash).and_return(result_hash)
      @result.as_yaml
    end
  end

  describe "#result_hash" do
  end

  describe "#add" do
    it 'should add a passed hash to the result_hash instance variable' do
      result_type = double('result_type')
      allow(result_type).to receive(:to_s).and_return('type')

      result_inst = double('result_inst')
      expect(result_type).to receive(:new).and_return(result_inst)

      expect(result_inst).to receive(:generate_result).and_return({:a => 'b'})
      expect(result_inst).to receive(:respond_to?).and_return(false)

      expect(MetricFu::Generator).to receive(:get_generator).
               with(result_type).and_return(result_type)
      result_hash = double('result_hash')
      expect(result_hash).to receive(:merge!).with({:a => 'b'})
      expect(@result).to receive(:result_hash).and_return(result_hash)
      expect(@result).to receive(:metric_options_for_result_type).with(result_type)
      @result.add(result_type)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
metric_fu-4.11.1 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.11.0 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.10.0 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.9.0 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.8.0 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.7.4 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.7.3 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.7.2 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.7.1 spec/metric_fu/reporting/result_spec.rb
metric_fu-4.7.0 spec/metric_fu/reporting/result_spec.rb