rspec-rails 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +27 -2
- data/Manifest.txt +3 -2
- data/Rakefile +5 -6
- data/TODO.txt +17 -0
- data/Upgrade.rdoc +11 -0
- data/generators/integration_spec/integration_spec_generator.rb +10 -0
- data/generators/integration_spec/templates/integration_spec.rb +4 -0
- data/generators/rspec/templates/rcov.opts +1 -1
- data/generators/rspec/templates/rspec.rake +27 -12
- data/generators/rspec/templates/spec_helper.rb +5 -1
- data/generators/rspec_controller/templates/helper_spec.rb +1 -1
- data/generators/rspec_controller/templates/view_spec.rb +1 -1
- data/generators/rspec_default_values.rb +11 -2
- data/generators/rspec_model/templates/model_spec.rb +1 -3
- data/generators/rspec_scaffold/rspec_scaffold_generator.rb +7 -3
- data/generators/rspec_scaffold/templates/controller_spec.rb +8 -8
- data/generators/rspec_scaffold/templates/edit_erb_spec.rb +2 -4
- data/generators/rspec_scaffold/templates/helper_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/index_erb_spec.rb +1 -2
- data/generators/rspec_scaffold/templates/new_erb_spec.rb +2 -4
- data/generators/rspec_scaffold/templates/routing_spec.rb +16 -16
- data/generators/rspec_scaffold/templates/show_erb_spec.rb +0 -1
- data/lib/autotest/discover.rb +5 -1
- data/lib/spec/rails.rb +0 -2
- data/lib/spec/rails/example.rb +1 -0
- data/lib/spec/rails/example/controller_example_group.rb +22 -2
- data/lib/spec/rails/example/functional_example_group.rb +22 -0
- data/lib/spec/rails/example/integration_example_group.rb +16 -0
- data/lib/spec/rails/example/render_observer.rb +15 -2
- data/lib/spec/rails/extensions/spec/matchers/have.rb +4 -4
- data/lib/spec/rails/matchers/ar_be_valid.rb +33 -31
- data/lib/spec/rails/matchers/change.rb +9 -7
- data/lib/spec/rails/matchers/render_template.rb +10 -1
- data/lib/spec/rails/spec_server.rb +3 -0
- data/lib/spec/rails/version.rb +4 -3
- data/spec/resources/controllers/controller_spec_controller.rb +5 -2
- data/spec/spec/rails/example/controller_isolation_spec.rb +7 -1
- data/spec/spec/rails/extensions/action_view_base_spec.rb +42 -16
- data/spec/spec/rails/matchers/errors_on_spec.rb +14 -2
- data/spec/spec/rails/matchers/have_text_spec.rb +0 -1
- data/spec/spec/rails/matchers/render_template_spec.rb +11 -1
- data/spec/spec/rails/spec_server_spec.rb +2 -1
- metadata +12 -11
- data/features/step_definitions/people.rb +0 -6
- data/features/support/env.rb +0 -13
data/lib/spec/rails/version.rb
CHANGED
@@ -4,9 +4,10 @@ module Spec # :nodoc:
|
|
4
4
|
unless defined? MAJOR
|
5
5
|
MAJOR = 1
|
6
6
|
MINOR = 2
|
7
|
-
TINY =
|
8
|
-
|
9
|
-
|
7
|
+
TINY = 7
|
8
|
+
PRE = nil
|
9
|
+
|
10
|
+
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
10
11
|
|
11
12
|
SUMMARY = "rspec-rails #{STRING}"
|
12
13
|
end
|
@@ -13,6 +13,9 @@ class ControllerSpecController < ActionController::Base
|
|
13
13
|
render :template => "template/that/does/not/actually/exist"
|
14
14
|
end
|
15
15
|
|
16
|
+
def some_action_with_implied_template
|
17
|
+
end
|
18
|
+
|
16
19
|
def action_with_template
|
17
20
|
render :template => "controller_spec/action_with_template"
|
18
21
|
end
|
@@ -105,11 +108,11 @@ class ControllerSpecController < ActionController::Base
|
|
105
108
|
end
|
106
109
|
|
107
110
|
def rescued_error_action
|
108
|
-
raise RescuedError
|
111
|
+
raise ControllerSpecController::RescuedError
|
109
112
|
end
|
110
113
|
|
111
114
|
def un_rescued_error_action
|
112
|
-
raise UnRescuedError
|
115
|
+
raise ControllerSpecController::UnRescuedError
|
113
116
|
end
|
114
117
|
end
|
115
118
|
|
@@ -4,12 +4,18 @@ require 'controller_spec_controller'
|
|
4
4
|
describe "a controller spec running in isolation mode", :type => :controller do
|
5
5
|
controller_name :controller_spec
|
6
6
|
|
7
|
-
it "should not care if the template doesn't exist" do
|
7
|
+
it "should not care if the specified template doesn't exist" do
|
8
8
|
get 'some_action'
|
9
9
|
response.should be_success
|
10
10
|
response.should render_template("template/that/does/not/actually/exist")
|
11
11
|
end
|
12
12
|
|
13
|
+
it "should not care if the implied template doesn't exist" do
|
14
|
+
get 'some_action_with_implied_template'
|
15
|
+
response.should be_success
|
16
|
+
response.should render_template("some_action_with_implied_template")
|
17
|
+
end
|
18
|
+
|
13
19
|
it "should not care if the template has errors" do
|
14
20
|
get 'action_with_errors_in_template'
|
15
21
|
response.should be_success
|
@@ -23,26 +23,52 @@ describe ActionView::Base, "with RSpec extensions:", :type => :view do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
[:stub!, :stub].each do |method|
|
27
|
+
describe "#{method}(:render)" do
|
28
|
+
it "should not raise when stubbing and render has been received" do
|
29
|
+
template.send(method, :render).with(:partial => "name")
|
30
|
+
template.render :partial => "name"
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
it "should not raise when stubbing and render has NOT been received" do
|
34
|
+
template.send(method, :render).with(:partial => "name")
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
it "should not raise when stubbing and render has been received with different options" do
|
38
|
+
template.send(method, :render).with(:partial => "name")
|
39
|
+
template.render :partial => "view_spec/spacer"
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
it "should not raise when stubbing and expecting and render has been received" do
|
43
|
+
template.send(method, :render).with(:partial => "name")
|
44
|
+
template.should_receive(:render).with(:partial => "name")
|
45
|
+
template.render(:partial => "name")
|
46
|
+
end
|
45
47
|
end
|
48
|
+
|
49
|
+
describe "#{method}(:helper_method)" do
|
50
|
+
it "should not raise when stubbing and helper_method has been received" do
|
51
|
+
template.send(method, :helper_method).with(:arg => "value")
|
52
|
+
template.helper_method :arg => "value"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should not raise when stubbing and helper_method has NOT been received" do
|
56
|
+
template.send(method, :helper_method).with(:arg => "value")
|
57
|
+
end
|
58
|
+
|
59
|
+
it "SHOULD raise when stubbing and helper_method has been received with different options" do
|
60
|
+
template.send(method, :helper_method).with(:arg => "value")
|
61
|
+
expect { template.helper_method :arg => "other_value" }.
|
62
|
+
to raise_error(/undefined .* `helper_method'/)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should not raise when stubbing and expecting and helper_method has been received" do
|
66
|
+
template.send(method, :helper_method).with(:arg => "value")
|
67
|
+
template.should_receive(:helper_method).with(:arg => "value")
|
68
|
+
template.helper_method(:arg => "value")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
46
72
|
end
|
47
73
|
|
48
74
|
end
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe "error_on" do
|
4
4
|
it "should provide a description including the name of what the error is on" do
|
5
|
-
have(1).error_on(:whatever).description.should == "
|
5
|
+
have(1).error_on(:whatever).description.should == "have 1 error on :whatever"
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should provide a failure message including the number actually given" do
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
describe "errors_on" do
|
16
16
|
it "should provide a description including the name of what the error is on" do
|
17
|
-
have(2).errors_on(:whatever).description.should == "
|
17
|
+
have(2).errors_on(:whatever).description.should == "have 2 errors on :whatever"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should provide a failure message including the number actually given" do
|
@@ -22,4 +22,16 @@ describe "errors_on" do
|
|
22
22
|
[1].should have(3).errors_on(:whatever)
|
23
23
|
}.should fail_with("expected 3 errors on :whatever, got 1")
|
24
24
|
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "have something other than error_on or errors_on" do
|
28
|
+
it "has a standard rspec failure message" do
|
29
|
+
lambda {
|
30
|
+
[1,2,3].should have(2).elements
|
31
|
+
}.should fail_with("expected 2 elements, got 3")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "has a standard rspec description" do
|
35
|
+
have(2).elements.description.should == "have 2 elements"
|
36
|
+
end
|
25
37
|
end
|
@@ -16,11 +16,21 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
16
16
|
should render_template('some_action')
|
17
17
|
end
|
18
18
|
|
19
|
+
it "does not match an action that is a truncated version of the actual action" do
|
20
|
+
post 'some_action'
|
21
|
+
should_not render_template('some_actio')
|
22
|
+
end
|
23
|
+
|
19
24
|
if ::Rails::VERSION::STRING >= '2.3'
|
20
|
-
it "matches an action with specified extenstions" do
|
25
|
+
it "matches an action with specified extenstions (implicit format)" do
|
21
26
|
post 'some_action'
|
22
27
|
should render_template('some_action.html.erb')
|
23
28
|
end
|
29
|
+
|
30
|
+
it "matches an action with specified extenstions (explicit format)" do
|
31
|
+
post 'some_action', :format => 'js'
|
32
|
+
should render_template('some_action.js.rjs')
|
33
|
+
end
|
24
34
|
end
|
25
35
|
|
26
36
|
it "matches an action (using a symbol)" do
|
@@ -54,8 +54,9 @@ shared_examples_for "script/spec_server file" do
|
|
54
54
|
|
55
55
|
def start_spec_server
|
56
56
|
dir = File.dirname(__FILE__)
|
57
|
+
|
57
58
|
Thread.start do
|
58
|
-
system "cd #{RAILS_ROOT}; script/spec_server"
|
59
|
+
system "cd #{RAILS_ROOT}; CACHE_CLASSES=#{(Rails::VERSION::STRING < '2.2')} script/spec_server"
|
59
60
|
end
|
60
61
|
|
61
62
|
file_content = ""
|
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
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-22 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -18,9 +18,9 @@ dependencies:
|
|
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.2.
|
23
|
+
version: 1.2.7
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
43
|
+
version: 0.3.11
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: hoe
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 2.1.0
|
54
54
|
version:
|
55
55
|
description: Behaviour Driven Development for Ruby on Rails.
|
56
56
|
email:
|
@@ -73,8 +73,8 @@ files:
|
|
73
73
|
- Rakefile
|
74
74
|
- TODO.txt
|
75
75
|
- Upgrade.rdoc
|
76
|
-
-
|
77
|
-
-
|
76
|
+
- generators/integration_spec/integration_spec_generator.rb
|
77
|
+
- generators/integration_spec/templates/integration_spec.rb
|
78
78
|
- generators/rspec/CHANGES
|
79
79
|
- generators/rspec/rspec_generator.rb
|
80
80
|
- generators/rspec/templates/previous_failures.txt
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/spec/rails/example/cookies_proxy.rb
|
113
113
|
- lib/spec/rails/example/functional_example_group.rb
|
114
114
|
- lib/spec/rails/example/helper_example_group.rb
|
115
|
+
- lib/spec/rails/example/integration_example_group.rb
|
115
116
|
- lib/spec/rails/example/model_example_group.rb
|
116
117
|
- lib/spec/rails/example/render_observer.rb
|
117
118
|
- lib/spec/rails/example/routing_example_group.rb
|
@@ -237,7 +238,7 @@ licenses: []
|
|
237
238
|
post_install_message: |
|
238
239
|
**************************************************
|
239
240
|
|
240
|
-
Thank you for installing rspec-rails-1.2.
|
241
|
+
Thank you for installing rspec-rails-1.2.7
|
241
242
|
|
242
243
|
If you are upgrading, do this in each of your rails apps
|
243
244
|
that you want to upgrade:
|
@@ -269,9 +270,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
270
|
requirements: []
|
270
271
|
|
271
272
|
rubyforge_project: rspec
|
272
|
-
rubygems_version: 1.3.
|
273
|
+
rubygems_version: 1.3.4
|
273
274
|
signing_key:
|
274
275
|
specification_version: 3
|
275
|
-
summary: rspec-rails 1.2.
|
276
|
+
summary: rspec-rails 1.2.7
|
276
277
|
test_files: []
|
277
278
|
|
data/features/support/env.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Sets up the Rails environment for Cucumber
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
|
4
|
-
require 'cucumber/rails/world'
|
5
|
-
Cucumber::Rails.use_transactional_fixtures
|
6
|
-
|
7
|
-
# require 'webrat/rails'
|
8
|
-
|
9
|
-
# Comment out the next two lines if you're not using RSpec's matchers (should / should_not) in your steps.
|
10
|
-
require 'cucumber/rails/rspec'
|
11
|
-
# require 'webrat/rspec-rails'
|
12
|
-
|
13
|
-
require File.join(File.dirname(__FILE__), "/../../spec/resources/models/person")
|