Skip to content

Files

Latest commit

 

History

History
46 lines (31 loc) · 899 Bytes

RSpec-Capybara-MatchStyle.md

File metadata and controls

46 lines (31 loc) · 899 Bytes

Pattern: Use of deprecated style method

Issue: -

Description

Checks for usage of deprecated style methods.

Examples

when using assert_style

# bad
page.find(:css, '#first').assert_style(display: 'block')

# good
page.find(:css, '#first').assert_matches_style(display: 'block')

when using has_style?

# bad
expect(page.find(:css, 'first')
  .has_style?(display: 'block')).to be true

# good
expect(page.find(:css, 'first')
  .matches_style?(display: 'block')).to be true

when using have_style

# bad
expect(page).to have_style(display: 'block')

# good
expect(page).to match_style(display: 'block')

Further Reading