Sha256: d408205e2350874875f310bc023410a4b4476acbd5fafc11773cfb8ba834e1a1
Contents?: true
Size: 962 Bytes
Versions: 3
Compression:
Stored size: 962 Bytes
Contents
module GritterNotices module RSpecMatcher def have_gritter_notice(text=nil) HaveGritterNotice.new(text) end class HaveGritterNotice def initialize(text) @text = text end def description "send gritter notice '#{@text}' to '#{@model}" end def failure_text_for_should "#{@model.class} should have gritter_notice with text '#{@text}'" end def failure_text_for_should_not "#{@model.class} should not have an gritter_notice with text '#{@text}'" end def failure_message 'gritter_notice failure' end # def from(value) # @from = value # self # end # def to(value) # @to = value # self # end def matches?(model) @model = model not model.gritter_notices.select { |g| !@text or g.text == @text or g.options[:gritter_key] == @text }.empty? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gritter_notices-0.4.0 | lib/gritter_notices/rspec_matcher.rb |
gritter_notices-0.3.4 | lib/gritter_notices/rspec_matcher.rb |
gritter_notices-0.3.3 | lib/gritter_notices/rspec_matcher.rb |