Skip to content

Commit

Permalink
Convert specs to RSpec 3.0.2 syntax with Transpec
Browse files Browse the repository at this point in the history
This conversion is done by Transpec 2.3.1 with the following command:
    transpec -f -k oneliner,have_items,its

* 4 conversions
    from: failure_message_for_should { }
      to: failure_message { }

* 4 conversions
    from: failure_message_for_should_not { }
      to: failure_message_when_negated { }

* 1 conversion
    from: obj.stub(:message => value)
      to: allow(obj).to receive_messages(:message => value)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
  • Loading branch information
Mange committed Jun 23, 2014
1 parent 9c9e242 commit 35a9ab9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion roadie.gemspec
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency 'nokogiri', '~> 1.6.0'
s.add_dependency 'css_parser', '~> 1.3.4'

s.add_development_dependency 'rspec', '2.99'
s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'rspec-collection_matchers', '~> 1.0'

s.extra_rdoc_files = %w[README.md Changelog.md]
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/roadie/stylesheet_spec.rb
Expand Up @@ -26,7 +26,7 @@ module Roadie
bad = double(inlinable?: false, selector: "bad", properties: "props")

stylesheet = Stylesheet.new("example.css", "")
stylesheet.stub blocks: [bad, inlinable, bad]
allow(stylesheet).to receive_messages blocks: [bad, inlinable, bad]

expect(stylesheet.each_inlinable_block.to_a).to eq([
["good", "props"],
Expand Down
4 changes: 2 additions & 2 deletions spec/support/have_attribute_matcher.rb
Expand Up @@ -11,11 +11,11 @@
end

description { "have attribute #{attribute.inspect} at selector #{@selector.inspect}" }
failure_message_for_should do |document|
failure_message do |document|
name, expected = attribute.first
"expected #{name} attribute at #{@selector.inspect} to be #{expected.inspect} but was #{attribute(document, name).inspect}"
end
failure_message_for_should_not do |document|
failure_message_when_negated do |document|
name, expected = attribute.first
"expected #{name} attribute at #{@selector.inspect} to not be #{expected.inspect}"
end
Expand Down
4 changes: 2 additions & 2 deletions spec/support/have_node_matcher.rb
Expand Up @@ -9,8 +9,8 @@
end
end

failure_message_for_should { "expected document to #{name_to_sentence}#{expected_to_sentence}"}
failure_message_for_should_not { "expected document to not #{name_to_sentence}#{expected_to_sentence}"}
failure_message { "expected document to #{name_to_sentence}#{expected_to_sentence}"}
failure_message_when_negated { "expected document to not #{name_to_sentence}#{expected_to_sentence}"}

def match_attributes(node_attributes)
attributes = Hash[node_attributes.map { |name, attribute| [name, attribute.value] }]
Expand Down
4 changes: 2 additions & 2 deletions spec/support/have_selector_matcher.rb
@@ -1,6 +1,6 @@
RSpec::Matchers.define :have_selector do |selector|
match { |document| !document.css(selector).empty? }
failure_message_for_should { "expected document to #{name_to_sentence}#{expected_to_sentence}"}
failure_message_for_should_not { "expected document to not #{name_to_sentence}#{expected_to_sentence}"}
failure_message { "expected document to #{name_to_sentence}#{expected_to_sentence}"}
failure_message_when_negated { "expected document to not #{name_to_sentence}#{expected_to_sentence}"}
end

4 changes: 2 additions & 2 deletions spec/support/have_styling_matcher.rb
Expand Up @@ -9,11 +9,11 @@
"have styles #{normalized_rules.inspect} at selector #{@selector.inspect}"
}

failure_message_for_should { |document|
failure_message { |document|
"expected styles at #{@selector.inspect} to be:\n#{normalized_rules}\nbut was:\n#{styles_at_selector(document)}"
}

failure_message_for_should_not {
failure_message_when_negated {
"expected styles at #{@selector.inspect} to not be:\n#{normalized_rules}"
}

Expand Down

0 comments on commit 35a9ab9

Please sign in to comment.