rspec-rails 2.0.0.beta.11 → 2.0.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +39 -7
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/autotest/rails_rspec2.rb +2 -2
- data/lib/generators/rspec/install/install_generator.rb +4 -0
- data/lib/generators/rspec/install/templates/.rspec +1 -0
- data/lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt +1 -1
- data/lib/generators/rspec/mailer/templates/mailer_spec.rb +16 -6
- data/lib/rspec/rails/example/controller_example_group.rb +5 -2
- data/lib/rspec/rails/example/mailer_example_group.rb +5 -12
- data/lib/rspec/rails/example/request_example_group.rb +13 -11
- data/lib/rspec/rails/example/view_example_group.rb +22 -2
- data/lib/rspec/rails/matchers.rb +23 -10
- data/lib/rspec/rails/mocks.rb +4 -0
- data/lib/rspec/rails/monkey.rb +1 -0
- data/lib/rspec/rails/monkey/action_mailer/test_case.rb +69 -0
- data/lib/rspec/rails/monkey/action_view/test_case.rb +8 -6
- data/lib/rspec/rails/view_assigns.rb +1 -1
- data/rspec-rails.gemspec +10 -8
- data/spec/rspec/rails/example/view_example_group_spec.rb +35 -0
- data/spec/rspec/rails/matchers/redirect_to_spec.rb +12 -0
- data/spec/rspec/rails/matchers/render_template_spec.rb +11 -0
- data/spec/rspec/rails/mocks/mock_model_spec.rb +11 -0
- data/templates/Gemfile +1 -0
- metadata +10 -8
data/README.markdown
CHANGED
@@ -95,7 +95,7 @@ available from Rails.
|
|
95
95
|
|
96
96
|
You can use RSpec expectations/matchers or Test::Unit assertions.
|
97
97
|
|
98
|
-
##
|
98
|
+
## `render_views`
|
99
99
|
By default, controller specs do not render views (as of beta.9).
|
100
100
|
This supports specifying controllers without concern for whether
|
101
101
|
the views they render work correctly or even exist. If you prefer
|
@@ -106,17 +106,24 @@ to render the views (a la Rails' functional tests), you can use the
|
|
106
106
|
render_views
|
107
107
|
...
|
108
108
|
|
109
|
-
|
110
|
-
In addition to what Rails offers, controller specs provide all
|
111
|
-
of rspec-core's matchers and the rspec-rails' specific matchers
|
112
|
-
as well.
|
109
|
+
### * Upgrade note
|
113
110
|
|
114
|
-
|
111
|
+
`render_views` replaces `integrate_views` from rspec-rails-1.3
|
112
|
+
|
113
|
+
## `assigns`
|
114
|
+
|
115
|
+
Use `assigns(key)` to express expectations about instance variables that a controller
|
116
|
+
assigns to the view in the course of an action:
|
117
|
+
|
118
|
+
get :index
|
119
|
+
assigns(:widgets).should eq(expected_value)
|
120
|
+
|
121
|
+
## `render_template`
|
115
122
|
Delegates to Rails' assert_template:
|
116
123
|
|
117
124
|
response.should render_template("new")
|
118
125
|
|
119
|
-
|
126
|
+
## `redirect_to`
|
120
127
|
Delegates to assert_redirect
|
121
128
|
|
122
129
|
response.should redirect_to(widgets_path)
|
@@ -134,6 +141,31 @@ View specs live in spec/views, and mix in ActionView::TestCase::Behavior.
|
|
134
141
|
rendered.should contain("Chicago")
|
135
142
|
end
|
136
143
|
end
|
144
|
+
|
145
|
+
## `assign(key, val)`
|
146
|
+
|
147
|
+
Use this to assign values to instance variables in the view:
|
148
|
+
|
149
|
+
assign(:widget, stub_model(Widget))
|
150
|
+
render
|
151
|
+
|
152
|
+
The code above assigns `stub_model(Widget)` to the `@widget` variable in the view, and then
|
153
|
+
renders the view.
|
154
|
+
|
155
|
+
### * Upgrade note
|
156
|
+
|
157
|
+
`assign(key, value)` replaces `assigns[key] = value` from rspec-rails-1.3
|
158
|
+
|
159
|
+
## `rendered`
|
160
|
+
|
161
|
+
This represents the rendered view.
|
162
|
+
|
163
|
+
render
|
164
|
+
rendered.should =~ /Some text expected to appear on the page/
|
165
|
+
|
166
|
+
### * Upgrade note
|
167
|
+
|
168
|
+
`rendered` replaces `response` from rspec-rails-1.3
|
137
169
|
|
138
170
|
# Helper specs
|
139
171
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.beta.
|
1
|
+
2.0.0.beta.12
|
@@ -26,8 +26,8 @@ require 'active_support/core_ext'
|
|
26
26
|
require 'autotest/rspec2'
|
27
27
|
|
28
28
|
Autotest.add_hook :initialize do |at|
|
29
|
-
%w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins
|
30
|
-
at.add_exception(exception)
|
29
|
+
%w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins vendor/gems}.each do |exception|
|
30
|
+
at.add_exception("^#{exception}")
|
31
31
|
end
|
32
32
|
|
33
33
|
at.clear_mappings
|
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
@@ -1,13 +1,23 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe <%= class_name %> do
|
4
4
|
<% for action in actions -%>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
describe "<%= action %>" do
|
6
|
+
let(:mail) { <%= class_name %>.<%= action %> }
|
7
|
+
|
8
|
+
it "renders the headers" do
|
9
|
+
mail.subject.should eq(<%= action.to_s.humanize.inspect %>)
|
10
|
+
mail.to.should eq(["to@example.org"])
|
11
|
+
mail.from.should eq(["from@example.com"])
|
12
|
+
end
|
13
|
+
|
14
|
+
it "renders the body" do
|
15
|
+
mail.body.encoded.should match("Hi")
|
16
|
+
end
|
10
17
|
end
|
11
18
|
|
12
19
|
<% end -%>
|
20
|
+
<% if actions.blank? -%>
|
21
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
22
|
+
<% end -%>
|
13
23
|
end
|
@@ -82,8 +82,7 @@ module RSpec::Rails
|
|
82
82
|
include Webrat::Matchers
|
83
83
|
include Webrat::Methods
|
84
84
|
include RSpec::Matchers
|
85
|
-
|
86
|
-
attr_reader :controller
|
85
|
+
include RSpec::Rails::ControllerSpecMatchers
|
87
86
|
|
88
87
|
module ClassMethods
|
89
88
|
def controller_class
|
@@ -91,6 +90,10 @@ module RSpec::Rails
|
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
93
|
+
module InstanceMethods
|
94
|
+
attr_reader :controller
|
95
|
+
end
|
96
|
+
|
94
97
|
included do
|
95
98
|
before do
|
96
99
|
@routes = ::Rails.application.routes
|
@@ -4,21 +4,14 @@ module RSpec::Rails
|
|
4
4
|
module MailerExampleGroup
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
+
include ActionMailer::TestCase::Behavior
|
8
|
+
|
7
9
|
include Webrat::Matchers
|
8
10
|
include RSpec::Matchers
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
included do
|
15
|
-
before do
|
16
|
-
ActionMailer::Base.delivery_method = :test
|
17
|
-
ActionMailer::Base.perform_deliveries = true
|
18
|
-
ActionMailer::Base.deliveries.clear
|
19
|
-
@expected = Mail.new
|
20
|
-
@expected.content_type ["text", "plain", { "charset" => "utf-8" }]
|
21
|
-
@expected.mime_version = '1.0'
|
12
|
+
module ClassMethods
|
13
|
+
def mailer_class
|
14
|
+
describes
|
22
15
|
end
|
23
16
|
end
|
24
17
|
|
@@ -12,22 +12,24 @@ module RSpec::Rails
|
|
12
12
|
include Webrat::Methods
|
13
13
|
include RSpec::Matchers
|
14
14
|
|
15
|
+
module InstanceMethods
|
16
|
+
def app
|
17
|
+
::Rails.application
|
18
|
+
end
|
19
|
+
|
20
|
+
def last_response
|
21
|
+
response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
15
25
|
included do
|
16
26
|
before do
|
17
27
|
@router = ::Rails.application.routes
|
18
28
|
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def app
|
22
|
-
::Rails.application
|
23
|
-
end
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Webrat.configure do |config|
|
30
|
-
config.mode = :rack
|
30
|
+
Webrat.configure do |config|
|
31
|
+
config.mode = :rack
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
RSpec.configure do |c|
|
@@ -18,7 +18,6 @@ module RSpec::Rails
|
|
18
18
|
# rendered.should contain("Bar")
|
19
19
|
# end
|
20
20
|
# end
|
21
|
-
#
|
22
21
|
module ViewExampleGroup
|
23
22
|
extend ActiveSupport::Concern
|
24
23
|
|
@@ -34,7 +33,7 @@ module RSpec::Rails
|
|
34
33
|
rendered
|
35
34
|
end
|
36
35
|
|
37
|
-
# :
|
36
|
+
# :call-seq:
|
38
37
|
# render
|
39
38
|
# render(:template => "widgets/new.html.erb")
|
40
39
|
# render({:partial => "widgets/widget.html.erb"}, {... locals ...})
|
@@ -57,6 +56,27 @@ module RSpec::Rails
|
|
57
56
|
super(options, local_assigns, &block)
|
58
57
|
end
|
59
58
|
|
59
|
+
# The instance of ActionView::Base that is used to render the template.
|
60
|
+
# Use this before the +render+ call to stub any methods you want to stub
|
61
|
+
# on the view:
|
62
|
+
#
|
63
|
+
# describe "widgets/new.html.erb" do
|
64
|
+
# it "shows all the widgets" do
|
65
|
+
# view.stub(:foo) { "foo" }
|
66
|
+
# render
|
67
|
+
# ...
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
def view
|
71
|
+
_view
|
72
|
+
end
|
73
|
+
|
74
|
+
# Deprecated. Use +view+ instead.
|
75
|
+
def template
|
76
|
+
RSpec.deprecate("template","view")
|
77
|
+
view
|
78
|
+
end
|
79
|
+
|
60
80
|
private
|
61
81
|
|
62
82
|
def _default_file_to_render
|
data/lib/rspec/rails/matchers.rb
CHANGED
@@ -16,19 +16,32 @@ end
|
|
16
16
|
begin
|
17
17
|
require "active_record"
|
18
18
|
rescue LoadError
|
19
|
-
|
20
19
|
end
|
21
20
|
|
22
|
-
RSpec::
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
module RSpec::Rails
|
22
|
+
module ControllerSpecMatchers
|
23
|
+
extend RSpec::Matchers::DSL
|
24
|
+
|
25
|
+
matcher :redirect_to do |destination|
|
26
|
+
match_unless_raises Test::Unit::AssertionFailedError do |_|
|
27
|
+
assert_redirected_to destination
|
28
|
+
end
|
29
|
+
|
30
|
+
failure_message_for_should do
|
31
|
+
rescued_exception.message
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
matcher :render_template do |options, message|
|
36
|
+
match_unless_raises Test::Unit::AssertionFailedError do |_|
|
37
|
+
options = options.to_s if Symbol === options
|
38
|
+
assert_template options, message
|
39
|
+
end
|
27
40
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
41
|
+
failure_message_for_should do
|
42
|
+
rescued_exception.message
|
43
|
+
end
|
44
|
+
end
|
32
45
|
end
|
33
46
|
end
|
34
47
|
|
data/lib/rspec/rails/mocks.rb
CHANGED
data/lib/rspec/rails/monkey.rb
CHANGED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'action_mailer'
|
2
|
+
|
3
|
+
module ActionMailer
|
4
|
+
unless defined?(ActionMailer::TestCase::Behavior)
|
5
|
+
class TestCase < ActiveSupport::TestCase
|
6
|
+
module Behavior
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
include TestHelper
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def tests(mailer)
|
13
|
+
write_inheritable_attribute(:mailer_class, mailer)
|
14
|
+
end
|
15
|
+
|
16
|
+
def mailer_class
|
17
|
+
if mailer = read_inheritable_attribute(:mailer_class)
|
18
|
+
mailer
|
19
|
+
else
|
20
|
+
tests determine_default_mailer(name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def determine_default_mailer(name)
|
25
|
+
name.sub(/Test$/, '').constantize
|
26
|
+
rescue NameError => e
|
27
|
+
raise NonInferrableMailerError.new(name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module InstanceMethods
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def initialize_test_deliveries
|
36
|
+
ActionMailer::Base.delivery_method = :test
|
37
|
+
ActionMailer::Base.perform_deliveries = true
|
38
|
+
ActionMailer::Base.deliveries.clear
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_expected_mail
|
42
|
+
@expected = Mail.new
|
43
|
+
@expected.content_type ["text", "plain", { "charset" => charset }]
|
44
|
+
@expected.mime_version = '1.0'
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def charset
|
50
|
+
"UTF-8"
|
51
|
+
end
|
52
|
+
|
53
|
+
def encode(subject)
|
54
|
+
Mail::Encodings.q_value_encode(subject, charset)
|
55
|
+
end
|
56
|
+
|
57
|
+
def read_fixture(action)
|
58
|
+
IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
included do
|
63
|
+
setup :initialize_test_deliveries
|
64
|
+
setup :set_expected_mail
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -142,12 +142,14 @@ unless defined?(ActionView::TestCase::Behavior)
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def _view
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
145
|
+
@_view ||= begin
|
146
|
+
view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
|
147
|
+
view.singleton_class.send :include, _helpers
|
148
|
+
view.singleton_class.send :include, @controller._router.url_helpers
|
149
|
+
view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
|
150
|
+
view.output_buffer = self.output_buffer
|
151
|
+
view
|
152
|
+
end
|
151
153
|
end
|
152
154
|
|
153
155
|
EXCLUDE_IVARS = %w{
|
data/rspec-rails.gemspec
CHANGED
@@ -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.
|
8
|
+
s.version = "2.0.0.beta.12"
|
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-
|
12
|
+
s.date = %q{2010-06-14}
|
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 = [
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"lib/generators/rspec/helper/helper_generator.rb",
|
43
43
|
"lib/generators/rspec/helper/templates/helper_spec.rb",
|
44
44
|
"lib/generators/rspec/install/install_generator.rb",
|
45
|
+
"lib/generators/rspec/install/templates/.rspec",
|
45
46
|
"lib/generators/rspec/install/templates/autotest/discover.rb",
|
46
47
|
"lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt",
|
47
48
|
"lib/generators/rspec/install/templates/lib/tasks/rspec.rake",
|
@@ -81,6 +82,7 @@ Gem::Specification.new do |s|
|
|
81
82
|
"lib/rspec/rails/mocks.rb",
|
82
83
|
"lib/rspec/rails/monkey.rb",
|
83
84
|
"lib/rspec/rails/monkey/action_controller/test_case.rb",
|
85
|
+
"lib/rspec/rails/monkey/action_mailer/test_case.rb",
|
84
86
|
"lib/rspec/rails/monkey/action_view/test_case.rb",
|
85
87
|
"lib/rspec/rails/monkey/active_support/notifications/fanout.rb",
|
86
88
|
"lib/rspec/rails/null_resolver.rb",
|
@@ -111,7 +113,7 @@ Gem::Specification.new do |s|
|
|
111
113
|
s.homepage = %q{http://github.com/rspec/rspec-rails}
|
112
114
|
s.post_install_message = %q{**************************************************
|
113
115
|
|
114
|
-
Thank you for installing rspec-rails-2.0.0.beta.
|
116
|
+
Thank you for installing rspec-rails-2.0.0.beta.12!
|
115
117
|
|
116
118
|
This version of rspec-rails only works with
|
117
119
|
versions of rails >= 3.0.0.pre.
|
@@ -119,7 +121,7 @@ Gem::Specification.new do |s|
|
|
119
121
|
Be sure to run the following command in each of your
|
120
122
|
Rails apps if you're upgrading:
|
121
123
|
|
122
|
-
script/rails generate rspec
|
124
|
+
script/rails generate rspec:install
|
123
125
|
|
124
126
|
**************************************************
|
125
127
|
}
|
@@ -127,7 +129,7 @@ Gem::Specification.new do |s|
|
|
127
129
|
s.require_paths = ["lib"]
|
128
130
|
s.rubyforge_project = %q{rspec}
|
129
131
|
s.rubygems_version = %q{1.3.6}
|
130
|
-
s.summary = %q{rspec-rails-2.0.0.beta.
|
132
|
+
s.summary = %q{rspec-rails-2.0.0.beta.12}
|
131
133
|
s.test_files = [
|
132
134
|
"spec/rspec/rails/example/controller_example_group_spec.rb",
|
133
135
|
"spec/rspec/rails/example/helper_example_group_spec.rb",
|
@@ -151,14 +153,14 @@ Gem::Specification.new do |s|
|
|
151
153
|
s.specification_version = 3
|
152
154
|
|
153
155
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
154
|
-
s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.
|
156
|
+
s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.12"])
|
155
157
|
s.add_runtime_dependency(%q<webrat>, [">= 0.7.0"])
|
156
158
|
else
|
157
|
-
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.
|
159
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.12"])
|
158
160
|
s.add_dependency(%q<webrat>, [">= 0.7.0"])
|
159
161
|
end
|
160
162
|
else
|
161
|
-
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.
|
163
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.12"])
|
162
164
|
s.add_dependency(%q<webrat>, [">= 0.7.0"])
|
163
165
|
end
|
164
166
|
end
|
@@ -73,5 +73,40 @@ module RSpec::Rails
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
describe "#view" do
|
78
|
+
let(:view_spec) do
|
79
|
+
Class.new do
|
80
|
+
include ViewExampleGroup::InstanceMethods
|
81
|
+
end.new
|
82
|
+
end
|
83
|
+
|
84
|
+
it "delegates to _view" do
|
85
|
+
view = double("view")
|
86
|
+
view_spec.stub(:_view) { view }
|
87
|
+
view_spec.view.should == view
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#template" do
|
92
|
+
let(:view_spec) do
|
93
|
+
Class.new do
|
94
|
+
include ViewExampleGroup::InstanceMethods
|
95
|
+
def _view; end
|
96
|
+
end.new
|
97
|
+
end
|
98
|
+
|
99
|
+
before { RSpec.stub(:deprecate) }
|
100
|
+
|
101
|
+
it "is deprecated" do
|
102
|
+
RSpec.should_receive(:deprecate)
|
103
|
+
view_spec.template
|
104
|
+
end
|
105
|
+
|
106
|
+
it "delegates to #view" do
|
107
|
+
view_spec.should_receive(:view)
|
108
|
+
view_spec.template
|
109
|
+
end
|
110
|
+
end
|
76
111
|
end
|
77
112
|
end
|
@@ -1,8 +1,20 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "action_controller/test_case"
|
2
3
|
|
3
4
|
describe "redirect_to" do
|
5
|
+
include RSpec::Rails::ControllerSpecMatchers
|
6
|
+
|
4
7
|
it "delegates to assert_redirected_to" do
|
5
8
|
self.should_receive(:assert_redirected_to).with("destination")
|
6
9
|
"response".should redirect_to("destination")
|
7
10
|
end
|
11
|
+
|
12
|
+
it "uses failure message from assert_redirected_to" do
|
13
|
+
self.stub!(:assert_redirected_to).and_raise(
|
14
|
+
Test::Unit::AssertionFailedError.new("this message"))
|
15
|
+
response = ActionController::TestResponse.new
|
16
|
+
expect do
|
17
|
+
response.should redirect_to("destination")
|
18
|
+
end.to raise_error("this message")
|
19
|
+
end
|
8
20
|
end
|
@@ -1,6 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "render_template" do
|
4
|
+
include RSpec::Rails::ControllerSpecMatchers
|
5
|
+
|
6
|
+
it "uses failure message from render_template" do
|
7
|
+
self.stub!(:assert_template).and_raise(
|
8
|
+
Test::Unit::AssertionFailedError.new("this message"))
|
9
|
+
response = ActionController::TestResponse.new
|
10
|
+
expect do
|
11
|
+
response.should render_template("destination")
|
12
|
+
end.to raise_error("this message")
|
13
|
+
end
|
14
|
+
|
4
15
|
context "given a hash" do
|
5
16
|
it "delegates to assert_template" do
|
6
17
|
self.should_receive(:assert_template).with({:this => "hash"}, "this message")
|
@@ -74,6 +74,17 @@ describe "mock_model(RealModel)" do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
describe "#model_name" do
|
78
|
+
before(:each) do
|
79
|
+
@model = mock_model(SubMockableModel)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "says its model_name" do
|
83
|
+
@model.model_name.should == "SubMockableModel"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
77
88
|
describe "#destroyed?" do
|
78
89
|
context "default" do
|
79
90
|
it "returns false" do
|
data/templates/Gemfile
CHANGED
metadata
CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
|
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- beta
|
10
|
-
-
|
11
|
-
version: 2.0.0.beta.
|
10
|
+
- 12
|
11
|
+
version: 2.0.0.beta.12
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- David Chelimsky
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-06-
|
20
|
+
date: 2010-06-14 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -32,8 +32,8 @@ dependencies:
|
|
32
32
|
- 0
|
33
33
|
- 0
|
34
34
|
- beta
|
35
|
-
-
|
36
|
-
version: 2.0.0.beta.
|
35
|
+
- 12
|
36
|
+
version: 2.0.0.beta.12
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id001
|
39
39
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/generators/rspec/helper/helper_generator.rb
|
86
86
|
- lib/generators/rspec/helper/templates/helper_spec.rb
|
87
87
|
- lib/generators/rspec/install/install_generator.rb
|
88
|
+
- lib/generators/rspec/install/templates/.rspec
|
88
89
|
- lib/generators/rspec/install/templates/autotest/discover.rb
|
89
90
|
- lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt
|
90
91
|
- lib/generators/rspec/install/templates/lib/tasks/rspec.rake
|
@@ -124,6 +125,7 @@ files:
|
|
124
125
|
- lib/rspec/rails/mocks.rb
|
125
126
|
- lib/rspec/rails/monkey.rb
|
126
127
|
- lib/rspec/rails/monkey/action_controller/test_case.rb
|
128
|
+
- lib/rspec/rails/monkey/action_mailer/test_case.rb
|
127
129
|
- lib/rspec/rails/monkey/action_view/test_case.rb
|
128
130
|
- lib/rspec/rails/monkey/active_support/notifications/fanout.rb
|
129
131
|
- lib/rspec/rails/null_resolver.rb
|
@@ -157,7 +159,7 @@ licenses: []
|
|
157
159
|
post_install_message: |
|
158
160
|
**************************************************
|
159
161
|
|
160
|
-
Thank you for installing rspec-rails-2.0.0.beta.
|
162
|
+
Thank you for installing rspec-rails-2.0.0.beta.12!
|
161
163
|
|
162
164
|
This version of rspec-rails only works with
|
163
165
|
versions of rails >= 3.0.0.pre.
|
@@ -165,7 +167,7 @@ post_install_message: |
|
|
165
167
|
Be sure to run the following command in each of your
|
166
168
|
Rails apps if you're upgrading:
|
167
169
|
|
168
|
-
script/rails generate rspec
|
170
|
+
script/rails generate rspec:install
|
169
171
|
|
170
172
|
**************************************************
|
171
173
|
|
@@ -195,7 +197,7 @@ rubyforge_project: rspec
|
|
195
197
|
rubygems_version: 1.3.6
|
196
198
|
signing_key:
|
197
199
|
specification_version: 3
|
198
|
-
summary: rspec-rails-2.0.0.beta.
|
200
|
+
summary: rspec-rails-2.0.0.beta.12
|
199
201
|
test_files:
|
200
202
|
- spec/rspec/rails/example/controller_example_group_spec.rb
|
201
203
|
- spec/rspec/rails/example/helper_example_group_spec.rb
|