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

#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_wait_time

    wait time



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

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

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



164
165
166
# File 'lib/capybara/rspec/matchers.rb', line 164

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

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



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

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

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



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

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

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



168
169
170
# File 'lib/capybara/rspec/matchers.rb', line 168

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


160
161
162
# File 'lib/capybara/rspec/matchers.rb', line 160

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

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



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

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

#have_selector(*args) ⇒ Object



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

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

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



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

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

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



151
152
153
# File 'lib/capybara/rspec/matchers.rb', line 151

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

#have_title(title) ⇒ Object



156
157
158
# File 'lib/capybara/rspec/matchers.rb', line 156

def have_title(title)
  HaveTitle.new(title)
end

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



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

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

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



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

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