Sha256: 0757061474c1991cc6ef51e36d76e58228f01e2e38c063fa30fca58fc9e870ac

Contents?: true

Size: 986 Bytes

Versions: 17

Compression:

Stored size: 986 Bytes

Contents

module Consul
  module Spec
    module Matchers

      class CheckPower

        def initialize(*args)
          @expected_args = args
        end

        def matches?(controller)
          @controller_class = controller.class
          @actual_args = @controller_class.instance_variable_get('@consul_power_args')
          @actual_args == @expected_args
        end

        def failure_message
          "expected #{@controller_class} to check against power #{@expected_args.inspect} but it checked against #{@actual_args.inspect}"
        end

        def negative_failure_message
          "expected #{@controller_class} to not check against power #{@expected_args.inspect}"
        end

        def description
          description = "check against power #{@expected_args.inspect}"
          description
        end

      end

      def check_power(*args)
        CheckPower.new(*args)
      end

    end
  end
end

ActiveSupport::TestCase.send :include, Consul::Spec::Matchers

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
consul-0.9.1 lib/consul/spec/matchers.rb
consul-0.9.0 lib/consul/spec/matchers.rb
consul-0.8.0 lib/consul/spec/matchers.rb
consul-0.7.0 lib/consul/spec/matchers.rb
consul-0.6.1 lib/consul/spec/matchers.rb
consul-0.6.0 lib/consul/spec/matchers.rb
consul-0.5.0 lib/consul/spec/matchers.rb
consul-0.4.2 lib/consul/spec/matchers.rb
consul-0.4.1 lib/consul/spec/matchers.rb
consul-0.4.0 lib/consul/spec/matchers.rb
consul-0.3.0 lib/consul/spec/matchers.rb
consul-0.2.3 lib/consul/spec/matchers.rb
consul-0.2.2 lib/consul/spec/matchers.rb
consul-0.2.1 lib/consul/spec/matchers.rb
consul-0.2.0 lib/consul/spec/matchers.rb
consul-0.1.2 lib/consul/spec/matchers.rb
consul-0.1.1 lib/consul/spec/matchers.rb