Module: Capybara::RSpecMatchers

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

Defined Under Namespace

Classes: BecomeClosed, HaveCurrentPath, HaveSelector, HaveText, HaveTitle, Matcher

Instance Method Summary collapse

Instance Method Details

#become_closed(options = {}) ⇒ Object

Wait for window to become closed.

Examples:

expect(window).to become_closed(wait: 0.8)

Options Hash (options):

  • :wait (Numeric) — default: Capybara.default_max_wait_time

    Maximum wait time



249
250
251
# File 'lib/capybara/rspec/matchers.rb', line 249

def become_closed(options = {})
  BecomeClosed.new(options)
end

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



219
220
221
# File 'lib/capybara/rspec/matchers.rb', line 219

def have_button(locator, options={})
  HaveSelector.new(:button, locator, options)
end

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



227
228
229
# File 'lib/capybara/rspec/matchers.rb', line 227

def have_checked_field(locator, options={})
  HaveSelector.new(:field, locator, options.merge(:checked => true))
end

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



198
199
200
# File 'lib/capybara/rspec/matchers.rb', line 198

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

#have_current_path(path, options = {}) ⇒ Object



211
212
213
# File 'lib/capybara/rspec/matchers.rb', line 211

def have_current_path(path, options = {})
  HaveCurrentPath.new(path, options)
end

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



223
224
225
# File 'lib/capybara/rspec/matchers.rb', line 223

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


215
216
217
# File 'lib/capybara/rspec/matchers.rb', line 215

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

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



235
236
237
# File 'lib/capybara/rspec/matchers.rb', line 235

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

#have_selector(*args) ⇒ Object



190
191
192
# File 'lib/capybara/rspec/matchers.rb', line 190

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

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



239
240
241
# File 'lib/capybara/rspec/matchers.rb', line 239

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

#have_text(*args) ⇒ Object Also known as: have_content



202
203
204
# File 'lib/capybara/rspec/matchers.rb', line 202

def have_text(*args)
  HaveText.new(*args)
end

#have_title(title, options = {}) ⇒ Object



207
208
209
# File 'lib/capybara/rspec/matchers.rb', line 207

def have_title(title, options = {})
  HaveTitle.new(title, options)
end

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



231
232
233
# File 'lib/capybara/rspec/matchers.rb', line 231

def have_unchecked_field(locator, options={})
  HaveSelector.new(:field, locator, options.merge(:unchecked => true))
end

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



194
195
196
# File 'lib/capybara/rspec/matchers.rb', line 194

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