deface 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -2
  4. data/README.markdown +3 -11
  5. data/deface.gemspec +4 -4
  6. data/lib/deface/applicator.rb +1 -1
  7. data/lib/deface/dsl/loader.rb +42 -34
  8. data/lib/deface/railtie.rb +2 -2
  9. data/lib/deface/slim_converter.rb +15 -0
  10. data/lib/deface/sources/copy.rb +1 -1
  11. data/lib/deface/sources/slim.rb +2 -2
  12. data/lib/deface/template_helper.rb +1 -1
  13. data/spec/deface/action_view_template_spec.rb +12 -12
  14. data/spec/deface/actions/add_to_attributes_spec.rb +8 -8
  15. data/spec/deface/actions/insert_after_spec.rb +1 -1
  16. data/spec/deface/actions/insert_before_spec.rb +1 -1
  17. data/spec/deface/actions/insert_bottom_spec.rb +2 -2
  18. data/spec/deface/actions/insert_top_spec.rb +2 -2
  19. data/spec/deface/actions/remove_from_attributes_spec.rb +9 -9
  20. data/spec/deface/actions/remove_spec.rb +2 -2
  21. data/spec/deface/actions/replace_contents_spec.rb +2 -2
  22. data/spec/deface/actions/replace_spec.rb +10 -10
  23. data/spec/deface/actions/set_attributes_spec.rb +11 -11
  24. data/spec/deface/actions/surround_contents_spec.rb +5 -5
  25. data/spec/deface/actions/surround_spec.rb +5 -5
  26. data/spec/deface/applicator_spec.rb +6 -6
  27. data/spec/deface/dsl/context_spec.rb +7 -7
  28. data/spec/deface/dsl/loader_spec.rb +74 -77
  29. data/spec/deface/environment_spec.rb +38 -38
  30. data/spec/deface/haml_converter_spec.rb +24 -24
  31. data/spec/deface/override_spec.rb +90 -90
  32. data/spec/deface/parser_spec.rb +54 -54
  33. data/spec/deface/precompiler_spec.rb +7 -7
  34. data/spec/deface/search_spec.rb +7 -7
  35. data/spec/deface/slim_converter_spec.rb +32 -0
  36. data/spec/deface/template_helper_spec.rb +21 -22
  37. data/spec/deface/utils/failure_finder_spec.rb +11 -11
  38. data/spec/spec_helper.rb +25 -17
  39. metadata +33 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97ffccb90e6da94c30f13a7e7fa0ff5cb58b46e0
4
- data.tar.gz: 53c04295d2d4ce3d84247cd92a235c65aae26463
3
+ metadata.gz: 362600d10ec6ef2e0156d59d64d4dd8f3fb92a20
4
+ data.tar.gz: 9900d892be3f317070b21aa8f0d81d2c12d9b44b
5
5
  SHA512:
6
- metadata.gz: 25ae8cc02921a14f84262ee46bfb5e940314e652abd05bfc72a87c403471039fe83326d4a7ef3869e3fd1994654fb109492f71f5b8baa46558e8f850a499c0af
7
- data.tar.gz: bc8523db0265c48f27a56ca31a82893c82ccb029e70098255d80a6f911438ab5241d5f0022118fcc156c9e43b4b030e7da737f1ccfb51676ce8ac77d58a9802e
6
+ metadata.gz: 665ab9e4c61bfcb42d9812688f7d3abdd5f8a79724c0e7e4f7be062f2abff6e5c578644d6088cf6786110fca1cb878920be2e37cfac1f3841d990a37f2a67e0e
7
+ data.tar.gz: 46e41b81bb39faa7bb21b5f7581c66f0edc73e423b80ddd7b5519a23a3f087caf0de53e739939576212baa87fe461fab15752d67f5c36d72ef836b191855cc3a
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  pkg
4
4
  Gemfile.lock
5
5
  coverage/
6
+ .bundle/
data/Gemfile CHANGED
@@ -3,8 +3,9 @@ source 'https://rubygems.org'
3
3
  gem 'rails', ENV['RAILS'] || '~> 3.2.13'
4
4
 
5
5
  group :test do
