deface 0.5.3 → 0.5.4

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.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{deface}
8
- s.version = "0.5.3"
8
+ s.version = "0.5.4"
9
9
 
10
10
  s.authors = ["Brian Quinn"]
11
11
  s.description = %q{Deface is a library that allows you to customize ERB views in a Rails application without editing the underlying view.}
@@ -178,6 +178,9 @@ module Deface
178
178
 
179
179
  end
180
180
 
181
+ #prevents any caching by rails in development mode
182
+ details[:updated_at] = Time.now
183
+
181
184
  source = doc.to_s
182
185
 
183
186
  Deface::Parser.undo_erb_markup!(source)
@@ -2,116 +2,128 @@ require 'spec_helper'
2
2
 
3
3
  module ActionView
4
4
  describe Template do
5
- describe "#initialize" do
5
+ before(:all) do
6
+ Deface::Override.all.clear
7
+ end
6
8
 
7
- describe "with no overrides defined" do
8
- before(:all) do
9
- @template = ActionView::Template.new("<p>test</p>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
10
- end
9
+ describe "with no overrides defined" do
10
+ before(:all) do
11
+ @updated_at = Time.now - 600
12
+ @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})
13
+ end
11
14
 
12
- it "should initialize new template object" do
13
- @template.is_a?(ActionView::Template).should == true
14
- end
15
+ it "should initialize new template object" do
16
+ @template.is_a?(ActionView::Template).should == true
17
+ end
15
18
 
16
- it "should return unmodified source" do
17
- @template.source.should == "<p>test</p>"
18
- end
19
+ it "should return unmodified source" do
20
+ @template.source.should == "<p>test</p>"
19
21
  end
20
22
 
21
- describe "with a single remove override defined" do
22
- before(:all) do
23
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "<h1>Argh!</h1>")
24
- @template = ActionView::Template.new("<p>test</p><%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
25
- end
23
+ it "should not change updated_at" do
24
+ @template.updated_at.should == @updated_at
25
+ end
26
+ end
26
27
 
27
- it "should return modified source" do
28
- @template.source.should == "<%= raw(text) %>"
29
- end
28
+ describe "with a single remove override defined" do
29
+ before(:all) do
30
+ @updated_at = Time.now - 300
31
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "<h1>Argh!</h1>")
32
+ @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})
30
33
  end
31
34
 
32
- describe "with a single replace override defined" do
33
- before(:all) do
34
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "p", :text => "<h1>Argh!</h1>")
35
- @template = ActionView::Template.new("<p>test</p>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
36
- end
35
+ it "should return modified source" do
36
+ @template.source.should == "<%= raw(text) %>"
37
+ end
37
38
 
38
- it "should return modified source" do
39
- @template.source.should == "<h1>Argh!</h1>"
40
- end
39
+ it "should change updated_at" do
40
+ @template.updated_at.should > @updated_at
41
41
  end
42
42
 
43
- describe "with a single insert_after override defined" do
44
- before(:all) do
45
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "img.button", :text => "<% help %>")
43
+ end
44
+
45
+ describe "with a single replace override defined" do
46
+ before(:all) do
47
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "p", :text => "<h1>Argh!</h1>")
48
+ @template = ActionView::Template.new("<p>test</p>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
49
+ end
50
+
51
+ it "should return modified source" do
52
+ @template.source.should == "<h1>Argh!</h1>"
53
+ end
54
+ end
46
55
 
47
- @template = ActionView::Template.new("<div><img class=\"button\" src=\"path/to/button.png\"></div>",
48
- "/path/to/file.erb",
49
- ActionView::Template::Handlers::ERB,
50
- {:virtual_path=>"posts/index", :format=>:html})
51
- end
56
+ describe "with a single insert_after override defined" do
57
+ before(:all) do
58
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "img.button", :text => "<% help %>")
52
59
 
53
- it "should return modified source" do
54
- @template.source.gsub("\n", "").should == "<div><img class=\"button\" src=\"path/to/button.png\"><% help %></div>"
55
- end
60
+ @template = ActionView::Template.new("<div><img class=\"button\" src=\"path/to/button.png\"></div>",
61
+ "/path/to/file.erb",
62
+ ActionView::Template::Handlers::ERB,
63
+ {:virtual_path=>"posts/index", :format=>:html})
56
64
  end
57
65
 
58
- describe "with a single insert_before override defined" do
59
- before(:all) do
60
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "ul li:last", :text => "<%= help %>")
66
+ it "should return modified source" do
67
+ @template.source.gsub("\n", "").should == "<div><img class=\"button\" src=\"path/to/button.png\"><% help %></div>"
68
+ end
69
+ end
61
70
 
