deface 1.4.0 → 1.6.0

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.
@@ -561,37 +561,73 @@ module Deface
561
561
 
562
562
  describe "#expire_compiled_template" do
563
563
  it "should remove compiled method when method name matches virtual path but not digest" do
564
- instance_methods_count = ActionView::Base.instance_methods.size
564
+ if Deface.before_rails_6?
565
+ instance_methods_count = ActionView::CompiledTemplates.instance_methods.size
565
566
 
566
- ActionView::Base.class_eval do
567
- def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
568
- true #not a real method
567
+ module ActionView::CompiledTemplates
568
+ def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
569
+ true #not a real method
570
+ end
571
+
572
+ def _f34556de606cec51d4f6791163fab456_posts_edit_123123123
573
+ true #not a real method
574
+ end
569
575
  end
570
576
 
571
- def _f34556de606cec51d4f6791163fab456_posts_edit_123123123
572
- true #not a real method
577
+ expect(ActionView::CompiledTemplates.instance_methods.size).to eq(instance_methods_count + 2)
578
+ @override.send(:expire_compiled_template)
579
+ expect(ActionView::CompiledTemplates.instance_methods.size).to eq(instance_methods_count + 1)
580
+
581
+ else
582
+ instance_methods_count = ActionDispatch::DebugView.instance_methods.size
583
+
584
+ class ActionDispatch::DebugView
585
+ def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
586
+ true #not a real method
587
+ end
588
+
589
+ def _f34556de606cec51d4f6791163fab456_posts_edit_123123123
590
+ true #not a real method
591
+ end
573
592
  end
574
- end
575
593
 
576
- expect(ActionView::Base.instance_methods.size).to eq(instance_methods_count + 2)
577
- @override.send(:expire_compiled_template)
578
- expect(ActionView::Base.instance_methods.size).to eq(instance_methods_count + 1)
594
+ expect(ActionDispatch::DebugView.instance_methods.size).to eq(instance_methods_count + 2)
595
+ @override.send(:expire_compiled_template)
596
+ expect(ActionDispatch::DebugView.instance_methods.size).to eq(instance_methods_count + 1)
597
+ end
579
598
  end
580
599
 
581
600
  it "should not remove compiled method when virtual path and digest matach" do
582
- instance_methods_count = ActionView::Base.instance_methods.size
601
+ if Deface.before_rails_6?
602
+ instance_methods_count = ActionView::CompiledTemplates.instance_methods.size
583
603
 
584
- ActionView::Base.class_eval do
585
- def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
586
- true #not a real method
604
+ module ActionView::CompiledTemplates
605
+ def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
606
+ true #not a real method
607
+ end
587
608
  end
588
- end
589
609
 
590
- expect(Deface::Override).to receive(:digest).and_return('e235fa404c3c2281d4f6791162b1c638')
610
+ expect(Deface::Override).to receive(:digest).and_return('e235fa404c3c2281d4f6791162b1c638')
591
611
 
592
- expect(ActionView::Base.instance_methods.size).to eq(instance_methods_count + 1)
593
- @override.send(:expire_compiled_template)
594
- expect(ActionView::Base.instance_methods.size).to eq(instance_methods_count + 1)
612
+ expect(ActionView::CompiledTemplates.instance_methods.size).to eq(instance_methods_count + 1)
613
+ @override.send(:expire_compiled_template)
614
+ expect(ActionView::CompiledTemplates.instance_methods.size).to eq(instance_methods_count + 1)
615
+
616
+ else
617
+ instance_methods_count = ActionDispatch::DebugView.instance_methods.size
618
+
619
+ class ActionDispatch::DebugView
620
+ def _e235fa404c3c2281d4f6791162b1c638_posts_index_123123123
621
+ true #not a real method
622
+ end
623
+ end
624
+
625
+ expect(Deface::Override).to receive(:digest).and_return('e235fa404c3c2281d4f6791162b1c638')
626
+
627
+ expect(ActionDispatch::DebugView.instance_methods.size).to eq(instance_methods_count + 1)
628
+ @override.send(:expire_compiled_template)
629
+ expect(ActionDispatch::DebugView.instance_methods.size).to eq(instance_methods_count + 1)
630
+ end
595
631
  end
596
632
  end
597
633
 
@@ -2,13 +2,12 @@ require 'simplecov'
2
2
  SimpleCov.start 'rails'
3
3
  require 'rspec'
4
4
  require 'active_support'
5
- require 'action_view'
6
- require 'action_controller'
7
5
  require 'deface'
8
6
  require 'rails/generators'
9
7
  # have to manually require following for testing purposes
10
8
  require 'deface/action_view_extensions'
11
9
  require 'rails/version'
10
+ require 'pry'
12
11
 
13
12
  #adding fake class as it's needed by haml 4.0, don't
14
13
  #want to have to require the entire rails stack in specs.
@@ -42,6 +41,16 @@ RSpec.configure do |config|
42
41
  config.mock_framework = :rspec
43
42
  end
44
43
 
