rspec-action_view 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -4,7 +4,7 @@ module RSpec::Core
4
4
  engine = RSpec::ActionView::ERBTemplateEngine.new
5
5
 
6
6
  if block
7
- block.arity < 1 ? engine.instance_eval(&block) : block.call(engine)
7
+ block.arity < 1 ? engine.instance_eval(&block) : block.call(engine, engine.view)
8
8
  end
9
9
  end
10
10
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-action_view}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
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"]
@@ -22,7 +22,18 @@ describe 'My View extensions!' do
22
22
  extend_view_with MyView
23
23
 
24
24
  describe '#run_template' do
25
- it "should assign Kristian to the local 'name' that is used in the erb" do
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
+ with_engine(:erb) do |e, view|
27
+ view.stubs(:host).returns 'localhost'
28
+ res = e.run_template(:locals => {:name => 'Kristian'}) {"<%= goodbye name %> host: <%= host %>"}
29
+ res.should match /Kristian/
30
+ res.should match /localhost/
31
+ end
32
+ end
33
+ end
34
+
35
+ describe '#run_template' do
36
+ it "should assign Kristian to the local 'name' that is used in the erb, using full locals hash" do
26
37
  with_engine(:erb) do |e|
27
38
  e.run_template(:locals => {:name => 'Kristian'}) {"<%= goodbye name %>"}.should match /Kristian/
28
39
  end
@@ -30,7 +41,7 @@ describe 'My View extensions!' do
30
41
  end
31
42
 
32
43
  describe '#run_template_locals' do
33
- it "should assign Kristian to the local 'name' that is used in the erb" do
44
+ it "should assign Kristian to the local 'name' that is used in the erb, using convenience hash for locals" do
34
45
  with_engine(:erb) do |e|
35
46
  e.run_template_locals :name => 'Kristian' do
36
47
  %{<%= goodbye name %>}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup