Module: Capybara::RSpecMatchers

Defined in:
lib/capybara/rspec/matchers.rb

Defined Under Namespace

Classes: HaveMatcher, HaveSelector

Instance Method Summary collapse

Instance Method Details

#have_button(locator) ⇒ Object



128
129
130
# File 'lib/capybara/rspec/matchers.rb', line 128

def have_button(locator)
  HaveMatcher.new(:button, locator)
end

#have_checked_field(locator) ⇒ Object



136
137
138
# File 'lib/capybara/rspec/matchers.rb', line 136

def have_checked_field(locator)
  HaveMatcher.new(:checked_field, locator)
end

#have_content(text) ⇒ Object



112
113
114
115
116
# File 'lib/capybara/rspec/matchers.rb', line 112

def have_content(text)
  HaveMatcher.new(:content, text.to_s) do |page, matcher|
    %(expected there to be content #{matcher.locator.inspect} in #{page.text.inspect})
  end
end

#have_css(css, options = {}) ⇒ Object



108
109
110
# File 'lib/capybara/rspec/matchers.rb', line 108

def have_css(css, options={})
  HaveMatcher.new(:css, css, options)
end

#have_field(locator, options = {}) ⇒ Object



132
133
134
# File 'lib/capybara/rspec/matchers.rb', line 132

def have_field(locator, options={})
  HaveMatcher.new(:field, locator, options)
end


124
125
126
# File 'lib/capybara/rspec/matchers.rb', line 124

def have_link(locator, options={})
  HaveMatcher.new(:link, locator, options)
end

#have_select(locator, options = {}) ⇒ Object



144
145
146
# File 'lib/capybara/rspec/matchers.rb', line 144

def have_select(locator, options={})
  HaveMatcher.new(:select, locator, options)
end

#have_selector(*args) ⇒ Object



100
101
102
# File 'lib/capybara/rspec/matchers.rb', line 100

def have_selector(*args)
  HaveSelector.new(*args)
end

#have_table(locator, options = {}) ⇒ Object



148
149
150
# File 'lib/capybara/rspec/matchers.rb', line 148

def have_table(locator, options={})
  HaveMatcher.new(:table, locator, options)
end

#have_text(text) ⇒ Object



118
119
120
121
122
# File 'lib/capybara/rspec/matchers.rb', line 118

def have_text(text)
  HaveMatcher.new(:text, text.to_s) do |page, matcher|
    %(expected there to be text #{matcher.locator.inspect} in #{page.text.inspect})
  end
end

#have_unchecked_field(locator) ⇒ Object



140
141
142
# File 'lib/capybara/rspec/matchers.rb', line 140

def have_unchecked_field(locator)
  HaveMatcher.new(:unchecked_field, locator)
end

#have_xpath(xpath, options = {}) ⇒ Object



104
105
106
# File 'lib/capybara/rspec/matchers.rb', line 104

def have_xpath(xpath, options={})
  HaveMatcher.new(:xpath, xpath, options)
end