From 3b279c63397975ef95219ecdb53b497ebc8dc9f0 Mon Sep 17 00:00:00 2001 From: David Chelimsky Date: Thu, 27 Jan 2011 04:19:25 -0600 Subject: [PATCH] move some docs around --- History.md | 124 +----------------------------------------- Upgrade.md | 64 +--------------------- features/.nav | 5 +- features/Changelog.md | 123 +++++++++++++++++++++++++++++++++++++++++ features/Upgrade.md | 44 +++++++++++++++ 5 files changed, 172 insertions(+), 188 deletions(-) create mode 100644 features/Changelog.md diff --git a/History.md b/History.md index 01c1c6ac3b..a300db23ff 100644 --- a/History.md +++ b/History.md @@ -1,123 +1 @@ -## rspec-rails-2 release history - -### 2.4.2 / in dev - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.1...master) - -* Bug fixes - * fixed bug in which `render_views` in a nested group set the value in its - parent group. - * only include MailerExampleGroup when it is defiend (Steve Sloan) - -### 2.4.1 / 2011-01-03 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...v2.4.1) - -* Bug fixes - * fixed bug caused by including some Rails modules before RSpec's - RailsExampleGroup - -### 2.4.0 / 2011-01-02 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...v2.4.0) - -* Enhancements - * include ApplicationHelper in helper object in helper specs - * include request spec extensions in files in spec/integration - * include controller spec extensions in groups that use :type => :controller - * same for :model, :view, :helper, :mailer, :request, :routing - -* Bug fixes - * restore global config.render_views so you only need to say it once - * support overriding render_views in nested groups - * matchers that delegate to Rails' assertions capture - ActiveSupport::TestCase::Assertion (so they work properly now with - should_not in Ruby 1.8.7 and 1.9.1) - -* Deprecations - * include_self_when_dir_matches - -### 2.3.1 / 2010-12-16 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1) - -* Bug fixes - * respond_to? correctly handles 2 args - * scaffold generator no longer fails on autotest directory - -### 2.3.0 / 2010-12-12 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0) - -* Changes - * Generator no longer generates autotest/autodiscover.rb, as it is no longer - needed (as of rspec-core-2.3.0) - -### 2.2.1 / 2010-12-01 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1) - -* Bug fixes - * Depend on railties, activesupport, and actionpack instead of rails (Piotr - Solnica) - * Got webrat integration working properly across different types of specs - -* Deprecations - * --webrat-matchers flag for generators is deprecated. use --webrat instead. - -### 2.2.0 / 2010-11-28 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...v2.2.0) - -* Enhancements - * Added stub_template in view specs - -* Bug fixes - * Properly include helpers in views (Jonathan del Strother) - * Fix bug in which method missing led to a stack overflow - * Fix stack overflow in request specs with open_session - * Fix stack overflow in any spec when method_missing was invoked - * Add gem dependency on rails ~> 3.0.0 (ensures bundler won't install - rspec-rails-2 with rails-2 apps). - -### 2.1.0 / 2010-11-07 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0) - -* Enhancements - * Move errors_on to ActiveModel to support other AM-compliant ORMs - -* Bug fixes - * Check for presence of ActiveRecord instead of checking Rails config - (gets rspec out of the way of multiple ORMs in the same app) - -### 2.0.1 / 2010-10-15 - -[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1) - -* Enhancements - * Add option to not generate request spec (--skip-request-specs) - -* Bug fixes - * Updated the mock_[model] method generated in controller specs so it adds - any stubs submitted each time it is called. - * Fixed bug where view assigns weren't making it to the view in view specs in Rails-3.0.1. - (Emanuele Vicentini) - -### 2.0.0 / 2010-10-10 - -[full changelog](https://github.com/rspec/rspec-rails/compare/ea6bdef...v2.0.0) - -* Enhancements - * ControllerExampleGroup uses controller as the implicit subject by default (Paul Rosania) - * autotest mapping improvements (Andreas Neuhaus) - * more cucumber features (Justin Ko) - * clean up spec helper (Andre Arko) - * add assign(name, value) to helper specs (Justin Ko) - * stub_model supports primary keys other than id (Justin Ko) - * support choice between Webrat/Capybara (Justin Ko) - * support specs for 'abstract' subclasses of ActionController::Base (Mike Gehard) - * be_a_new matcher supports args (Justin Ko) - -* Bug fixes - * support T::U components in mailer and request specs (Brasten Sager) +See features/Changelog.md diff --git a/Upgrade.md b/Upgrade.md index 685a0ab1e1..118e32f56b 100644 --- a/Upgrade.md +++ b/Upgrade.md @@ -1,63 +1 @@ -# rspec-rails-2.3.0 - -## autotest integration - -Add a .rspec file to the project's root directory (if not already there) to -tell RSpec to tell Autotest to use RSpec's specialized Autotest class. - -NOTE that rspec-core-2.0, 2.1, and 2.2 required an autotest/discover.rb file in -the project's root directory. This worked with some, but not all versions of -autotest and/or the autotest command that ships with ZenTest. This new approach -will work regardless of which version of autotest/ZenTest you are using. - -## Webrat and Capybara - -Earlier 2.0.0.beta versions depended on Webrat. As of -rspec-rails-2.0.0.beta.20, this dependency and offers you a choice of using -webrat or capybara. Just add the library of your choice to your Gemfile. - -## Controller specs - -### islation from view templates - -By default, controller specs do _not_ render view templates. This keeps -controller specs isolated from the content of views and their requirements. - -NOTE that the template must exist, but it will not be rendered. This is -different from rspec-rails-1.x, in which the template didn't need to exist, but -ActionController makes a number of new decisions in Rails 3 based on the -existence of the template. To keep the RSpec code free of monkey patches, and -to keep the rspec user experience simpler, we decided that this would be a fair -trade-off. - -## View specs - -### view.should render_template - -Rails changed the way it renders partials, so to set an expectation that a -partial gets rendered, you need - - render - view.should render_template(:partial => "widget/_row") - -### stub_template - -Introduced in rspec-rails-2.2, simulates the presence of view templates on the -file system. This supports isolation from partials rendered by the vew template -that is the subject of a view example: - - stub_template "widgets/_widget.html.erb" => "This Content" - -### as_new_record - -Earlier versions of the view generators generated stub_model with `:new_record? -=> true`. That is no longer recognized in rspec-rails-2, so you need to change -this: - - stub_model(Widget, :new_record? => true) - -to this: - - stub_model(Widget).as_new_record - -Generators in 2.0.0 final release will do the latter. +See features/Upgrade.md diff --git a/features/.nav b/features/.nav index ed5e5fcf71..c9d432627f 100644 --- a/features/.nav +++ b/features/.nav @@ -1,8 +1,9 @@ - GettingStarted.md (Start from scratch) -- Upgrade.md (Upgrade from 1.x) - Generators.md (Generators) -- Autotest.md (Autotest integration) - transactional_examples.feature +- Autotest.md (Autotest integration) +- Changelog.md +- Upgrade.md - model_specs: - errors_on.feature - controller_specs: diff --git a/features/Changelog.md b/features/Changelog.md new file mode 100644 index 0000000000..2afe4221d2 --- /dev/null +++ b/features/Changelog.md @@ -0,0 +1,123 @@ +## rspec-rails-2 release history + +### in dev + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.1...master) + +* Bug fixes + * fixed bug in which `render_views` in a nested group set the value in its + parent group. + * only include MailerExampleGroup when it is defiend (Steve Sloan) + +### 2.4.1 / 2011-01-03 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...v2.4.1) + +* Bug fixes + * fixed bug caused by including some Rails modules before RSpec's + RailsExampleGroup + +### 2.4.0 / 2011-01-02 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...v2.4.0) + +* Enhancements + * include ApplicationHelper in helper object in helper specs + * include request spec extensions in files in spec/integration + * include controller spec extensions in groups that use :type => :controller + * same for :model, :view, :helper, :mailer, :request, :routing + +* Bug fixes + * restore global config.render_views so you only need to say it once + * support overriding render_views in nested groups + * matchers that delegate to Rails' assertions capture + ActiveSupport::TestCase::Assertion (so they work properly now with + should_not in Ruby 1.8.7 and 1.9.1) + +* Deprecations + * include_self_when_dir_matches + +### 2.3.1 / 2010-12-16 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1) + +* Bug fixes + * respond_to? correctly handles 2 args + * scaffold generator no longer fails on autotest directory + +### 2.3.0 / 2010-12-12 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0) + +* Changes + * Generator no longer generates autotest/autodiscover.rb, as it is no longer + needed (as of rspec-core-2.3.0) + +### 2.2.1 / 2010-12-01 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1) + +* Bug fixes + * Depend on railties, activesupport, and actionpack instead of rails (Piotr + Solnica) + * Got webrat integration working properly across different types of specs + +* Deprecations + * --webrat-matchers flag for generators is deprecated. use --webrat instead. + +### 2.2.0 / 2010-11-28 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...v2.2.0) + +* Enhancements + * Added stub_template in view specs + +* Bug fixes + * Properly include helpers in views (Jonathan del Strother) + * Fix bug in which method missing led to a stack overflow + * Fix stack overflow in request specs with open_session + * Fix stack overflow in any spec when method_missing was invoked + * Add gem dependency on rails ~> 3.0.0 (ensures bundler won't install + rspec-rails-2 with rails-2 apps). + +### 2.1.0 / 2010-11-07 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0) + +* Enhancements + * Move errors_on to ActiveModel to support other AM-compliant ORMs + +* Bug fixes + * Check for presence of ActiveRecord instead of checking Rails config + (gets rspec out of the way of multiple ORMs in the same app) + +### 2.0.1 / 2010-10-15 + +[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1) + +* Enhancements + * Add option to not generate request spec (--skip-request-specs) + +* Bug fixes + * Updated the mock_[model] method generated in controller specs so it adds + any stubs submitted each time it is called. + * Fixed bug where view assigns weren't making it to the view in view specs in Rails-3.0.1. + (Emanuele Vicentini) + +### 2.0.0 / 2010-10-10 + +[full changelog](https://github.com/rspec/rspec-rails/compare/ea6bdef...v2.0.0) + +* Enhancements + * ControllerExampleGroup uses controller as the implicit subject by default (Paul Rosania) + * autotest mapping improvements (Andreas Neuhaus) + * more cucumber features (Justin Ko) + * clean up spec helper (Andre Arko) + * add assign(name, value) to helper specs (Justin Ko) + * stub_model supports primary keys other than id (Justin Ko) + * support choice between Webrat/Capybara (Justin Ko) + * support specs for 'abstract' subclasses of ActionController::Base (Mike Gehard) + * be_a_new matcher supports args (Justin Ko) + +* Bug fixes + * support T::U components in mailer and request specs (Brasten Sager) diff --git a/features/Upgrade.md b/features/Upgrade.md index af8b1af79a..f026b56550 100644 --- a/features/Upgrade.md +++ b/features/Upgrade.md @@ -36,6 +36,18 @@ is what you need to change: ## Controller specs +### islation from view templates + +By default, controller specs do _not_ render view templates. This keeps +controller specs isolated from the content of views and their requirements. + +NOTE that the template must exist, but it will not be rendered. This is +different from rspec-rails-1.x, in which the template didn't need to exist, but +ActionController makes a number of new decisions in Rails 3 based on the +existence of the template. To keep the RSpec code free of monkey patches, and +to keep the rspec user experience simpler, we decided that this would be a fair +trade-off. + ### `response.should render_template` This needs to move from before the action to after. For example: @@ -57,6 +69,22 @@ action. ## View specs +### `view.should render_template` + +Rails changed the way it renders partials, so to set an expectation that a +partial gets rendered, you need + + render + view.should render_template(:partial => "widget/_row") + +### stub_template + +Introduced in rspec-rails-2.2, simulates the presence of view templates on the +file system. This supports isolation from partials rendered by the vew template +that is the subject of a view example: + + stub_template "widgets/_widget.html.erb" => "This Content" + ### No more `have_tag` Before Webrat came along, rspec-rails had its own `have_tag` matcher that @@ -70,3 +98,19 @@ are already available in controller specs with `render_views`). Given the brittleness of RSpec's `have_tag` matcher and the presence of new Webrat and Capybara matchers that do a better job, `have_tag` was not included in rspec-rails-2. + +## Mocks, stubs, doubles + +### as_new_record + +Earlier versions of the view generators generated stub_model with `:new_record? +=> true`. That is no longer recognized in rspec-rails-2, so you need to change +this: + + stub_model(Widget, :new_record? => true) + +to this: + + stub_model(Widget).as_new_record + +Generators in 2.0.0 final release will do the latter.