Sha256: 3f57cccbfeb15771ff44ebdb2f6c5ff88ef897555d4958eeda0b9f17a3b09b84

Contents?: true

Size: 672 Bytes

Versions: 9

Compression:

Stored size: 672 Bytes

Contents

require "spec_helper"
MetricFu.lib_require { "calculate" }

describe MetricFu::Calculate do
  describe "returns a percent rounded to the nearest integer" do
    specify "3 / 10 == 30" do
      expect(MetricFu::Calculate.integer_percent(3, 10)).to eq(30)
    end
    specify "3.0 / 10 == 30" do
      expect(MetricFu::Calculate.integer_percent(3.0, 10)).to eq(30)
    end
    it "raises an ArgumentError on non-numeric input" do
      expect {
        MetricFu::Calculate.integer_percent("", 10)
      }.to raise_error(ArgumentError)
    end
    it "returns 0 when the denominator is 0" do
      expect(MetricFu::Calculate.integer_percent(3, 0)).to eq(0)
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
metric_fu-4.13.0 spec/metric_fu/calculate_spec.rb
fastruby-metric_fu-5.0.0 spec/metric_fu/calculate_spec.rb
code_metric_fu-4.14.4 spec/metric_fu/calculate_spec.rb
code_metric_fu-4.14.3 spec/metric_fu/calculate_spec.rb
code_metric_fu-4.14.2 spec/metric_fu/calculate_spec.rb
code_metric_fu-4.14.1 spec/metric_fu/calculate_spec.rb
code_metric_fu-4.14.0 spec/metric_fu/calculate_spec.rb
metric_fu-4.12.0 spec/metric_fu/calculate_spec.rb
metric_fu-4.11.4 spec/metric_fu/calculate_spec.rb