dchelimsky-rspec-rails 1.1.99.8 → 1.1.99.9
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/History.txt +2 -0
- data/Rakefile +1 -1
- data/generators/rspec/rspec_generator.rb +1 -0
- data/generators/rspec/templates/script/spec +0 -1
- data/generators/rspec/templates/script/spec_server +0 -1
- data/generators/rspec_scaffold/rspec_scaffold_generator.rb +7 -7
- data/lib/spec/rails/example/controller_example_group.rb +0 -6
- data/lib/spec/rails/example/routing_helpers.rb +18 -7
- data/lib/spec/rails/example.rb +1 -0
- data/lib/spec/rails/extensions/action_controller/test_case.rb +2 -0
- data/lib/spec/rails/extensions/active_support/test_case.rb +2 -2
- data/lib/spec/rails/version.rb +1 -1
- data/rspec-rails.gemspec +6 -6
- data/spec/spec/rails/example/controller_example_group_spec.rb +2 -43
- metadata +5 -5
- data/spec/spec/rails/example/shared_behaviour_spec.rb +0 -16
data/History.txt
CHANGED
@@ -35,6 +35,7 @@ IMPORTANT: This release includes the following backwards-compatibility-breaking
|
|
35
35
|
* rspec_scaffold generator generates layout and stylesheet (per Rails-2.3)
|
36
36
|
* add bypass_rescue for controller specs
|
37
37
|
* infer template path from the first arg passed to describe in view specs
|
38
|
+
* separate routing specs (in spec/routing)
|
38
39
|
|
39
40
|
* bug fixes
|
40
41
|
|
@@ -47,6 +48,7 @@ IMPORTANT: This release includes the following backwards-compatibility-breaking
|
|
47
48
|
* rake spec:server:start doesn't choke if there is no tmp directory
|
48
49
|
* force cache_classes = false when running with spec_server. Closes #287.
|
49
50
|
* keep spec_server working against edge rails (Jonathan Tron). Closes #685.
|
51
|
+
* create lib/tasks if not present when running script/generate rspec. Closes #687.
|
50
52
|
|
51
53
|
=== Version 1.1.12 / 2009-01-11
|
52
54
|
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
|
|
20
20
|
p.description = "Behaviour Driven Development for Ruby on Rails."
|
21
21
|
p.rubyforge_name = 'rspec'
|
22
22
|
p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
|
23
|
-
p.extra_deps = [["rspec","1.1.99.
|
23
|
+
p.extra_deps = [["dchelimsky-rspec","1.1.99.9"],["rack",">=0.4.0"]]
|
24
24
|
p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
|
25
25
|
p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
|
26
26
|
end
|
@@ -14,6 +14,7 @@ class RspecGenerator < Rails::Generator::Base
|
|
14
14
|
record do |m|
|
15
15
|
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
16
16
|
|
17
|
+
m.directory 'lib/tasks'
|
17
18
|
m.file 'rspec.rake', 'lib/tasks/rspec.rake'
|
18
19
|
|
19
20
|
m.file 'script/autospec', 'script/autospec', script_options
|
@@ -30,7 +30,6 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
|
|
30
30
|
@controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
|
31
31
|
end
|
32
32
|
|
33
|
-
@resource_generator = "scaffold"
|
34
33
|
@default_file_extension = "html.erb"
|
35
34
|
end
|
36
35
|
|
@@ -50,34 +49,35 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
|
|
50
49
|
m.directory(File.join('public/stylesheets', class_path))
|
51
50
|
|
52
51
|
m.directory(File.join('spec/controllers', controller_class_path))
|
52
|
+
m.directory(File.join('spec/routing', controller_class_path))
|
53
53
|
m.directory(File.join('spec/models', class_path))
|
54
54
|
m.directory(File.join('spec/helpers', class_path))
|
55
55
|
m.directory File.join('spec/fixtures', class_path)
|
56
56
|
m.directory File.join('spec/views', controller_class_path, controller_file_name)
|
57
57
|
|
58
58
|
# Layout and stylesheet.
|
59
|
-
m.template("
|
60
|
-
m.template("
|
59
|
+
m.template("scaffold:layout.html.erb", File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
|
60
|
+
m.template("scaffold:style.css", 'public/stylesheets/scaffold.css')
|
61
61
|
|
62
62
|
# Controller spec, class, and helper.
|
63
63
|
m.template 'rspec_scaffold:routing_spec.rb',
|
64
|
-
File.join('spec/
|
64
|
+
File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
|
65
65
|
|
66
66
|
m.template 'rspec_scaffold:controller_spec.rb',
|
67
67
|
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
|
68
68
|
|
69
|
-
m.template "
|
69
|
+
m.template "scaffold:controller.rb",
|
70
70
|
File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
|
71
71
|
|
72
72
|
m.template 'rspec_scaffold:helper_spec.rb',
|
73
73
|
File.join('spec/helpers', class_path, "#{controller_file_name}_helper_spec.rb")
|
74
74
|
|
75
|
-
m.template "
|
75
|
+
m.template "scaffold:helper.rb",
|
76
76
|
File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb")
|
77
77
|
|
78
78
|
for action in scaffold_views
|
79
79
|
m.template(
|
80
|
-
"
|
80
|
+
"scaffold:view_#{action}.#{@default_file_extension}",
|
81
81
|
File.join('app/views', controller_class_path, controller_file_name, "#{action}.#{default_file_extension}")
|
82
82
|
)
|
83
83
|
end
|
@@ -89,8 +89,6 @@ module Spec
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
include ::Spec::Rails::Example::RoutingHelpers
|
93
|
-
|
94
92
|
before(:each) do
|
95
93
|
# Some Rails apps explicitly disable ActionMailer in environment.rb
|
96
94
|
if defined?(ActionMailer)
|
@@ -149,10 +147,6 @@ MESSAGE
|
|
149
147
|
end
|
150
148
|
|
151
149
|
private
|
152
|
-
|
153
|
-
def ensure_that_routes_are_loaded
|
154
|
-
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
|
155
|
-
end
|
156
150
|
|
157
151
|
module TemplateIsolationExtensions
|
158
152
|
def file_exists?(ignore); true; end
|
@@ -3,7 +3,19 @@ module Spec
|
|
3
3
|
module Example
|
4
4
|
module RoutingHelpers
|
5
5
|
|
6
|
+
module ParamsFromQueryString # :nodoc:
|
7
|
+
def params_from_querystring(querystring) # :nodoc:
|
8
|
+
params = {}
|
9
|
+
querystring.split('&').each do |piece|
|
10
|
+
key, value = piece.split('=')
|
11
|
+
params[key.to_sym] = value
|
12
|
+
end
|
13
|
+
params
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
class RouteFor
|
18
|
+
include ::Spec::Rails::Example::RoutingHelpers::ParamsFromQueryString
|
7
19
|
def initialize(example, options)
|
8
20
|
@example, @options = example, options
|
9
21
|
end
|
@@ -42,13 +54,12 @@ module Spec
|
|
42
54
|
querystring.blank? ? params : params.merge(params_from_querystring(querystring))
|
43
55
|
end
|
44
56
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
params
|
57
|
+
private
|
58
|
+
|
59
|
+
include ParamsFromQueryString
|
60
|
+
|
61
|
+
def ensure_that_routes_are_loaded
|
62
|
+
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
|
52
63
|
end
|
53
64
|
|
54
65
|
end
|
data/lib/spec/rails/example.rb
CHANGED
@@ -8,6 +8,7 @@ require "spec/rails/example/functional_example_group"
|
|
8
8
|
require "spec/rails/example/controller_example_group"
|
9
9
|
require "spec/rails/example/helper_example_group"
|
10
10
|
require "spec/rails/example/view_example_group"
|
11
|
+
require "spec/rails/example/routing_example_group"
|
11
12
|
require "spec/rails/example/cookies_proxy"
|
12
13
|
|
13
14
|
module Spec
|
data/lib/spec/rails/version.rb
CHANGED
data/rspec-rails.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rspec-rails}
|
5
|
-
s.version = "1.1.99.
|
5
|
+
s.version = "1.1.99.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["RSpec Development Team"]
|
9
|
-
s.date = %q{2009-02-
|
9
|
+
s.date = %q{2009-02-24}
|
10
10
|
s.description = %q{Behaviour Driven Development for Ruby on Rails.}
|
11
11
|
s.email = ["rspec-devel@rubyforge.org"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt", "generators/rspec/templates/previous_failures.txt"]
|
@@ -17,23 +17,23 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{rspec}
|
19
19
|
s.rubygems_version = %q{1.3.1}
|
20
|
-
s.summary = %q{rspec-rails 1.1.99.
|
20
|
+
s.summary = %q{rspec-rails 1.1.99.9}
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
24
|
s.specification_version = 2
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_runtime_dependency(%q<rspec>, ["= 1.1.99.
|
27
|
+
s.add_runtime_dependency(%q<dchelimsky-rspec>, ["= 1.1.99.9"])
|
28
28
|
s.add_runtime_dependency(%q<rack>, [">= 0.4.0"])
|
29
29
|
s.add_development_dependency(%q<cucumber>, [">= 0.1.13"])
|
30
30
|
s.add_development_dependency(%q<hoe>, [">= 1.8.3"])
|
31
31
|
else
|
32
|
-
s.add_dependency(%q<rspec>, ["= 1.1.99.
|
32
|
+
s.add_dependency(%q<dchelimsky-rspec>, ["= 1.1.99.9"])
|
33
33
|
s.add_dependency(%q<rack>, [">= 0.4.0"])
|
34
34
|
end
|
35
35
|
else
|
36
|
-
s.add_dependency(%q<rspec>, ["= 1.1.99.
|
36
|
+
s.add_dependency(%q<dchelimsky-rspec>, ["= 1.1.99.9"])
|
37
37
|
s.add_dependency(%q<rack>, [">= 0.4.0"])
|
38
38
|
end
|
39
39
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
2
|
require 'controller_spec_controller'
|
3
|
+
require File.join(File.dirname(__FILE__), "/shared_routing_example_group_examples.rb")
|
3
4
|
|
4
5
|
['integration', 'isolation'].each do |mode|
|
5
6
|
describe "A controller example running in #{mode} mode", :type => :controller do
|
@@ -7,6 +8,7 @@ require 'controller_spec_controller'
|
|
7
8
|
integrate_views if mode == 'integration'
|
8
9
|
|
9
10
|
accesses_configured_helper_methods
|
11
|
+
include RoutingExampleGroupSpec
|
10
12
|
|
11
13
|
describe "with an implicit subject" do
|
12
14
|
it "uses the controller" do
|
@@ -158,49 +160,6 @@ require 'controller_spec_controller'
|
|
158
160
|
|
159
161
|
end
|
160
162
|
|
161
|
-
class CustomRouteSpecController < ActionController::Base; end
|
162
|
-
class RspecOnRailsSpecsController < ActionController::Base; end
|
163
|
-
|
164
|
-
it "should support custom routes" do
|
165
|
-
route_for(:controller => "custom_route_spec", :action => "custom_route").
|
166
|
-
should == "/custom_route"
|
167
|
-
end
|
168
|
-
|
169
|
-
it "should support existing routes" do
|
170
|
-
route_for(:controller => "controller_spec", :action => "some_action").
|
171
|
-
should == "/controller_spec/some_action"
|
172
|
-
end
|
173
|
-
|
174
|
-
it "should support existing routes with additional parameters" do
|
175
|
-
route_for(:controller => "controller_spec", :action => "some_action", :param => '1').
|
176
|
-
should == "/controller_spec/some_action?param=1"
|
177
|
-
end
|
178
|
-
|
179
|
-
it "recognizes routes with methods besides :get" do
|
180
|
-
route_for(:controller => "rspec_on_rails_specs", :action => "update", :id => "37").
|
181
|
-
should == {:path => "/rspec_on_rails_specs/37", :method => :put}
|
182
|
-
end
|
183
|
-
|
184
|
-
it "should generate params for custom routes" do
|
185
|
-
params_from(:get, '/custom_route').
|
186
|
-
should == {:controller => "custom_route_spec", :action => "custom_route"}
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should generate params for existing routes" do
|
190
|
-
params_from(:get, '/controller_spec/some_action').
|
191
|
-
should == {:controller => "controller_spec", :action => "some_action"}
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should generate params for an existing route with a query parameter" do
|
195
|
-
params_from(:get, '/controller_spec/some_action?param=1').
|
196
|
-
should == {:controller => "controller_spec", :action => "some_action", :param => '1'}
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should generate params for an existing route with multiple query parameters" do
|
200
|
-
params_from(:get, '/controller_spec/some_action?param1=1¶m2=2').
|
201
|
-
should == {:controller => "controller_spec", :action => "some_action", :param1 => '1', :param2 => '2' }
|
202
|
-
end
|
203
|
-
|
204
163
|
it "should expose instance vars through the assigns hash" do
|
205
164
|
get 'action_setting_the_assigns_hash'
|
206
165
|
assigns[:indirect_assigns_key].should == :indirect_assigns_key_value
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dchelimsky-rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.99.
|
4
|
+
version: 1.1.99.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,18 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-24 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: rspec
|
16
|
+
name: dchelimsky-rspec
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.1.99.
|
23
|
+
version: 1.1.99.9
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack
|
@@ -257,6 +257,6 @@ rubyforge_project: rspec
|
|
257
257
|
rubygems_version: 1.2.0
|
258
258
|
signing_key:
|
259
259
|
specification_version: 2
|
260
|
-
summary: rspec-rails 1.1.99.
|
260
|
+
summary: rspec-rails 1.1.99.9
|
261
261
|
test_files: []
|
262
262
|
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe "A shared view example_group", :shared => true do
|
4
|
-
it "should have some tag with some text" do
|
5
|
-
response.should have_tag('div', 'This is text from a method in the ViewSpecHelper')
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "A view example_group", :type => :view do
|
10
|
-
it_should_behave_like "A shared view example_group"
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
render "view_spec/implicit_helper"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|