Class: Minitest::Capybara::Unit::Matcher::MatcherName

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest-capybara-unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ MatcherName

Returns a new instance of MatcherName.



63
64
65
66
# File 'lib/minitest-capybara-unit.rb', line 63

def initialize(name)
  @original = name
  @positive = true
end

Instance Attribute Details

#originalObject (readonly)

Returns the value of attribute original.



61
62
63
# File 'lib/minitest-capybara-unit.rb', line 61

def original
  @original
end

#positiveObject (readonly)

Returns the value of attribute positive.



61
62
63
# File 'lib/minitest-capybara-unit.rb', line 61

def positive
  @positive
end

Instance Method Details

#assertionObject



80
81
82
83
84
85
86
# File 'lib/minitest-capybara-unit.rb', line 80

def assertion
  if positive?
    "assert_page_#{without_question_mark}"
  else
    "refute_page_#{without_question_mark}"
  end
end

#negate!Object



72
73
74
# File 'lib/minitest-capybara-unit.rb', line 72

def negate!
  @positive = !positive
end

#positive?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/minitest-capybara-unit.rb', line 68

def positive?
  !!positive
end

#without_question_markObject



76
77
78
# File 'lib/minitest-capybara-unit.rb', line 76

def without_question_mark
  original.to_s.sub(/\?$/, '')
end