Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rdoc

  • Loading branch information...
commit 0e6b1853cd173dc1bef8601a1b0db1ecf933cb6b 1 parent c1f0eab
@dchelimsky dchelimsky authored
View
32 README.md
@@ -2,19 +2,23 @@
rspec-2 for rails-3 with lightweight extensions to each
-NOTE: Use rspec-rails-1.3.x for rails-2.
+Note: Use [rspec-rails-1.3](http://github.com/dchelimsky/rspec-rails) for rails-2.
## Install
- gem install rspec-rails
+```
+gem install rspec-rails
+```
This installs the following gems:
- rspec
- rspec-core
- rspec-expectations
- rspec-mocks
- rspec-rails
+```
+rspec
+rspec-core
+rspec-expectations
+rspec-mocks
+rspec-rails
+```
## Configure
@@ -31,7 +35,9 @@ tasks without having to type `RAILS_ENV=test`.
Now you can run:
- rails generate rspec:install
+```
+rails generate rspec:install
+```
This adds the spec directory and some skeleton files, including
the "rake spec" task.
@@ -116,9 +122,7 @@ Controller specs live in spec/controllers, and mix in
ActionController::TestCase::Behavior, which is the basis for Rails' functional
tests.
-## Examples
-
-### with fixtures
+## with fixtures
```ruby
describe WidgetsController do
@@ -133,7 +137,7 @@ describe WidgetsController do
end
```
-### with a factory
+## with a factory
```ruby
describe WidgetsController do
@@ -162,7 +166,7 @@ describe WidgetsController do
end
```
-## Matchers
+## matchers
In addition to the stock matchers from rspec-expectations, controller
specs add these matchers, which delegate to rails' assertions:
@@ -175,7 +179,7 @@ response.should redirect_to(destination)
# => delegates to assert_redirected_to(destination)
```
-## Isolation from views
+## isolation from views
RSpec's preferred approach to spec'ing controller behaviour is to isolate
the controller from its collaborators. By default, therefore, controller
View
1  lib/generators/rspec/integration/integration_generator.rb
@@ -16,6 +16,7 @@ def generate_request_spec
protected
+ # @deprecated Use `--webrat` instead.
def webrat?
RSpec.deprecate("the --webrat-matchers option", "--webrat") if options[:webrat_matchers]
options[:webrat] || options[:webrat_matchers]
View
1  lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -51,6 +51,7 @@ def generate_routing_spec
protected
+ # @deprecated Use `--webrat` instead.
def webrat?
RSpec.deprecate("--webrat-matchers", "--webrat") if options[:webrat_matchers]
options[:webrat] || options[:webrat_matchers]
View
22 lib/rspec/rails/example/controller_example_group.rb
@@ -13,7 +13,7 @@ module ControllerExampleGroup
include RSpec::Rails::Matchers::RoutingMatchers
module ClassMethods
- # @api private
+ # @private
def controller_class
described_class
end
@@ -23,6 +23,13 @@ def controller_class
# `body` in that context. Also sets up implicit routes for this
# controller, that are separate from those defined in "config/routes.rb".
#
+ # @note Due to Ruby 1.8 scoping rules in anoymous subclasses, constants
+ # defined in `ApplicationController` must be fully qualified (e.g.
+ # `ApplicationController::AccessDenied`) in the block passed to the
+ # `controller` method. Any instance methods, filters, etc, that are
+ # defined in `ApplicationController`, however, are accessible from
+ # within the block.
+ #
# @example
#
# describe ApplicationController do
@@ -43,16 +50,9 @@ def controller_class
# If you would like to spec a subclass of ApplicationController, call
# controller like so:
#
- # controller(ApplicationControllerSubclass) do
- # # ....
- # end
- #
- # NOTICE: Due to Ruby 1.8 scoping rules in anoymous subclasses, constants
- # defined in `ApplicationController` must be fully qualified (e.g.
- # ApplicationController::AccessDenied) in the block passed to the
- # `controller` method. Any instance methods, filters, etc, that are
- # defined in `ApplicationController`, however, are accessible from within
- # the block.
+ # controller(ApplicationControllerSubclass) do
+ # # ....
+ # end
def controller(base_class = nil, &body)
base_class ||= RSpec.configuration.infer_base_class_for_anonymous_controllers? ?
controller_class :
View
4 lib/rspec/rails/example/view_example_group.rb
@@ -80,13 +80,13 @@ def params
controller.params
end
- # @deprecated # use `view` instead.
+ # @deprecated Use `view` instead.
def template
RSpec.deprecate("template","view")
view
end
- # @deprecated # use `rendered` instead.
+ # @deprecated Use `rendered` instead.
def response
RSpec.deprecate("response", "rendered")
rendered
View
3  lib/rspec/rails/module_inclusion.rb
@@ -1,6 +1,7 @@
module RSpec::Rails
module ModuleInclusion
- # Deprecated as of rspec-rails-2.4
+ # @deprecated No replacement.
+ #
# Will be removed from rspec-rails-3.0
#
# This was never intended to be a public API and is no longer needed
View
2  lib/rspec/rails/view_rendering.rb
@@ -39,7 +39,7 @@ def render_views(true_or_false=true)
metadata_for_rspec_rails[:render_views] = true_or_false
end
- # @deprecated use render_views
+ # @deprecated Use `render_views` instead.
def integrate_views
RSpec.deprecate("integrate_views","render_views")
render_views
View
16 yard/template/default/fulldoc/html/css/rspec.css
@@ -1,4 +1,20 @@
+.notetag {
+ background-color: #FFE5E5;
+}
+
code {
background-color: #F0F0F0;
padding: 0 2px 0 2px;
}
+
+.deprecated code {
+ background-color: #FFA8A8;
+}
+
+.summary_desc code {
+ background-color: #F0F0F0;
+}
+
+.notetag code {
+ background-color: #FFA8A8;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.