62
- @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
63
- "/path/to/file.erb",
64
- ActionView::Template::Handlers::ERB,
65
- {:virtual_path=>"posts/index", :format=>:html})
66
- end
71
+ describe "with a single insert_before override defined" do
72
+ before(:all) do
73
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "ul li:last", :text => "<%= help %>")
67
74
 
68
- it "should return modified source" do
69
- @template.source.gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><%= help %></ul>"
70
- end
75
+ @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
76
+ "/path/to/file.erb",
77
+ ActionView::Template::Handlers::ERB,
78
+ {:virtual_path=>"posts/index", :format=>:html})
71
79
  end
72
80
 
73
- describe "with a single insert_top override defined" do
74
- before(:all) do
75
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_top => "ul", :text => "<li>me first</li>")
81
+ it "should return modified source" do
82
+ @template.source.gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><%= help %></ul>"
83
+ end
84
+ end
76
85
 
77
- @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
78
- "/path/to/file.erb",
79
- ActionView::Template::Handlers::ERB,
80
- {:virtual_path=>"posts/index", :format=>:html})
81
- end
86
+ describe "with a single insert_top override defined" do
87
+ before(:all) do
88
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_top => "ul", :text => "<li>me first</li>")
82
89
 
83
- it "should return modified source" do
84
- @template.source.gsub("\n", "").should == "<ul><li>me first</li><li>first</li><li>second</li><li>third</li></ul>"
85
- end
90
+ @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
91
+ "/path/to/file.erb",
92
+ ActionView::Template::Handlers::ERB,
93
+ {:virtual_path=>"posts/index", :format=>:html})
86
94
  end
87
95
 
88
- describe "with a single insert_bottom override defined" do
89
- before(:all) do
90
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_bottom => "ul", :text => "<li>I'm always last</li>")
96
+ it "should return modified source" do
97
+ @template.source.gsub("\n", "").should == "<ul><li>me first</li><li>first</li><li>second</li><li>third</li></ul>"
98
+ end
99
+ end
91
100
 
92
- @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
93
- "/path/to/file.erb",
94
- ActionView::Template::Handlers::ERB,
95
- {:virtual_path=>"posts/index", :format=>:html})
96
- end
101
+ describe "with a single insert_bottom override defined" do
102
+ before(:all) do
103
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_bottom => "ul", :text => "<li>I'm always last</li>")
97
104
 
98
- it "should return modified source" do
99
- @template.source.gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><li>I'm always last</li></ul>"
100
- end
105
+ @template = ActionView::Template.new("<ul><li>first</li><li>second</li><li>third</li></ul>",
106
+ "/path/to/file.erb",
107
+ ActionView::Template::Handlers::ERB,
108
+ {:virtual_path=>"posts/index", :format=>:html})
101
109
  end
102
110
 
111
+ it "should return modified source" do
112
+ @template.source.gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><li>I'm always last</li></ul>"
113
+ end
114
+ end
103
115
 
104
- describe "with a single disabled override defined" do
105
- before(:all) do
106
- Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "<h1>Argh!</h1>", :disabled => true)
107
- @template = ActionView::Template.new("<p>test</p><%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
108
- end
109
116
 
110
- it "should return unmodified source" do
111
- @template.source.should == "<p>test</p><%= raw(text) %>"
112
- end
117
+ describe "with a single disabled override defined" do
118
+ before(:all) do
119
+ Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "<h1>Argh!</h1>", :disabled => true)
120
+ @template = ActionView::Template.new("<p>test</p><%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html})
113
121
  end
114
122
 
123
+ it "should return unmodified source" do
124
+ @template.source.should == "<p>test</p><%= raw(text) %>"
125
+ end
115
126
  end
127
+
116
128
  end
117
129
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deface
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease:
4
+ hash: 3
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 3
10
- version: 0.5.3
9
+ - 4
10
+ version: 0.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Quinn
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-13 00:00:00 Z
18
+ date: 2011-06-17 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: nokogiri
@@ -79,6 +80,7 @@ files:
79
80
  - spec/deface/template_spec.rb
80
81
  - spec/spec_helper.rb
81
82
  - tasks/deface.rake
83
+ has_rdoc: true
82
84
  homepage: http://github.com/railsdog/deface
83
85
  licenses: []
84
86
 
@@ -108,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
110
  requirements: []
109
111
 
110
112
  rubyforge_project:
111
- rubygems_version: 1.8.5
113
+ rubygems_version: 1.3.7
112
114
  signing_key:
113
115
  specification_version: 3
114
116
  summary: Deface is a library that allows you to customize ERB views in Rails