rspec-action_view 0.3.3 → 0.3.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.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/rspec-action_view/erb_template_inline.rb +1 -1
- data/lib/rspec-action_view/rspec/example_group.rb +9 -3
- data/rspec-action_view.gemspec +11 -11
- data/spec/rspec-action_view/assign_locals_spec.rb +4 -4
- data/spec/rspec-action_view/erb_tester_spec.rb +4 -4
- metadata +9 -13
data/Rakefile
CHANGED
@@ -7,10 +7,10 @@ begin
|
|
7
7
|
gem.email = "kmandrup@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/kristianmandrup/rspec-action_view"
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec", "
|
10
|
+
gem.add_development_dependency "rspec", ">= 2.0.0"
|
11
11
|
|
12
|
-
gem.add_dependency "rspec", "
|
13
|
-
gem.add_dependency "r3_plugin_toolbox", "~> 0.3.
|
12
|
+
gem.add_dependency "rspec", ">= 2.0.0"
|
13
|
+
gem.add_dependency "r3_plugin_toolbox", "~> 0.3.13"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
@@ -1,13 +1,19 @@
|
|
1
1
|
module RSpec::Core
|
2
2
|
class ExampleGroup
|
3
|
-
def
|
3
|
+
def view_engine type = :erb, &block
|
4
4
|
engine = RSpec::ActionView::ERBTemplateEngine.new
|
5
5
|
|
6
6
|
if block
|
7
7
|
block.arity < 1 ? engine.instance_eval(&block) : block.call(engine, engine.view)
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
def with_action_view type = :erb, &block
|
12
|
+
engine = RSpec::ActionView::ERBTemplateEngine.new
|
13
|
+
|
14
|
+
if block
|
15
|
+
block.arity < 1 ? engine.view.instance_eval(&block) : block.call(engine.view)
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
data/rspec-action_view.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-action_view}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-21}
|
13
13
|
s.description = %q{RSpec 2 library to make it simple to spec Rails 3 ActionView extensions}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -49,18 +49,18 @@ Gem::Specification.new do |s|
|
|
49
49
|
s.specification_version = 3
|
50
50
|
|
51
51
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_development_dependency(%q<rspec>, ["
|
53
|
-
s.add_runtime_dependency(%q<rspec>, ["
|
54
|
-
s.add_runtime_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.
|
52
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
53
|
+
s.add_runtime_dependency(%q<rspec>, [">= 2.0.0"])
|
54
|
+
s.add_runtime_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.13"])
|
55
55
|
else
|
56
|
-
s.add_dependency(%q<rspec>, ["
|
57
|
-
s.add_dependency(%q<rspec>, ["
|
58
|
-
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.
|
56
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
57
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
58
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.13"])
|
59
59
|
end
|
60
60
|
else
|
61
|
-
s.add_dependency(%q<rspec>, ["
|
62
|
-
s.add_dependency(%q<rspec>, ["
|
63
|
-
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.
|
61
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
62
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
63
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.13"])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -12,7 +12,7 @@ module MyView
|
|
12
12
|
|
13
13
|
module Tab
|
14
14
|
def tab_for(clazz, &block)
|
15
|
-
content =
|
15
|
+
content = view_output_buffer(&block)
|
16
16
|
content_tag :li, content, :class => clazz
|
17
17
|
end
|
18
18
|
end
|
@@ -23,7 +23,7 @@ describe 'My View extensions!' do
|
|
23
23
|
|
24
24
|
describe '#run_template' do
|
25
25
|
it "should assign Kristian to the local 'name' that is used in the erb and stub out a method on the view!" do
|
26
|
-
|
26
|
+
view_engine(:erb) do |e, view|
|
27
27
|
view.stubs(:host).returns 'localhost'
|
28
28
|
res = e.run_template(:locals => {:name => 'Kristian'}) {"<%= say_goodbye name %> host: <%= host %>"}
|
29
29
|
res.should match /Kristian/
|
@@ -34,7 +34,7 @@ describe 'My View extensions!' do
|
|
34
34
|
|
35
35
|
describe '#run_template' do
|
36
36
|
it "should assign Kristian to the local 'name' that is used in the erb, using full locals hash" do
|
37
|
-
|
37
|
+
view_engine(:erb) do |e|
|
38
38
|
e.run_template(:locals => {:name => 'Kristian'}) {"<%= say_goodbye name %>"}.should match /Kristian/
|
39
39
|
end
|
40
40
|
end
|
@@ -42,7 +42,7 @@ describe 'My View extensions!' do
|
|
42
42
|
|
43
43
|
describe '#run_template_locals' do
|
44
44
|
it "should assign Kristian to the local 'name' that is used in the erb, using convenience hash for locals" do
|
45
|
-
|
45
|
+
view_engine(:erb) do |e|
|
46
46
|
e.run_template_locals :name => 'Kristian' do
|
47
47
|
%{<%= say_goodbye name %>}
|
48
48
|
end.should match /Kristian/
|
@@ -43,14 +43,14 @@ describe 'Running ERB template engine with View extensions' do
|
|
43
43
|
extend_view_with MyView::Blap, 'MyView::Blip'
|
44
44
|
|
45
45
|
it "should extend with single module MyView" do
|
46
|
-
|
46
|
+
view_engine(:erb) do |e|
|
47
47
|
e.run_template {"<%= goodbye %>"}.should match /Goodbye/
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
52
|
it "should extend with module Say - hello, name" do
|
53
|
-
|
53
|
+
view_engine(:erb) do |e|
|
54
54
|
e.run_template {"hello <%= name %>"}.should match /Kristian/
|
55
55
|
|
56
56
|
e.run_template do
|
@@ -64,13 +64,13 @@ describe 'Running ERB template engine with View extensions' do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should extend with modules Blip and Blap" do
|
67
|
-
|
67
|
+
view_engine(:erb) do |e|
|
68
68
|
e.run_template {"hello <%= blip %> go <%= blap %>"}.should match /blip me/
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should extend handle nested blocks in ERB" do
|
73
|
-
|
73
|
+
view_engine(:erb) do |e|
|
74
74
|
e.run_template do
|
75
75
|
%{<%= tab_for :x do %>
|
76
76
|
<%= hello :blip do %>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 4
|
9
|
+
version: 0.3.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-21 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -23,15 +23,13 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
29
|
- 2
|
30
30
|
- 0
|
31
31
|
- 0
|
32
|
-
|
33
|
-
- 22
|
34
|
-
version: 2.0.0.beta.22
|
32
|
+
version: 2.0.0
|
35
33
|
type: :development
|
36
34
|
version_requirements: *id001
|
37
35
|
- !ruby/object:Gem::Dependency
|
@@ -40,15 +38,13 @@ dependencies:
|
|
40
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
40
|
requirements:
|
43
|
-
- -
|
41
|
+
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
43
|
segments:
|
46
44
|
- 2
|
47
45
|
- 0
|
48
46
|
- 0
|
49
|
-
|
50
|
-
- 22
|
51
|
-
version: 2.0.0.beta.22
|
47
|
+
version: 2.0.0
|
52
48
|
type: :runtime
|
53
49
|
version_requirements: *id002
|
54
50
|
- !ruby/object:Gem::Dependency
|
@@ -62,8 +58,8 @@ dependencies:
|
|
62
58
|
segments:
|
63
59
|
- 0
|
64
60
|
- 3
|
65
|
-
-
|
66
|
-
version: 0.3.
|
61
|
+
- 13
|
62
|
+
version: 0.3.13
|
67
63
|
type: :runtime
|
68
64
|
version_requirements: *id003
|
69
65
|
description: RSpec 2 library to make it simple to spec Rails 3 ActionView extensions
|