Module: Capybara::RSpecMatchers

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

Defined Under Namespace

Classes: BecomeClosed, HaveSelector, HaveText, HaveTitle, Matcher

Instance Method Summary (collapse)

Instance Method Details

- (Object) become_closed(options = {})

Wait for window to become closed.

Examples:

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

Options Hash (options):

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

    wait time



209
210
211
# File 'lib/capybara/rspec/matchers.rb', line 209

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

- (Object) have_button(locator, options = {})



179
180
181
# File 'lib/capybara/rspec/matchers.rb', line 179

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

- (Object) have_checked_field(locator, options = {})



187
188
189
# File 'lib/capybara/rspec/matchers.rb', line 187

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

- (Object) have_css(css, options = {})



162
163
164
# File 'lib/capybara/rspec/matchers.rb', line 162

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

- (Object) have_field(locator, options = {})



183
184
185
# File 'lib/capybara/rspec/matchers.rb', line 183

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


175
176
177
# File 'lib/capybara/rspec/matchers.rb', line 175

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

- (Object) have_select(locator, options = {})



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

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

- (Object) have_selector(*args)



154
155
156
# File 'lib/capybara/rspec/matchers.rb', line 154

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

- (Object) have_table(locator, options = {})



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

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

- (Object) have_text(*args) Also known as: have_content



166
167
168
# File 'lib/capybara/rspec/matchers.rb', line 166

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

- (Object) have_title(title, options = {})



171
172
173
# File 'lib/capybara/rspec/matchers.rb', line 171

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

- (Object) have_unchecked_field(locator, options = {})



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

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

- (Object) have_xpath(xpath, options = {})



158
159
160
# File 'lib/capybara/rspec/matchers.rb', line 158

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