module InputModeMatchers { :hiragana => '-wap-input-format:"*"', :hankaku => '-wap-input-format:"*"', :alphabetic => '-wap-input-format:"*"', :numeric => '-wap-input-format:"*"' }.each do |mode, style| define_method("be_docomo_#{mode}") { DocomoInputMode.new style } end class DocomoInputMode def initialize(expected) @expected = expected end def matches?(target) @target = target @target["style"].eql?(@expected) end def failure_message_for_should "expected #{@target.native} to have style='#{@expected}'" end def failure_message_for_should_not "expected #{@target.native} not to have style='#{@expected}'" end end end