Sha256: 4fb4d185eac1c0ef25fb60ce0cc6036dfa2ba3bba45adc660d42e22e2fda4096

Contents?: true

Size: 634 Bytes

Versions: 10

Compression:

Stored size: 634 Bytes

Contents

RSpec::Matchers.define :have_no_styling do
  chain(:at_selector) { |selector| @selector = selector }

  match { |document|
    @selector ||= 'body > *:first'
    styles_at_selector(document).empty?
  }

  description {
    "have no styles at selector #{@selector.inspect}"
  }

  failure_message { |document|
    "expected no styles at #{@selector.inspect} but had:\n#{styles_at_selector(document)}"
  }

  failure_message_when_negated {
    "expected #{@selector.inspect} to have styles"
  }

  def styles_at_selector(document)
    expect(document).to have_selector(@selector)
    document.at_css(@selector)['style'] || ""
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roadie-rails-1.2.0 spec/support/have_no_styling_matcher.rb
roadie-rails-1.1.1 spec/support/have_no_styling_matcher.rb
roadie-rails-1.1.0 spec/support/have_no_styling_matcher.rb
roadie-rails-1.1.0.rc2 spec/support/have_no_styling_matcher.rb
roadie-rails-1.1.0.rc1 spec/support/have_no_styling_matcher.rb
roadie-rails-1.0.6 spec/support/have_no_styling_matcher.rb
roadie-rails-1.0.5 spec/support/have_no_styling_matcher.rb
roadie-rails-1.0.4 spec/support/have_no_styling_matcher.rb
roadie-rails-1.0.3 spec/support/have_no_styling_matcher.rb
roadie-rails-1.0.2 spec/support/have_no_styling_matcher.rb