deface 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/deface.gemspec +1 -1
- data/lib/deface/override.rb +1 -3
- data/spec/assets/shared/_post.html.erb +1 -0
- data/spec/assets/shared/person.html.erb +1 -0
- data/spec/deface/override_spec.rb +13 -11
- data/spec/deface/template_helper_spec.rb +2 -2
- metadata +5 -6
- data/VERSION +0 -1
data/deface.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{deface}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
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.}
|
data/lib/deface/override.rb
CHANGED
@@ -71,12 +71,10 @@ module Deface
|
|
71
71
|
elsif @args.key? :text
|
72
72
|
@args[:text]
|
73
73
|
end
|
74
|
-
|
75
|
-
Deface::Parser.erb_markup!(erb)
|
76
74
|
end
|
77
75
|
|
78
76
|
def source_element
|
79
|
-
|
77
|
+
Deface::Parser.convert(source.clone)
|
80
78
|
end
|
81
79
|
|
82
80
|
def disabled?
|
@@ -39,11 +39,11 @@ module Deface
|
|
39
39
|
describe "with :text" do
|
40
40
|
|
41
41
|
before(:each) do
|
42
|
-
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<h1>Argh!</h1>")
|
42
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<h1 id=\"<%= dom_id @pirate %>\">Argh!</h1>")
|
43
43
|
end
|
44
44
|
|
45
|
-
it "should return text as source" do
|
46
|
-
@override.source.should == "<h1>Argh!</h1>"
|
45
|
+
it "should return un-convert text as source" do
|
46
|
+
@override.source.should == "<h1 id=\"<%= dom_id @pirate %>\">Argh!</h1>"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -56,8 +56,8 @@ module Deface
|
|
56
56
|
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :partial => "shared/post")
|
57
57
|
end
|
58
58
|
|
59
|
-
it "should return partial contents as source" do
|
60
|
-
@override.source.should == "<p>I'm from shared/post partial</p>\n"
|
59
|
+
it "should return un-convert partial contents as source" do
|
60
|
+
@override.source.should == "<p>I'm from shared/post partial</p>\n<%= \"And I've got ERB\" %>\n"
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -71,20 +71,22 @@ module Deface
|
|
71
71
|
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :template => "shared/person")
|
72
72
|
end
|
73
73
|
|
74
|
-
it "should return template contents as source" do
|
75
|
-
@override.source.should == "<p>I'm from shared/person template</p>\n"
|
74
|
+
it "should return un-convert template contents as source" do
|
75
|
+
@override.source.should == "<p>I'm from shared/person template</p>\n<%= \"I've got ERB too\" %>\n"
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "#source_element" do
|
81
81
|
before(:each) do
|
82
|
-
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<%= method 'x' & 'y' %>")
|
82
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<%= method :opt => 'x' & 'y' %>")
|
83
83
|
end
|
84
84
|
|
85
|
-
it "should return
|
86
|
-
@override.source_element
|
87
|
-
@override.source_element.should == "<code erb-loud> method 'x' &
|
85
|
+
it "should return escaped source" do
|
86
|
+
@override.source_element.should be_an_instance_of Nokogiri::HTML::DocumentFragment
|
87
|
+
@override.source_element.to_s.should == "<code erb-loud> method :opt => 'x' & 'y' </code>"
|
88
|
+
#do it twice to ensure it doesn't change as it's destructive
|
89
|
+
@override.source_element.to_s.should == "<code erb-loud> method :opt => 'x' & 'y' </code>"
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
@@ -11,11 +11,11 @@ module Deface
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should return source for partial" do
|
14
|
-
load_template_source("shared/_post", false).should == "<p>I'm from shared/post partial</p>\n"
|
14
|
+
load_template_source("shared/_post", false).should == "<p>I'm from shared/post partial</p>\n<%= \"And I've got ERB\" %>\n"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should return source for template" do
|
18
|
-
load_template_source("shared/person", false).should == "<p>I'm from shared/person template</p>\n"
|
18
|
+
load_template_source("shared/person", false).should == "<p>I'm from shared/person template</p>\n<%= \"I've got ERB too\" %>\n"
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should return source for namespaced template" do
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Quinn
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- MIT-LICENSE
|
64
64
|
- README.markdown
|
65
65
|
- Rakefile
|
66
|
-
- VERSION
|
67
66
|
- deface.gemspec
|
68
67
|
- init.rb
|
69
68
|
- lib/deface.rb
|
@@ -109,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
108
|
requirements: []
|
110
109
|
|
111
110
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.5.0
|
113
112
|
signing_key:
|
114
113
|
specification_version: 3
|
115
114
|
summary: Deface is a library that allows you to customize ERB views in Rails
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.0
|