Module: Capybara::RSpecMatchers

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

Defined Under Namespace

Classes: BecomeClosed, HaveCurrentPath, HaveSelector, HaveText, HaveTitle, MatchSelector, 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)

Parameters:

  • options (Hash) (defaults to: {})

    optional param

Options Hash (options):

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

    Maximum wait time



299
300
301
# File 'lib/capybara/rspec/matchers.rb', line 299

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

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



269
270
271
# File 'lib/capybara/rspec/matchers.rb', line 269

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

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



277
278
279
# File 'lib/capybara/rspec/matchers.rb', line 277

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

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



244
245
246
# File 'lib/capybara/rspec/matchers.rb', line 244

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

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



261
262
263
# File 'lib/capybara/rspec/matchers.rb', line 261

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

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



273
274
275
# File 'lib/capybara/rspec/matchers.rb', line 273

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


265
266
267
# File 'lib/capybara/rspec/matchers.rb', line 265

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

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



285
286
287
# File 'lib/capybara/rspec/matchers.rb', line 285

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

#have_selector(*args) ⇒ Object



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

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

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



289
290
291
# File 'lib/capybara/rspec/matchers.rb', line 289

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

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



252
253
254
# File 'lib/capybara/rspec/matchers.rb', line 252

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

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



257
258
259
# File 'lib/capybara/rspec/matchers.rb', line 257

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

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



281
282
283
# File 'lib/capybara/rspec/matchers.rb', line 281

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

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



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

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

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



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

def match_css(css, options={})
  MatchSelector.new(:css, css, options)
end

#match_selector(*args) ⇒ Object



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

def match_selector(*args)
  MatchSelector.new(*args)
end

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



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

def match_xpath(xpath, options={})
  MatchSelector.new(:xpath, xpath, options)
end