6
- gem "pry"
7
- gem "pry-byebug"
6
+ gem 'test-unit'
7
+ gem 'pry'
8
+ gem 'pry-byebug'
8
9
  end
9
10
 
10
11
  gemspec
@@ -1,8 +1,4 @@
1
- <p style="float:right;">
2
- <a href="http://secure.travis-ci.org/spree/deface">
3
- <img src="https://secure.travis-ci.org/spree/deface.png?branch=master">
4
- </a>
5
- </p>
1
+ [![Build Status](https://travis-ci.org/DefaceCommunity/deface.svg?branch=master)](https://travis-ci.org/DefaceCommunity/deface)
6
2
 
7
3
  Deface
8
4
  ======
@@ -308,7 +304,7 @@ allowing overrides in different engines with identical filenames to co-exist.
308
304
 
309
305
  ### DSL usage for overrides that do not include markup
310
306
 
311
- If your override does not require any markup, for example actions including ````:remove, :set_attributes, :remove_from_attributes, :add_to_attrbiutes```` you can exclude the "html.erb" or "html.haml" from the file name and you do not need to wrap the arguments in a comment.
307
+ If your override does not require any markup, for example actions including ````:remove, :set_attributes, :remove_from_attributes, :add_to_attributes```` you can exclude the "html.erb" or "html.haml" from the file name and you do not need to wrap the arguments in a comment.
312
308
 
313
309
  So the override filename becomes simply:
314
310
 
@@ -412,11 +408,7 @@ Deface uses the amazing Nokogiri library (and in turn libxml) for parsing HTML /
412
408
 
413
409
  1. Ensure that your layout views include doctype, html, head and body tags in a single file, as Nokogiri will create such elements if it detects any of these tags have been incorrectly nested.
414
410
 
415
- 2. Parsing will fail and result in invalid output if ERB blocks are responsible for closing an HTML tag that was opened normally, i.e. don't do this:
416
-
417
- ```html
418
- &lt;div <%= ">" %>
419
- ```
411
+ 2. Parsing will fail and result in invalid output if ERB blocks are responsible for closing an HTML tag that was opened normally, i.e. don't do this: `&lt;div <%= ">" %>`
420
412
 
421
413
  3. Gems or Spree Extensions that add overrides to your application will load them in the order they are added to your Gemfile.
422
414
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "deface"
3
- s.version = "1.0.1"
3
+ s.version = "1.0.2"
4
4
 
5
5
  s.authors = ["Brian D Quinn"]
6
6
  s.description = "Deface is a library that allows you to customize ERB, Haml and Slim views in a Rails application without editing the underlying view."
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  ]
11
11
  s.files = `git ls-files`.split("\n")
12
12
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
- s.homepage = "https://github.com/spree/deface"
13
+ s.homepage = "https://github.com/DefaceCommunity/deface"
14
14
  s.rdoc_options = ["--charset=UTF-8"]
15
15
  s.require_paths = ["lib"]
16
16
  s.summary = "Deface is a library that allows you to customize ERB, Haml and Slim views in Rails"
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency('colorize', '>= 0.5.8')
21
21
  s.add_dependency('polyglot')
22
22
 
23
- s.add_development_dependency('rspec', '>= 2.11.0')
23
+ s.add_development_dependency('rspec', '>= 3.1.0')
24
24
  s.add_development_dependency('haml', '>= 3.1.4')
25
- s.add_development_dependency('slim', '2.0.0') # 2.0.1 breaks slim loader specs
25
+ s.add_development_dependency('slim', '>= 2.0.0') # 2.0.1 breaks slim loader specs
26
26
  s.add_development_dependency('simplecov', '>= 0.6.4')
27
27
  s.add_development_dependency('generator_spec', '~> 0.8')
28
28
  end
@@ -16,7 +16,7 @@ module Deface
16
16
  #convert haml to erb before parsing before
17
17
  source = Deface::HamlConverter.new(source).result
18
18
  when :slim
19
- source = Slim::ERBConverter.new.call(source)
19
+ source = Deface::SlimConverter.new(source).result
20
20
  end
21
21
 
22
22
  doc = Deface::Parser.convert(source)
@@ -19,42 +19,50 @@ module Deface
19
19
 
20
20
  file_contents = file.read
21
21
 
22
- if context_name.end_with?('.html.erb')
23
- dsl_commands, the_rest = extract_dsl_commands_from_erb(file_contents)
24
-
25
- context_name = context_name.gsub('.html.erb', '')
26
- context = Context.new(context_name)
27
- context.virtual_path(determine_virtual_path(filename))
28
- context.instance_eval(dsl_commands)
29
- context.erb(the_rest)
30
- context.create_override
31
- elsif context_name.end_with?('.html.haml')
32
- dsl_commands, the_rest = extract_dsl_commands_from_haml(file_contents)
33
-
34
- context_name = context_name.gsub('.html.haml', '')
35
- context = Context.new(context_name)
36
- context.virtual_path(determine_virtual_path(filename))
37
- context.instance_eval(dsl_commands)
38
- context.haml(the_rest)
39
- context.create_override
40
- elsif context_name.end_with?('.html.slim')
41
- dsl_commands, the_rest = extract_dsl_commands_from_slim(file_contents)
42
-
43
- context_name = context_name.gsub('.html.slim', '')
44
- context = Context.new(context_name)
45
- context.virtual_path(determine_virtual_path(filename))
46
- context.instance_eval(dsl_commands)
47
- context.slim(the_rest)
48
- context.create_override
49
- else
50
- context = Context.new(context_name)
51
- context.virtual_path(determine_virtual_path(filename))
52
- context.instance_eval(file_contents)
53
- context.create_override
54
- end
22
+ build_context(context_name, filename, file_contents)
55
23
  end
56
24
  end
57
25
 
26
+ def self.build_context(context_name, filename, file_contents)
27
+ send build_context_method_name(context_name), context_name, filename, file_contents
28
+ end
29
+
30
+ def self.build_context_method_name(context_name)
31
+ ext = File.extname(context_name).gsub(".", '')
32
+ ext = "other" if ext.empty?
33
+ "build_#{ext}_context"
34
+ end
35
+
36
+ def self.build_erb_context(context_name, filename, file_contents)
37
+ build_context_and_extract_dsl_from('erb', context_name, filename, file_contents)
38
+ end
39
+
40
+ def self.build_haml_context(context_name, filename, file_contents)
41
+ build_context_and_extract_dsl_from('haml', context_name, filename, file_contents)
42
+ end
43
+
44
+ def self.build_slim_context(context_name, filename, file_contents)
45
+ build_context_and_extract_dsl_from('slim', context_name, filename, file_contents)
46
+ end
47
+
48
+ def self.build_context_and_extract_dsl_from(type, context_name, filename, file_contents)
49
+ dsl_commands, the_rest = send "extract_dsl_commands_from_#{type}", (file_contents)
50
+
51
+ context_name = context_name.gsub(".html.#{type}", '')
52
+ context = Context.new(context_name)
53
+ context.virtual_path(determine_virtual_path(filename))
54
+ context.instance_eval(dsl_commands)
55
+ context.send type, the_rest
56
+ context.create_override
57
+ end
58
+
59
+ def self.build_other_context(context_name, filename, file_contents)
60
+ context = Context.new(context_name)
61
+ context.virtual_path(determine_virtual_path(filename))
62
+ context.instance_eval(file_contents)
63
+ context.create_override
64
+ end
65
+
58
66
  def self.register
59
67
  Polyglot.register('deface', Deface::DSL::Loader)
60
68
  end
@@ -140,4 +148,4 @@ module Deface
140
148
  end
141
149
  end
142
150
  end
143
- end
151
+ end
@@ -46,7 +46,7 @@ module Deface
46
46
  end
47
47
 
48
48
  railties.each do |railtie|
49
- next unless railtie.respond_to? :root
49
+ next unless railtie.respond_to?(:root) && railtie.config.respond_to?(:eager_load_paths)
50
50
  railtie.config.eager_load_paths.reject! {|path| path =~ /app\/overrides\z/ }
51
51
  end
52
52
  end
@@ -70,7 +70,7 @@ module Deface
70
70
 
71
71
  if defined?(Slim)
72
72
  app.config.deface.slim_support = true
73
- require 'slim/erb_converter'
73
+ require 'deface/slim_converter'
74
74
  end
75
75
 
76
76
  # catchs any overrides that we required manually
@@ -0,0 +1,15 @@
1
+ require 'slim/erb_converter'
2
+
3
+ module Deface
4
+ class SlimConverter
5
+
6
+ def initialize(template, options = {})
7
+ @template = template
8
+ end
9
+
10
+ def result
11
+ ::Slim::ERBConverter.new.call(@template).gsub /<%\s*%>/, ''
12
+ end
13
+
14
+ end
15
+ end
@@ -7,7 +7,7 @@ module Deface
7
7
  range = Deface::Matchers::Range.new('Copy', copy[:start], copy[:end]).matches(override.parsed_document).first
8
8
  Deface::Parser.undo_erb_markup! range.map(&:to_s).join
9
9
  else
10
- Deface::Parser.undo_erb_markup! override.parsed_document.css(copy).first.to_s.clone
10
+ Deface::Parser.undo_erb_markup! override.parsed_document.css(copy).first.to_s.clone
11
11
  end
12
12
  end
13
13
  end
@@ -3,11 +3,11 @@ module Deface
3
3
  class Slim < Source
4
4
  def self.execute(override)
5
5
  if Rails.application.config.deface.slim_support
6
- ::Slim::ERBConverter.new.call(override.args[:slim])
6
+ Deface::SlimConverter.new(override.args[:slim]).result
7
7
  else
8
8
  raise Deface::NotSupportedError, "`#{override.name}` supplies :slim source, but slim_support is not detected."
9
9
  end
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -23,7 +23,7 @@ module Deface
23
23
  if view.handler.to_s == "Haml::Plugin"
24
24
  Deface::HamlConverter.new(view.source).result
25
25
  elsif view.handler.class.to_s == "Slim::RailsTemplate"
26
- Slim::ERBConverter.new.call(view.source)
26
+ Deface::SlimConverter.new(view.source).result
27
27
  else
28
28
  view.source
29
29
  end
@@ -10,20 +10,20 @@ module ActionView
10
10
  @template = ActionView::Template.new("<p>test</p>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html, :updated_at => @updated_at})
11
11
  #stub for Rails < 3.1
12
12
  unless defined?(@template.updated_at)
13
- @template.stub(:updated_at).and_return(@updated_at)
13
+ allow(@template).to receive(:updated_at).and_return(@updated_at)
14
14
  end
15
15
  end
16
16
 
17
17
  it "should initialize new template object" do
18
- @template.is_a?(ActionView::Template).should == true
18
+ expect(@template.is_a?(ActionView::Template)).to eq(true)
19
19
  end
20
20
 
21
21
  it "should return unmodified source" do
22
- @template.source.should == "<p>test</p>"
22
+ expect(@template.source).to eq("<p>test</p>")
23
23
  end
24
24
 
25
25
  it "should not change updated_at" do
26
- @template.updated_at.should == @updated_at
26
+ expect(@template.updated_at).to eq(@updated_at)
27
27
  end
28
28
 
29
29
  end
@@ -35,16 +35,16 @@ module ActionView
35
35
  @template = ActionView::Template.new("<p>test</p><%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html, :updated_at => @updated_at})
36
36
  #stub for Rails < 3.1
37
37
  unless defined?(@template.updated_at)
38
- @template.stub(:updated_at).and_return(@updated_at + 500)
38
+ allow(@template).to receive(:updated_at).and_return(@updated_at + 500)
39
39
  end
40
40
  end
41
41
 
42
42
  it "should return modified source" do
43
- @template.source.should == "<%= raw(text) %>"
43
+ expect(@template.source).to eq("<%= raw(text) %>")
44
44
  end
45
45
 
46
46
  it "should change updated_at" do
47
- @template.updated_at.should > @updated_at
47
+ expect(@template.updated_at).to be > @updated_at
48
48
  end
49
49
  end
50
50
 
@@ -54,11 +54,11 @@ module ActionView
54
54
  it "should return hash of overrides plus original method_name " do
55
55
  deface_hash = Deface::Override.digest(:virtual_path => 'posts/index')
56
56
 
57
- template.send(:method_name).should == "_#{Digest::MD5.new.update("#{deface_hash}_#{template.send(:method_name_without_deface)}").hexdigest}"
57
+ expect(template.send(:method_name)).to eq("_#{Digest::MD5.new.update("#{deface_hash}_#{template.send(:method_name_without_deface)}").hexdigest}")
58
58
  end
59
59
 
60
60
  it "should alias original method_name method" do
61
- template.send(:method_name_without_deface).should match /\A__some_path_to_file_erb_+[0-9]+_+[0-9]+\z/
61
+ expect(template.send(:method_name_without_deface)).to match /\A__some_path_to_file_erb_+[0-9]+_+[0-9]+\z/
62
62
  end
63
63
  end
64
64
 
@@ -70,7 +70,7 @@ module ActionView
70
70
 
71
71
  it "should return unmodified source" do
72
72
  #if processed, source would include "=&gt;"
73
- @template.source.should == "xml.post => :blah"
73
+ expect(@template.source).to eq("xml.post => :blah")
74
74
  end
75
75
  end
76
76
 
@@ -85,9 +85,9 @@ module ActionView
85
85
  ActionView::Template::Handlers::Builder => false }
86
86
  expectations.each do |handler, expected|
87
87
  @template = ActionView::Template.new("xml.post => :blah", "/some/path/to/file.erb", handler, {:virtual_path=>"posts/index", :format=>:xml, :updated_at => (Time.now - 100)})
88
- @template.is_a?(ActionView::Template).should == true
88
+ expect(@template.is_a?(ActionView::Template)).to eq(true)
89
89
  syntax = @template.send(:determine_syntax, handler)
90
- @template.send(:should_be_defaced?, syntax).should eq(expected), "unexpected result for handler "+handler.to_s
90
+ expect(@template.send(:should_be_defaced?, syntax)).to eq(expected), "unexpected result for handler "+handler.to_s
91
91
  end
92
92
  end
93
93
  end
@@ -14,8 +14,8 @@ module Deface
14
14
  it "should return modified source" do
15
15
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
16
16
 
17
- attrs["class"].value.should == "button pretty"
18
- attrs["alt"].value.should == "something interesting"
17
+ expect(attrs["class"].value).to eq("button pretty")
18
+ expect(attrs["alt"].value).to eq("something interesting")
19
19
  end
20
20
  end
21
21
 
@@ -27,8 +27,8 @@ module Deface
27
27
  it "should return modified source" do
28
28
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
29
29
 
30
- attrs["class"].value.should == "button <%= add_class %>"
31
- attrs["src"].value.should == "path/to/button.png"
30
+ expect(attrs["class"].value).to eq("button <%= add_class %>")
31
+ expect(attrs["src"].value).to eq("path/to/button.png")
32
32
  end
33
33
  end
34
34
 
@@ -40,8 +40,8 @@ module Deface
40
40
  it "should return modified source" do
41
41
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
42
42
 
43
- attrs["class"].value.should == "button <%= add_class %>"
44
- attrs["src"].value.should == "path/to/button.png"
43
+ expect(attrs["class"].value).to eq("button <%= add_class %>")
44
+ expect(attrs["src"].value).to eq("path/to/button.png")
45
45
  end
46
46
  end
47
47
 
@@ -53,8 +53,8 @@ module Deface
53
53
  it "should return modified source" do
54
54
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
55
55
 
56
- attrs["class"].value.should == "<%= get_class %> <%= get_some_other_class %>"
57
- attrs["src"].value.should == "path/to/button.png"
56
+ expect(attrs["class"].value).to eq("<%= get_class %> <%= get_some_other_class %>")
57
+ expect(attrs["src"].value).to eq("path/to/button.png")
58
58
  end
59
59
  end
60
60
  end
@@ -11,7 +11,7 @@ module Deface
11
11
  let(:source) { "<div><img class=\"button\" src=\"path/to/button.png\"></div>" }
12
12
 
13
13
  it "should return modified source" do
14
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<div><img class=\"button\" src=\"path/to/button.png\"><% help %></div>"
14
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<div><img class=\"button\" src=\"path/to/button.png\"><% help %></div>")
15
15
  end
16
16
  end
17
17
  end
@@ -11,7 +11,7 @@ module Deface
11
11
  let(:source) { "<ul><li>first</li><li>second</li><li>third</li></ul>" }
12
12
 
13
13
  it "should return modified source" do
14
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><%= help %></ul>"
14
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>first</li><li>second</li><li>third</li><%= help %></ul>")
15
15
  end
16
16
  end
17
17
  end
@@ -11,7 +11,7 @@ module Deface
11
11
  let(:source) { "<ul><li>first</li><li>second</li><li>third</li></ul>" }
12
12
 
13
13
  it "should return modified source" do
14
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><li>I'm always last</li></ul>"
14
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>first</li><li>second</li><li>third</li><li>I'm always last</li></ul>")
15
15
  end
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ module Deface
20
20
  let(:source) { "<ul></ul>" }
21
21
 
22
22
  it "should return modified source" do
23
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>I'm always last</li></ul>"
23
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>I'm always last</li></ul>")
24
24
  end
25
25
  end
26
26
  end
@@ -11,7 +11,7 @@ module Deface
11
11
  let(:source) { "<ul><li>first</li><li>second</li><li>third</li></ul>" }
12
12
 
13
13
  it "should return modified source" do
14
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>me first</li><li>first</li><li>second</li><li>third</li></ul>"
14
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>me first</li><li>first</li><li>second</li><li>third</li></ul>")
15
15
  end
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ module Deface
20
20
  let(:source) { "<ul></ul>" }
21
21
 
22
22
  it "should return modified source" do
23
- Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li></ul>"
23
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>first</li><li>second</li><li>third</li></ul>")
24
24
  end
25
25
  end
26
26
  end
@@ -14,7 +14,7 @@ module Deface
14
14
  it "should return modified source" do
15
15
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
16
16
 
17
- attrs["class"].value.should == "button"
17
+ expect(attrs["class"].value).to eq("button")
18
18
  end
19
19
  end
20
20
 
@@ -26,8 +26,8 @@ module Deface
26
26
  it "should return modified source" do
27
27
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
28
28
 
29
- attrs["class"].value.should == "button"
30
- attrs["src"].value.should == "path/to/button.png"
29
+ expect(attrs["class"].value).to eq("button")
30
+ expect(attrs["src"].value).to eq("path/to/button.png")
31
31
  end
32
32
  end
33
33
 
@@ -39,8 +39,8 @@ module Deface
39
39
  it "should return modified source" do
40
40
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
41
41
 
42
- attrs["class"].value.should == "button"
43
- attrs["src"].value.should == "path/to/button.png"
42
+ expect(attrs["class"].value).to eq("button")
43
+ expect(attrs["src"].value).to eq("path/to/button.png")
44
44
  end
45
45
  end
46
46
 
@@ -50,7 +50,7 @@ module Deface
50
50
  let(:source) { "<img class=\"button\" src=\"path/to/button.png\">" }
51
51
 
52
52
  it "should return unmodified source" do
53
- Dummy.apply(source, {:virtual_path => "posts/index"}).should == "<img class=\"button\" src=\"path/to/button.png\">"
53
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"})).to eq("<img class=\"button\" src=\"path/to/button.png\">")
54
54
  end
55
55
  end
56
56
 
@@ -60,7 +60,7 @@ module Deface
60
60
  let(:source) { "<img src=\"path/to/button.png\">" }
61
61
 
62
62
  it "should return unmodified source" do
63
- Dummy.apply(source, {:virtual_path => "posts/index"}).should == "<img src=\"path/to/button.png\">"
63
+ expect(Dummy.apply(source, {:virtual_path => "posts/index"})).to eq("<img src=\"path/to/button.png\">")
64
64
  end
65
65
  end
66
66
 
@@ -72,8 +72,8 @@ module Deface
72
72
  it "should return modified source" do
73
73
  attrs = attributes_to_sorted_array(Dummy.apply(source, {:virtual_path => "posts/index"}))
74
74
 
75
- attrs["class"].value.should == "<%= get_class %>"
76
- attrs["src"].value.should == "path/to/button.png"
75
+ expect(attrs["class"].value).to eq("<%= get_class %>")
76
+ expect(attrs["src"].value).to eq("path/to/button.png")
77
77
  end
78
78
  end
79
79
  end