rspec-rails 2.0.0.beta.14.1 → 2.0.0.beta.14.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.14.1
1
+ 2.0.0.beta.14.2
@@ -16,10 +16,12 @@ Feature: do not render views
16
16
  it "renders the index template" do
17
17
  get :index
18
18
  response.should render_template("index")
19
+ response.body.should =~ /generated by RSpec/
19
20
  end
20
21
  it "renders the widgets/index template" do
21
22
  get :index
22
23
  response.should render_template("widgets/index")
24
+ response.body.should =~ /generated by RSpec/
23
25
  end
24
26
  end
25
27
  end
@@ -37,6 +39,7 @@ Feature: do not render views
37
39
  it "renders the 'new' template" do
38
40
  get :index
39
41
  response.should render_template("new")
42
+ response.body.should =~ /generated by RSpec/
40
43
  end
41
44
  end
42
45
  end
@@ -54,6 +57,7 @@ Feature: do not render views
54
57
  it "renders the 'new' template" do
55
58
  get :index
56
59
  response.should contain("foo")
60
+ response.body.should =~ /generated by RSpec/
57
61
  end
58
62
  end
59
63
  end
@@ -51,3 +51,53 @@ Feature: render views
51
51
  When I run "rspec spec"
52
52
  Then I should see "1 example, 1 failure"
53
53
  And I should see "Missing template"
54
+
55
+ Scenario: render_views on and off in diff contexts
56
+ Given a file named "spec/controllers/widgets_controller_spec.rb" with:
57
+ """
58
+ require "spec_helper.rb"
59
+
60
+ describe WidgetsController do
61
+ context "with render_views" do
62
+ render_views
63
+
64
+ describe "index" do
65
+ it "renders the actual template" do
66
+ get :index
67
+ response.body.should =~ /Listing widgets/m
68
+ end
69
+ end
70
+ end
71
+
72
+ context "without render_views" do
73
+ describe "index" do
74
+ it "renders the RSpec generated template" do
75
+ get :index
76
+ response.body.should =~ /generated by RSpec/
77
+ end
78
+ end
79
+ end
80
+
81
+ context "with render_views again" do
82
+ render_views
83
+
84
+ describe "index" do
85
+ it "renders the actual template" do
86
+ get :index
87
+ response.body.should =~ /Listing widgets/m
88
+ end
89
+ end
90
+ end
91
+
92
+ context "without render_views again" do
93
+ describe "index" do
94
+ it "renders the RSpec generated template" do
95
+ get :index
96
+ response.body.should =~ /generated by RSpec/
97
+ end
98
+ end
99
+ end
100
+ end
101
+ """
102
+ When I run "rspec spec"
103
+ Then I should see "4 examples, 0 failures"
@@ -16,30 +16,33 @@ module RSpec
16
16
  end
17
17
 
18
18
  def render_views?
19
- metadata_for_rspec_rails[:render_views]
19
+ !!metadata_for_rspec_rails[:render_views]
20
20
  end
21
21
  end
22
22
 
23
- # Delegates find_all to the submitted controller's view_paths and then
24
- # returns templates with modified source
25
- class PathSetDelegatorResolver < ::ActionView::Resolver
26
- attr_reader :path_set
23
+ # Delegates find_all to the submitted path set and then returns templates
24
+ # with modified source
25
+ class PathSetDelegatorResolver < ::ActionView::Resolver
26
+ attr_reader :path_set
27
27
 
28
- def initialize(path_set)
29
- @path_set = path_set
30
- end
28
+ def initialize(path_set)
29
+ @path_set = path_set
30
+ end
31
31
 
32
- def find_all(*args)
33
- templates = path_set.find_all(*args)
34
- templates.each do |t|
35
- t.singleton_class.class_eval do
36
- def source
37
- "Template source generated by RSpec."
38
- end
39
- end
40
- end
32
+ def find_all(*args)
33
+ path_set.find_all(*args).collect do |template|
34
+ ::ActionView::Template.new(
35
+ "Template source generated by RSpec.",
36
+ template.identifier,
37
+ template.handler,
38
+ {
39
+ :virtual_path => template.virtual_path,
40
+ :format => template.formats
41
+ }
42
+ )
41
43
  end
42
44
  end
45
+ end
43
46
 
44
47
  included do
45
48
  before do
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-rails}
8
- s.version = "2.0.0.beta.14.1"
8
+ s.version = "2.0.0.beta.14.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Chelimsky", "Chad Humphries"]
12
- s.date = %q{2010-06-27}
12
+ s.date = %q{2010-06-28}
13
13
  s.description = %q{RSpec-2 for Rails-3}
14
14
  s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -119,7 +119,7 @@ Gem::Specification.new do |s|
119
119
  s.homepage = %q{http://github.com/rspec/rspec-rails}
120
120
  s.post_install_message = %q{**************************************************
121
121
 
122
- Thank you for installing rspec-rails-2.0.0.beta.14.1!
122
+ Thank you for installing rspec-rails-2.0.0.beta.14.2!
123
123
 
124
124
  This version of rspec-rails only works with
125
125
  versions of rails >= 3.0.0.pre.
@@ -138,7 +138,7 @@ Gem::Specification.new do |s|
138
138
  s.require_paths = ["lib"]
139
139
  s.rubyforge_project = %q{rspec}
140
140
  s.rubygems_version = %q{1.3.7}
141
- s.summary = %q{rspec-rails-2.0.0.beta.14.1}
141
+ s.summary = %q{rspec-rails-2.0.0.beta.14.2}
142
142
  s.test_files = [
143
143
  "spec/rspec/rails/example/controller_example_group_spec.rb",
144
144
  "spec/rspec/rails/example/helper_example_group_spec.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 124392765
4
+ hash: 124392763
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
@@ -9,8 +9,8 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 14
12
- - 1
13
- version: 2.0.0.beta.14.1
12
+ - 2
13
+ version: 2.0.0.beta.14.2
14
14
  platform: ruby
15
15
  authors:
16
16
  - David Chelimsky
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-06-27 00:00:00 -05:00
22
+ date: 2010-06-28 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -171,7 +171,7 @@ licenses: []
171
171
  post_install_message: |
172
172
  **************************************************
173
173
 
174
- Thank you for installing rspec-rails-2.0.0.beta.14.1!
174
+ Thank you for installing rspec-rails-2.0.0.beta.14.2!
175
175
 
176
176
  This version of rspec-rails only works with
177
177
  versions of rails >= 3.0.0.pre.
@@ -216,7 +216,7 @@ rubyforge_project: rspec
216
216
  rubygems_version: 1.3.7
217
217
  signing_key:
218
218
  specification_version: 3
219
- summary: rspec-rails-2.0.0.beta.14.1
219
+ summary: rspec-rails-2.0.0.beta.14.2
220
220
  test_files:
221
221
  - spec/rspec/rails/example/controller_example_group_spec.rb
222
222
  - spec/rspec/rails/example/helper_example_group_spec.rb