Sha256: e318ae48eb4a997151575c4b6d8c1a36333ad6599c9cb5579177b51d94b5d39b

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe MetricFu::Metric do
  before do
    @metric = MetricFu::Metric.get_metric(:flog)
    #@original_options = @metric.run_options.dup
  end

  #it 'can have its run_options over-written' do
    #new_options = {:foo => 'bar'}
    #@metric.run_options = new_options
    #expect(@original_options).to_not eq(new_options)
    #expect(@metric.run_options).to eq(new_options)
  #end

  #it 'can have its run_options modified' do
    #new_options = {:foo => 'bar'}
    #@metric.run_options.merge!(new_options)
    #expect(@metric.run_options).to eq(@original_options.merge(new_options))
  #end

  context 'given a valid configurable option' do

    before do
      @metric.stub(:default_run_options).and_return({:foo => 'baz'})
    end

    it 'can be configured as an attribute' do
      @metric.foo = 'qux'
      expect(@metric.run_options[:foo]).to eq('qux')
    end

  end

  context 'given an invalid configurable option' do

    before do
      @metric.stub(:default_run_options).and_return({})
    end

    it 'raises an error' do
      expect { @metric.foo = 'bar' }.to raise_error(RuntimeError, /not a valid configuration option/)
    end

  end

  after do
    @metric.configured_run_options.clear
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metric_fu-4.6.0 spec/metric_fu/metric_spec.rb
metric_fu-4.5.2 spec/metric_fu/metric_spec.rb
metric_fu-4.5.1 spec/metric_fu/metric_spec.rb
metric_fu-4.4.4 spec/metric_fu/metric_spec.rb
metric_fu-4.4.3 spec/metric_fu/metric_spec.rb
metric_fu-4.4.2 spec/metric_fu/metric_spec.rb
metric_fu-4.4.1 spec/metric_fu/metric_spec.rb
metric_fu-4.4.0 spec/metric_fu/metric_spec.rb