rspec-action_view 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -1
- data/VERSION +1 -1
- data/lib/rspec-action_view/erb_template_inline.rb +5 -3
- data/lib/rspec-action_view/rspec/macro.rb +2 -2
- data/rspec-action_view.gemspec +11 -5
- data/spec/rspec-action_view/assign_locals_spec.rb +5 -5
- data/spec/rspec-action_view/erb_tester_spec.rb +4 -4
- metadata +41 -7
data/Rakefile
CHANGED
@@ -7,7 +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.beta.22"
|
11
|
+
|
12
|
+
gem.add_dependency "rspec", "~> 2.0.0.beta.22"
|
13
|
+
gem.add_dependency "r3_plugin_toolbox", "~> 0.3.5"
|
11
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
12
15
|
end
|
13
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -79,13 +79,15 @@ module RSpec
|
|
79
79
|
|
80
80
|
def run_template_locals locals = {}, local_assigns = {}, &block
|
81
81
|
raise ArgumentError, "Must take template as a block argument" if !block
|
82
|
-
options = {:inline => block.call}
|
83
|
-
render options
|
82
|
+
options = {:inline => block.call}.merge(:locals => locals)
|
83
|
+
render options, local_assigns
|
84
84
|
end
|
85
85
|
|
86
86
|
def run_template options = {}, local_assigns = {}, &block
|
87
|
+
|
87
88
|
raise ArgumentError, "Must take template as a block argument" if !block
|
88
|
-
|
89
|
+
options.merge!(:inline => block.call)
|
90
|
+
render options, local_assigns
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'active_support/railtie'
|
2
|
-
require '
|
2
|
+
require 'r3_plugin_toolbox'
|
3
3
|
require 'sugar-high/kind_of'
|
4
4
|
|
5
5
|
module RSpec
|
@@ -7,7 +7,7 @@ module RSpec
|
|
7
7
|
module Macro
|
8
8
|
def extend_view_with base_name, *modules
|
9
9
|
modules = modules.flatten
|
10
|
-
Rails3::
|
10
|
+
Rails3::Plugin::Extender.new do
|
11
11
|
# extend action_view with methods from some modules
|
12
12
|
extend_rails :view do |v|
|
13
13
|
if base_name.kind_of?(Module) && !modules.empty? && modules.only_kinds_of?(Symbol)
|
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.2"
|
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-09-25}
|
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,12 +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>, ["
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
53
|
+
s.add_runtime_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
54
|
+
s.add_runtime_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.5"])
|
53
55
|
else
|
54
|
-
s.add_dependency(%q<rspec>, ["
|
56
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
57
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
58
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.5"])
|
55
59
|
end
|
56
60
|
else
|
57
|
-
s.add_dependency(%q<rspec>, ["
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
62
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
63
|
+
s.add_dependency(%q<r3_plugin_toolbox>, ["~> 0.3.5"])
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module MyView
|
4
4
|
|
5
|
-
def
|
5
|
+
def say_goodbye name
|
6
6
|
"Goodbye #{name}".html_safe
|
7
7
|
end
|
8
8
|
|
@@ -25,7 +25,7 @@ describe 'My View extensions!' 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
|
with_engine(:erb) do |e, view|
|
27
27
|
view.stubs(:host).returns 'localhost'
|
28
|
-
res = e.run_template(:locals => {:name => 'Kristian'}) {"<%=
|
28
|
+
res = e.run_template(:locals => {:name => 'Kristian'}) {"<%= say_goodbye name %> host: <%= host %>"}
|
29
29
|
res.should match /Kristian/
|
30
30
|
res.should match /localhost/
|
31
31
|
end
|
@@ -35,16 +35,16 @@ describe 'My View extensions!' do
|
|
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
|
with_engine(:erb) do |e|
|
38
|
-
e.run_template(:locals => {:name => 'Kristian'}) {"<%=
|
38
|
+
e.run_template(:locals => {:name => 'Kristian'}) {"<%= say_goodbye name %>"}.should match /Kristian/
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
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
|
with_engine(:erb) do |e|
|
46
46
|
e.run_template_locals :name => 'Kristian' do
|
47
|
-
%{<%=
|
47
|
+
%{<%= say_goodbye name %>}
|
48
48
|
end.should match /Kristian/
|
49
49
|
end
|
50
50
|
end
|
@@ -37,7 +37,7 @@ module MyView
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe '
|
40
|
+
describe 'Running ERB template engine with View extensions' do
|
41
41
|
extend_view_with MyView, :tab, :say
|
42
42
|
extend_view_with MyView
|
43
43
|
extend_view_with MyView::Blap, 'MyView::Blip'
|
@@ -48,7 +48,7 @@ describe 'My View extensions!' do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
|
52
52
|
it "should extend with module Say - hello, name" do
|
53
53
|
with_engine(:erb) do |e|
|
54
54
|
e.run_template {"hello <%= name %>"}.should match /Kristian/
|
@@ -62,13 +62,13 @@ describe 'My View extensions!' do
|
|
62
62
|
end.should match /ged/
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it "should extend with modules Blip and Blap" do
|
67
67
|
with_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
|
with_engine(:erb) do |e|
|
74
74
|
e.run_template 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
|
+
- 2
|
9
|
+
version: 0.3.2
|
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-09-25 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -23,15 +23,49 @@ 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
|
-
- 1
|
30
29
|
- 2
|
31
|
-
-
|
32
|
-
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- beta
|
33
|
+
- 22
|
34
|
+
version: 2.0.0.beta.22
|
33
35
|
type: :development
|
34
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
- beta
|
50
|
+
- 22
|
51
|
+
version: 2.0.0.beta.22
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: r3_plugin_toolbox
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 3
|
65
|
+
- 5
|
66
|
+
version: 0.3.5
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
35
69
|
description: RSpec 2 library to make it simple to spec Rails 3 ActionView extensions
|
36
70
|
email: kmandrup@gmail.com
|
37
71
|
executables: []
|