diff --git a/README.md b/README.md index c13b70edb7..66000a4d06 100644 --- a/README.md +++ b/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 diff --git a/lib/generators/rspec/integration/integration_generator.rb b/lib/generators/rspec/integration/integration_generator.rb index 9554039ac8..1ed405ec1f 100644 --- a/lib/generators/rspec/integration/integration_generator.rb +++ b/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] diff --git a/lib/generators/rspec/scaffold/scaffold_generator.rb b/lib/generators/rspec/scaffold/scaffold_generator.rb index 2858bbc93c..adf1e65da1 100644 --- a/lib/generators/rspec/scaffold/scaffold_generator.rb +++ b/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] diff --git a/lib/rspec/rails/example/controller_example_group.rb b/lib/rspec/rails/example/controller_example_group.rb index 4790c0f3c7..f4d5c1b862 100644 --- a/lib/rspec/rails/example/controller_example_group.rb +++ b/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 : diff --git a/lib/rspec/rails/example/view_example_group.rb b/lib/rspec/rails/example/view_example_group.rb index 4850cd3193..514aabb1f1 100644 --- a/lib/rspec/rails/example/view_example_group.rb +++ b/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 diff --git a/lib/rspec/rails/module_inclusion.rb b/lib/rspec/rails/module_inclusion.rb index b45682b164..26171c5a24 100644 --- a/lib/rspec/rails/module_inclusion.rb +++ b/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 diff --git a/lib/rspec/rails/view_rendering.rb b/lib/rspec/rails/view_rendering.rb index 3fc05b1adb..1dc1c02440 100644 --- a/lib/rspec/rails/view_rendering.rb +++ b/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 diff --git a/yard/template/default/fulldoc/html/css/rspec.css b/yard/template/default/fulldoc/html/css/rspec.css index 09200d1d97..b2fb819aa6 100644 --- a/yard/template/default/fulldoc/html/css/rspec.css +++ b/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; +}