44
+ if Deface.before_rails_6?
45
+ module ActionView::CompiledTemplates
46
+ #empty module for testing purposes
47
+ end
48
+ else
49
+ class ActionDispatch::DebugView
50
+ #empty module for testing purposes
51
+ end
52
+ end
53
+
45
54
  shared_context "mock Rails" do
46
55
  before(:each) do
47
56
  rails_version = Rails::VERSION::STRING
@@ -59,9 +68,7 @@ shared_context "mock Rails" do
59
68
  allow(Rails.application.config).to receive(:deface).and_return ActiveSupport::OrderedOptions.new
60
69
  Rails.application.config.deface.enabled = true
61
70
 
62
- if Rails.version[0..2] >= '3.2'
63
- allow(Rails.application.config).to receive(:watchable_dirs).and_return({})
64
- end
71
+ allow(Rails.application.config).to receive(:watchable_dirs).and_return({})
65
72
 
66
73
  allow(Rails).to receive(:root).and_return Pathname.new('spec/dummy')
67
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian D Quinn
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2021-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.1'
33
+ version: '5.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4.1'
40
+ version: '5.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rainbow
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +170,20 @@ dependencies:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0.8'
173
+ - !ruby/object:Gem::Dependency
174
+ name: pry
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
173
187
  description: Deface is a library that allows you to customize ERB, Haml and Slim views
174
188
  in a Rails application without editing the underlying view.
175
189
  email: brian@spreecommerce.com
@@ -177,7 +191,6 @@ executables: []
177
191
  extensions: []
178
192
  extra_rdoc_files:
179
193
  - README.markdown
180
- - CHANGELOG.markdown
181
194
  files:
182
195
  - ".gitignore"
183
196
  - ".rspec"
@@ -188,13 +201,15 @@ files:
188
201
  - MIT-LICENSE
189
202
  - README.markdown
190
203
  - Rakefile
204
+ - bin/rails
205
+ - bin/rails-engine
206
+ - bin/rails-sandbox
207
+ - bin/sandbox
208
+ - bin/sandbox-setup
191
209
  - deface.gemspec
192
- - gemfiles/rails_4.2.gemfile
193
- - gemfiles/rails_5.0.gemfile
194
- - gemfiles/rails_5.1.gemfile
195
210
  - gemfiles/rails_5.2.gemfile
196
211
  - gemfiles/rails_6.0.gemfile
197
- - init.rb
212
+ - gemfiles/rails_6_1.gemfile
198
213
  - lib/deface.rb
199
214
  - lib/deface/action_view_extensions.rb
200
215
  - lib/deface/actions/action.rb
@@ -218,6 +233,7 @@ files:
218
233
  - lib/deface/dsl/context.rb
219
234
  - lib/deface/dsl/loader.rb
220
235
  - lib/deface/environment.rb
236
+ - lib/deface/errors.rb
221
237
  - lib/deface/generators
222
238
  - lib/deface/haml_converter.rb
223
239
  - lib/deface/matchers/element.rb
@@ -240,6 +256,7 @@ files:
240
256
  - lib/deface/sources/text.rb
241
257
  - lib/deface/template_helper.rb
242
258
  - lib/deface/utils/failure_finder.rb
259
+ - lib/deface/version.rb
243
260
  - lib/generators/deface/USAGE
244
261
  - lib/generators/deface/override_generator.rb
245
262
  - lib/generators/deface/templates/override.html.erb.deface
@@ -286,10 +303,14 @@ files:
286
303
  - spec/spec_helper.rb
287
304
  - tasks/precompile.rake
288
305
  - tasks/utils.rake
289
- homepage: https://github.com/spree/deface
290
- licenses: []
291
- metadata: {}
292
- post_install_message:
306
+ homepage: https://github.com/spree/deface#readme
307
+ licenses:
308
+ - MIT
309
+ metadata:
310
+ homepage_uri: https://github.com/spree/deface#readme
311
+ source_code_uri: https://github.com/spree/deface
312
+ changelog_uri: https://github.com/spree/deface/releases
313
+ post_install_message:
293
314
  rdoc_options:
294
315
  - "--charset=UTF-8"
295
316
  require_paths:
@@ -298,15 +319,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
319
  requirements:
299
320
  - - ">="
300
321
  - !ruby/object:Gem::Version
301
- version: '0'
322
+ version: 2.5.0
302
323
  required_rubygems_version: !ruby/object:Gem::Requirement
303
324
  requirements:
304
325
  - - ">="
305
326
  - !ruby/object:Gem::Version
306
327
  version: '0'
307
328
  requirements: []
308
- rubygems_version: 3.0.2
309
- signing_key:
329
+ rubygems_version: 3.2.3
330
+ signing_key:
310
331
  specification_version: 4
311
332
  summary: Deface is a library that allows you to customize ERB, Haml and Slim views
312
333
  in Rails
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.0.0"
6
-
7
- group :test do
8
- gem "test-unit"
9
- gem "pry"
10
- gem "pry-byebug"
11
- end
12
-
13
- gemspec path: "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.1.0"
6
-
7
- group :test do
8
- gem "test-unit"
9
- gem "pry"
10
- gem "pry-byebug"
11
- end
12
-
13
- gemspec path: "../"
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'deface'