Sha256: e39a50ef77543e4b3e88095a40f0732ec5d01f4479509d45a148e11f4c37280c

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'
require_relative '../lib/sandi_meter/rules_checker'

describe SandiMeter::RulesChecker do
  let(:fail_conditions) do
    {
      first_rule:  { small_classes_amount: 1,      total_classes_amount: 2 },
      second_rule: { small_methods_amount: 2,      total_methods_amount: 2 },
      third_rule:  { proper_method_calls: 2,       total_method_calls: 2 },
      fourth_rule: { proper_controllers_amount: 2, total_controllers_amount: 2 }
    }
  end

  let(:succeed_conditions) do
    {
      first_rule:  { small_classes_amount: 2,      total_classes_amount: 2 },
      second_rule: { small_methods_amount: 2,      total_methods_amount: 2 },
      third_rule:  { proper_method_calls: 2,       total_method_calls: 2 },
      fourth_rule: { proper_controllers_amount: 0, total_controllers_amount: 0 }
    }
  end

  describe "#ok?" do
    it "returns false in any of conditions fail" do
      expect(SandiMeter::RulesChecker.new(fail_conditions)).to_not be_ok
    end

    it "returns true if all of conditions succeed" do
      expect(SandiMeter::RulesChecker.new(succeed_conditions)).to be_ok
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sandi_meter-1.0.5 spec/rules_checker_spec.rb
sandi_meter-1.0.4 spec/rules_checker_spec.rb