spec/matchers/single_contain_matcher.rb in remarkable-3.1.8 vs spec/matchers/single_contain_matcher.rb in remarkable-3.1.9

- old
+ new

@@ -1,51 +1,51 @@ -module Remarkable - module Specs - module Matchers - class SingleContainMatcher < Remarkable::Base - arguments :value, :block => :iterator - - assertions :is_array?, :included? - - optional :allow_nil +module Remarkable + module Specs + module Matchers + class SingleContainMatcher < Remarkable::Base + arguments :value, :block => :iterator + + assertions :is_array?, :included? + + optional :allow_nil optional :allow_blank - optional :values, :splat => true - - after_initialize :set_after_initialize - - before_assert do + optional :values, :splat => true + + after_initialize :set_after_initialize + + before_assert do @before_assert = true - @subject.instance_eval(&@iterator) if @iterator - end - - protected - - def included? - return true if @subject.include?(@value) - - @expectation = "#{@value} is not included in #{@subject.inspect}" - false - end - - def is_array? - return true if @subject.is_a?(Array) - - @expectation = "subject is a #{subject_name}" - false - end - - def default_options - { :working => true } - end - - def set_after_initialize - @after_initialize = true - end - - end - - def single_contain(*args, &block) - SingleContainMatcher.new(*args, &block).spec(self) - end - end - end -end + @subject.instance_eval(&@iterator) if @iterator + end + + protected + + def included? + return true if @subject.include?(@value) + + @expectation = "#{@value} is not included in #{@subject.inspect}" + false + end + + def is_array? + return true if @subject.is_a?(Array) + + @expectation = "subject is a #{subject_name}" + false + end + + def default_options + { :working => true } + end + + def set_after_initialize + @after_initialize = true + end + + end + + def single_contain(*args, &block) + SingleContainMatcher.new(*args, &block).spec(self) + end + end + end +end