aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec-rails
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins/rspec-rails')
-rw-r--r--vendor/plugins/rspec-rails/.document7
-rw-r--r--vendor/plugins/rspec-rails/Contribute.rdoc4
-rw-r--r--vendor/plugins/rspec-rails/History.rdoc283
-rw-r--r--vendor/plugins/rspec-rails/License.txt33
-rw-r--r--vendor/plugins/rspec-rails/Manifest.txt165
-rw-r--r--vendor/plugins/rspec-rails/README.rdoc45
-rw-r--r--vendor/plugins/rspec-rails/Rakefile72
-rw-r--r--vendor/plugins/rspec-rails/TODO.txt17
-rw-r--r--vendor/plugins/rspec-rails/Upgrade.rdoc148
-rw-r--r--vendor/plugins/rspec-rails/generators/integration_spec/integration_spec_generator.rb10
-rw-r--r--vendor/plugins/rspec-rails/generators/integration_spec/templates/integration_spec.rb4
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/CHANGES1
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb53
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt0
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts2
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake144
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec6
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/script/spec10
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts4
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb54
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_controller/USAGE33
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb47
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb25
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb11
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb12
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_default_values.rb28
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_model/USAGE18
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb35
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb13
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb154
-rwxr-xr-xvendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb131
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb25
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb11
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb27
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb25
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb33
-rw-r--r--vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb22
-rw-r--r--vendor/plugins/rspec-rails/init.rb9
-rw-r--r--vendor/plugins/rspec-rails/lib/autotest/discover.rb5
-rw-r--r--vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb76
-rw-r--r--vendor/plugins/rspec-rails/lib/spec/rails.rb26
-rw-r--r--vendor/plugins/rspec-rails/spec/autotest/mappings_spec.rb86
-rw-r--r--vendor/plugins/rspec-rails/spec/rails_suite.rb7
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/action_view_base_spec_controller.rb2
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/application.rb9
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb127
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/example.txt1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/redirect_spec_controller.rb70
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/render_spec_controller.rb34
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/controllers/rjs_spec_controller.rb58
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/helpers/addition_helper.rb5
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/helpers/explicit_helper.rb46
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/helpers/more_explicit_helper.rb5
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/helpers/plugin_application_helper.rb6
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/helpers/view_spec_helper.rb13
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/models/animal.rb4
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/models/person.rb18
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/models/thing.rb3
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/_partial.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_template.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/layouts/application.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/layouts/simple.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/objects/_object.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/render_spec/_a_partial.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/_replacement_partial.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_div.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_page_element.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/insert_html.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_effect.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/tag_spec/no_tags.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial.html.erb2
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.html.erb0
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_local_variable.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/_spacer.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/accessor.html.erb5
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/block_helper.html.erb3
-rwxr-xr-xvendor/plugins/rspec-rails/spec/resources/views/view_spec/entry_form.html.erb2
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/explicit_helper.html.erb2
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/foo/show.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/implicit_helper.html.erb2
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/multiple_helpers.html.erb3
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/path_params.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/should_not_receive.html.erb3
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial.html.erb5
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb3
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_with_array.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/resources/views/view_spec/view_helpers.html.erb1
-rw-r--r--vendor/plugins/rspec-rails/spec/spec_helper.rb78
-rw-r--r--vendor/plugins/rspec-rails/tasks/rspec.rake144
104 files changed, 2599 insertions, 0 deletions
diff --git a/vendor/plugins/rspec-rails/.document b/vendor/plugins/rspec-rails/.document
new file mode 100644
index 000000000..1c7800d57
--- /dev/null
+++ b/vendor/plugins/rspec-rails/.document
@@ -0,0 +1,7 @@
+lib/**/*.rb
+History.rdoc
+License.txt
+README.rdoc
+Upgrade.rdoc
+features/**/*.feature
+
diff --git a/vendor/plugins/rspec-rails/Contribute.rdoc b/vendor/plugins/rspec-rails/Contribute.rdoc
new file mode 100644
index 000000000..0c10d49c6
--- /dev/null
+++ b/vendor/plugins/rspec-rails/Contribute.rdoc
@@ -0,0 +1,4 @@
+== Contribute
+
+If you're interested in contributing to rspec-rails, please see
+http://wiki.github.com/dchelimsky/rspec-dev for information.
diff --git a/vendor/plugins/rspec-rails/History.rdoc b/vendor/plugins/rspec-rails/History.rdoc
new file mode 100644
index 000000000..4cddf6847
--- /dev/null
+++ b/vendor/plugins/rspec-rails/History.rdoc
@@ -0,0 +1,283 @@
+=== Version 1.2.9 / 2009-10-05
+
+* enhancements
+ * added route_to and be_routable matchers (Randy Harmon). Closes #843.
+ * Provide better failure message for render_template when redirected (Josh
+ Nichols). Closes #885.
+ * generated specs require 'spec_helper'
+
+* bug fixes
+ * pass the correct args to super in controller#render depending on the rails
+ version (Lucas Carlson). Closes #865.
+ * use Rack::Utils.parse_query to convert query strings to hashes. Closes #872.
+ * errors correctly bubble up when a controller spec in isolation mode
+ requests a non-existent action/template
+ * no error if either action or template exist
+ * error if neither exist
+ * Closes #888.
+
+* removals
+ * spec_server has been removed in favor of spork.
+ * You can still use the --drb flag, but you've got to install the spork
+ gem.
+ * Windows users who cannot use the spork gem can install the spec_server
+ from http://github.com/dchelimsky/spec_server
+
+=== Version 1.2.7 / 2009-06-22
+
+* enhancements
+ * alias :stub!, :stub so rspec-rails extensions of rspec stubs can use the
+ same syntax as rspec (core)
+ * integration specs (Ben Mabey and David Chelimsky)
+ * added support for references and belongs_to generated model specs (José
+ Valim). Closes #792.
+ * add discovery for autotest-rails to keep compatible with ZenTest-4.0.0
+ (Ryan Davis). Closes #838.
+ * controller specs in isolation mode don't care whether the file exists
+ anymore!
+
+* bug fixes
+ * allow rspec-rails to work without ActiveRecord. Closes #810.
+ * fix bug with have() matcher failure message (Dave Giunta). Closes #818.
+ * fix bug where render_template('new') would pass if 'newer' was rendered
+ (or anything that started with 'new')
+
+* deprecations
+ * spec_server is now deprecated - use spork instead (gem install spork).
+ Closes #827.
+
+=== Version 1.2.6 / 2009-04-30
+
+* bug fixes
+ * restored rake tasks for rspec[-rails] as plugins
+
+=== Version 1.2.5 / 2009-04-29
+
+* enhancements
+ * support :xml and :strict config options for have_tag matcher (patch from
+ Peer Allan and Max Murphy). Closes #783.
+
+* bug fixes
+ * Fixed a small typo that makes rake stats fail (José Valim). Closes #802.
+ * link_to and friends are available to ViewExampleGroup again
+ (J.B. Rainsberger). Closes #787.
+ * spec_server works correctly with rails 2.3 again (Neil Buckley). Closes
+ #759.
+
+=== Version 1.2.4 / 2009-03-13
+
+No changes in this release, but aligns with the rspec-1.2.4 release. Someday
+soon, this binding of rspec/rspec-rails versions needs to end!
+
+=== Version 1.2.3 / 2009-03-13
+
+No changes in this release, but aligns with the rspec-1.2.3 release.
+
+=== Version 1.2.2 / 2009-03-22
+
+No changes in this release, but aligns with the rspec-1.2.2 release.
+
+=== Version 1.2.1 / 2009-03-22
+
+This is a bug-fix release, recommended for anybody who has already upgraded to
+rspec-rails-1.2.0 or is upgrading to rails-2.3.2
+
+See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.1
+
+* enhancements
+
+ * more cleanup of internals (reducing dependency on rspec-core)
+ * don't require config/environments more than once
+ * autotest includes spec/routing directory (Matt Peterson). Closes #739.
+ * display helpful messages when installing rspec-rails running
+ script/generate rspec
+ * thanks for Dr Nic for the pointers
+ * restored require 'rubygems' where needed
+ * export NO_RUBYGEMS=true if you don't use rubygems
+
+* bug fixes
+
+ * fix scoping issues in rspec-rails' own suite for ruby 1.9.1 (Matthias
+ Hennemeyer). Closes #717.
+ * rake stats no longer hides test directories. Closes #748.
+ * fixed regression that was introduced in 1.2 in which controller_name
+ failed to override the controller class passed to describe() (patches from
+ Aaron Gibralter and Zach Dennis). Closes #732.
+
+=== Version 1.2.0 / 2009-03-15
+
+IMPORTANT: See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.0
+
+IMPORTANT: This release includes the following backwards-compatibility-breaking changes.
+
+* rspec-rails supports rails 2.0.2, 2.1.2, 2.2.2 and 2.3.2
+
+ * We are no longer supporting 1.x versions of rails.
+
+* expect_render and stub_render have been removed.
+
+ * Both of these methods were deprecated in rspec-rails-1.1.5, released in Sept, 2008.
+
+* { route_for(args).should == "/path" } now delegates to assert_generates (in rails)
+
+ * see Upgrade.txt for more information
+
+* deprecations
+
+ * controller.use_rails_error_handling! is deprecated
+ * use rescue_action_in_public! (from rails) instead
+
+* enhancements
+
+ * Adding status codes to redirect_to matcher (Damian Janowski). Closes #570.
+ * Initialize current URL before executing any examples in a ViewExampleGroup (Wilson Bilkovich). Closes #654.
+ * Support query strings in params_from (Wilson Bilkovich). Closes #652.
+ * delegate route_for to assert_recognizes (less brittle)
+ * it { should be_valid } (Kakutani). Closes #665.
+ * controller is implicit subject in controller specs (Joe Ferris). #686.
+ * template is implicit subject in view specs (Joe Ferris). #686.
+ * redirect_to and render_template matchers can accept controller or response (Joe Ferris). Closes #686.
+ * generated specs use declarative docstrings
+ * rspec_scaffold generator generates layout and stylesheet (per Rails-2.3)
+ * add bypass_rescue for controller specs
+ * infer template path from the first arg passed to describe in view specs
+ * separate routing specs (in spec/routing)
+
+* bug fixes
+
+ * you no longer *have* to load ActionMailer to get specs to run. Closes #650.
+ * query_params are now parsed by Rack::Utils.parse_query in redirect_to matcher. Closes #684.
+ * cleaned up spec_server (there was a bunch of pre-rails 2.0 material). Closes #685.
+ * rspec's rake tasks are not loaded when running "rake gems" or any of its subtasks
+ * only warn when rspec is not installed when trying to invoke an rspec rake task
+ * support 2 arg version of ActionController::Base#render (reported by Nathan Wilmes)
+ * rake spec:server:start doesn't choke if there is no tmp directory
+ * force cache_classes = false when running with spec_server. Closes #287.
+ * keep spec_server working against edge rails (Jonathan Tron). Closes #685.
+ * create lib/tasks if not present when running script/generate rspec. Closes #687.
+ * fixed regression (and added spec so it won't regress again) where
+ render => :inline didn't render unless integrate_views was set
+ * fixed nil.with_output_buffer bug in helper specs. Closes #719.
+
+=== Version 1.1.12 / 2009-01-11
+
+* 2 deprecations
+
+ * TestResponse#[] is deprecated if you're using Rails <= 2.2.x and removed if you're using Rails 2.3
+ * add_stubs(model, {:method => value}) is deprecated. Use model.stub!(:method => value) instead.
+
+* 2 major enhancements
+
+ * support controller and action path params in view specs (Mike Vincent).
+ * use ActiveSupport::TestCase when available, else Test::Unit::TestCase - supports Rails 1.2.6 (Brandon Keepers). Closes #620.
+ * support form tag helpers in helpers (Ivo Dancet). Closes #641.
+
+* 3 minor enhancements
+
+ * improve rdoc for render_template (Patch from Andrew Premdas). Fixes #571.
+ * use more liberal globs to allow for specs in symlinked dirs (Martin Luder). Closes #361.
+ * Enable loading fixtures from arbitrary locations (Jacek Becela). Closes #464.
+
+* 7 bug fixes
+
+ * Attempt to load application_controller before falling back to application (Geoff Garside). Closes #626.
+ * Include _id and reduce quoting of default values in view specs (Steen Lehmann). Closes #598.
+ * Record calls to render and check rendered[:template] and rendered[:partial] for edge rails (> v2.2.2). Closes #633.
+ * config.gem 'rspec' can't be unpacked. Closes #629.
+ * spec_server not working with Rails 2.2.2 (Andreas Wolff). Closes #631.
+ * redirect_to doesn't work with http method constrained urls (Maxim Kulkin). Closes #648.
+ * rescue_with declarations are no longer by-passed (Brandon Keepers). #85
+
+=== Version 1.1.11 / 2008-10-24
+
+* No changes to rspec-rails - release to align with bug-fix release in rspec ... again :(
+
+=== Version 1.1.10 / 2008-10-24
+
+* No changes to rspec-rails - release to align with bug-fix release in rspec
+
+=== Version 1.1.9 / 2008-10-20
+
+* 4 bug fixes
+
+ * require 'rubygems' in script/spec
+ * fix failure message for error_on and errors_on (Patch from Mike Vincent). Fixes #566.
+ * fix issues that arise in view spec if passing actual template name to render (Patch from Mike Vincent). Fixes #551.
+ * fixed bug accessing assigns from helper examples
+
+=== Version 1.1.8 / 2008-10-03
+
+* 2 bug fixes
+
+ * correctly handle assigns that are false. Fixes #552.
+ * ensure that NotYetImplemented examples report as pending (fixed in rspec, not rspec-rails). Fixes #553.
+
+=== Version 1.1.7 / 2008-10-02
+
+* 1 bug fix
+
+ * depend on the correct version of rspec
+
+=== Version 1.1.6 / 2008-10-02
+
+* 1 bug fix
+
+ * fixed regression where values assigned to the assigns hash were not accessible from the example (#549)
+
+=== Version 1.1.5 / 2008-09-28
+
+IMPORTANT: use 'script/autospec' (or just 'autospec' if you have the rspec gem
+installed) instead of 'autotest'. We changed the way autotest discovers rspec
+so the autotest executable won't automatically load rspec anymore. This allows
+rspec to live side by side other spec frameworks without always co-opting
+autotest through autotest's discovery mechanism.
+
+ALSO IMPORTANT: Rails v2.1.1 changed assert_select_rjs such that it doesn't
+always fail when it should. Please see
+http://rails.lighthouseapp.com/projects/8994/tickets/982.
+
+* Generated route specs have shorter names, making it less painful to modify their implementation
+* Add conditional so Rails 2.1.0 doesn't warn about cache_template_extensions (patch from James Herdman)
+* Fixed stub_model examples to work with Rails 2.1.0 (the code was fine, just the examples needed patching)
+* use hoe for build/release
+* reworked generated examples for rspec_scaffold - thanks to Mikel Lindsaar and Dan Manges for their feedback
+* bye, bye translator
+* Added proxy to cookies so you can set them in examples the same way you set them in controllers
+* Added script/autospec so you can run autospec without installing the gem
+* Support --skip-fixture in the rspec_model generator (patches from Alex Tomlins and Niels Ganser)
+* Add mock_model#as_new_record (patch from Zach Dennis)
+* mock(:null_object=>true) plays nice with HTML (patch from Gerrit Kaiser)
+* Suppress a deprecation notice in Rails 2.1 (James Herdman)
+* quiet deprecation warning on inflector (RSL)
+* rspec-rails gem (Ben Mabey)
+* updated generated code examples
+* Make rspec_model generator honour --skip-fixtures tag (Niels Ganser, Alex Tomlins)
+* Fix to create new models with attributes in command line (Nicolas)
+* fix to_param in mock_model with stubbed id incorrectly returning autogenerated id (Adam Meehan)
+* Call Rail's TestCase setup/teardown callbacks (Jonathan del Strother)
+* Only run TestUnitTesting once (Jonathan del Strother)
+* use require_dependency instead of require (Brandon Keepers)
+* Fixed a problem caused by controller action names getting out of sync between rspec-dev and rspec-rails for speccing (Matt Patterson)
+* don't mutate hash passed to mock_model (Reg Vos)
+
+=== Version 1.1.4
+
+Maintenance release.
+
+* Moved mock_model and stub_model to their own module: Spec::Rails::Mocks
+* Setting mock_model object id with stubs hash - patch from Adam Meehan
+* Added as_new_record to stub_model e.g. stub_model(Foo).as_new_record
+* Improved stub_model such that new_record? does "the right thing"
+* Patch from Pat Maddox to get integrate_views to work in nested example groups.
+* Patch from Pat Maddox to get controller_name to work in nested example groups.
+* Patch from Corey Haines to add include_text matcher
+* Added stub_model method which creates a real model instance with :id stubbed and data access prohibited.
+* Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320.
+* Added #helper and #assigns to helper specs.
+* Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162.
+* Tweaked list of exceptions (ignores) for autotest
+* Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862)
+* Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281.
+* Allow any type of render in view specs. Closes #57.
+* Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
+* Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
diff --git a/vendor/plugins/rspec-rails/License.txt b/vendor/plugins/rspec-rails/License.txt
new file mode 100644
index 000000000..791a0eee6
--- /dev/null
+++ b/vendor/plugins/rspec-rails/License.txt
@@ -0,0 +1,33 @@
+(The MIT License)
+
+====================================================================
+==== RSpec, RSpec-Rails
+Copyright (c) 2005-2009 The RSpec Development Team
+====================================================================
+==== ARTS
+Copyright (c) 2006 Kevin Clark, Jake Howerton
+====================================================================
+==== ZenTest
+Copyright (c) 2001-2006 Ryan Davis, Eric Hodel, Zen Spider Software
+====================================================================
+==== AssertSelect
+Copyright (c) 2006 Assaf Arkin
+====================================================================
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/plugins/rspec-rails/Manifest.txt b/vendor/plugins/rspec-rails/Manifest.txt
new file mode 100644
index 000000000..f5f07c172
--- /dev/null
+++ b/vendor/plugins/rspec-rails/Manifest.txt
@@ -0,0 +1,165 @@
+.document
+Contribute.rdoc
+History.rdoc
+License.txt
+Manifest.txt
+README.rdoc
+Rakefile
+TODO.txt
+Upgrade.rdoc
+generators/integration_spec/integration_spec_generator.rb
+generators/integration_spec/templates/integration_spec.rb
+generators/rspec/CHANGES
+generators/rspec/rspec_generator.rb
+generators/rspec/templates/previous_failures.txt
+generators/rspec/templates/rcov.opts
+generators/rspec/templates/rspec.rake
+generators/rspec/templates/script/autospec
+generators/rspec/templates/script/spec
+generators/rspec/templates/spec.opts
+generators/rspec/templates/spec_helper.rb
+generators/rspec_controller/USAGE
+generators/rspec_controller/rspec_controller_generator.rb
+generators/rspec_controller/templates/controller_spec.rb
+generators/rspec_controller/templates/helper_spec.rb
+generators/rspec_controller/templates/view_spec.rb
+generators/rspec_default_values.rb
+generators/rspec_model/USAGE
+generators/rspec_model/rspec_model_generator.rb
+generators/rspec_model/templates/model_spec.rb
+generators/rspec_scaffold/rspec_scaffold_generator.rb
+generators/rspec_scaffold/templates/controller_spec.rb
+generators/rspec_scaffold/templates/edit_erb_spec.rb
+generators/rspec_scaffold/templates/helper_spec.rb
+generators/rspec_scaffold/templates/index_erb_spec.rb
+generators/rspec_scaffold/templates/new_erb_spec.rb
+generators/rspec_scaffold/templates/routing_spec.rb
+generators/rspec_scaffold/templates/show_erb_spec.rb
+init.rb
+lib/autotest/discover.rb
+lib/autotest/rails_rspec.rb
+lib/spec/rails.rb
+lib/spec/rails/example.rb
+lib/spec/rails/example/assigns_hash_proxy.rb
+lib/spec/rails/example/controller_example_group.rb
+lib/spec/rails/example/cookies_proxy.rb
+lib/spec/rails/example/functional_example_group.rb
+lib/spec/rails/example/helper_example_group.rb
+lib/spec/rails/example/integration_example_group.rb
+lib/spec/rails/example/model_example_group.rb
+lib/spec/rails/example/render_observer.rb
+lib/spec/rails/example/routing_example_group.rb
+lib/spec/rails/example/routing_helpers.rb
+lib/spec/rails/example/view_example_group.rb
+lib/spec/rails/extensions.rb
+lib/spec/rails/extensions/action_controller/rescue.rb
+lib/spec/rails/extensions/action_controller/test_case.rb
+lib/spec/rails/extensions/action_controller/test_response.rb
+lib/spec/rails/extensions/action_view/base.rb
+lib/spec/rails/extensions/active_record/base.rb
+lib/spec/rails/extensions/active_support/test_case.rb
+lib/spec/rails/extensions/spec/matchers/have.rb
+lib/spec/rails/extensions/spec/runner/configuration.rb
+lib/spec/rails/interop/testcase.rb
+lib/spec/rails/matchers.rb
+lib/spec/rails/matchers/ar_be_valid.rb
+lib/spec/rails/matchers/assert_select.rb
+lib/spec/rails/matchers/change.rb
+lib/spec/rails/matchers/have_text.rb
+lib/spec/rails/matchers/include_text.rb
+lib/spec/rails/matchers/redirect_to.rb
+lib/spec/rails/matchers/render_template.rb
+lib/spec/rails/matchers/route_to.rb
+lib/spec/rails/mocks.rb
+lib/spec/rails/version.rb
+spec/autotest/mappings_spec.rb
+spec/rails_suite.rb
+spec/resources/controllers/action_view_base_spec_controller.rb
+spec/resources/controllers/application.rb
+spec/resources/controllers/controller_spec_controller.rb
+spec/resources/controllers/example.txt
+spec/resources/controllers/redirect_spec_controller.rb
+spec/resources/controllers/render_spec_controller.rb
+spec/resources/controllers/rjs_spec_controller.rb
+spec/resources/helpers/addition_helper.rb
+spec/resources/helpers/explicit_helper.rb
+spec/resources/helpers/more_explicit_helper.rb
+spec/resources/helpers/plugin_application_helper.rb
+spec/resources/helpers/view_spec_helper.rb
+spec/resources/models/animal.rb
+spec/resources/models/person.rb
+spec/resources/models/thing.rb
+spec/resources/views/controller_spec/_partial.html.erb
+spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb
+spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb
+spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb
+spec/resources/views/controller_spec/action_with_errors_in_template.html.erb
+spec/resources/views/controller_spec/action_with_template.html.erb
+spec/resources/views/layouts/application.html.erb
+spec/resources/views/layouts/simple.html.erb
+spec/resources/views/objects/_object.html.erb
+spec/resources/views/render_spec/_a_partial.html.erb
+spec/resources/views/render_spec/action_with_alternate_layout.html.erb
+spec/resources/views/render_spec/some_action.html.erb
+spec/resources/views/render_spec/some_action.js.rjs
+spec/resources/views/rjs_spec/_replacement_partial.html.erb
+spec/resources/views/rjs_spec/hide_div.js.rjs
+spec/resources/views/rjs_spec/hide_page_element.js.rjs
+spec/resources/views/rjs_spec/insert_html.js.rjs
+spec/resources/views/rjs_spec/replace.js.rjs
+spec/resources/views/rjs_spec/replace_html.js.rjs
+spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs
+spec/resources/views/rjs_spec/visual_effect.js.rjs
+spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs
+spec/resources/views/tag_spec/no_tags.html.erb
+spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb
+spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb
+spec/resources/views/view_spec/_partial.html.erb
+spec/resources/views/view_spec/_partial_used_twice.html.erb
+spec/resources/views/view_spec/_partial_with_local_variable.html.erb
+spec/resources/views/view_spec/_partial_with_sub_partial.html.erb
+spec/resources/views/view_spec/_spacer.html.erb
+spec/resources/views/view_spec/accessor.html.erb
+spec/resources/views/view_spec/block_helper.html.erb
+spec/resources/views/view_spec/entry_form.html.erb
+spec/resources/views/view_spec/explicit_helper.html.erb
+spec/resources/views/view_spec/foo/show.html.erb
+spec/resources/views/view_spec/implicit_helper.html.erb
+spec/resources/views/view_spec/multiple_helpers.html.erb
+spec/resources/views/view_spec/path_params.html.erb
+spec/resources/views/view_spec/should_not_receive.html.erb
+spec/resources/views/view_spec/template_with_partial.html.erb
+spec/resources/views/view_spec/template_with_partial_using_collection.html.erb
+spec/resources/views/view_spec/template_with_partial_with_array.html.erb
+spec/resources/views/view_spec/view_helpers.html.erb
+spec/spec/rails/example/assigns_hash_proxy_spec.rb
+spec/spec/rails/example/configuration_spec.rb
+spec/spec/rails/example/controller_example_group_spec.rb
+spec/spec/rails/example/controller_isolation_spec.rb
+spec/spec/rails/example/cookies_proxy_spec.rb
+spec/spec/rails/example/error_handling_spec.rb
+spec/spec/rails/example/example_group_factory_spec.rb
+spec/spec/rails/example/helper_example_group_spec.rb
+spec/spec/rails/example/model_example_group_spec.rb
+spec/spec/rails/example/routing_example_group_spec.rb
+spec/spec/rails/example/shared_routing_example_group_examples.rb
+spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb
+spec/spec/rails/example/view_example_group_spec.rb
+spec/spec/rails/extensions/action_view_base_spec.rb
+spec/spec/rails/extensions/active_record_spec.rb
+spec/spec/rails/interop/testcase_spec.rb
+spec/spec/rails/matchers/ar_be_valid_spec.rb
+spec/spec/rails/matchers/assert_select_spec.rb
+spec/spec/rails/matchers/errors_on_spec.rb
+spec/spec/rails/matchers/have_text_spec.rb
+spec/spec/rails/matchers/include_text_spec.rb
+spec/spec/rails/matchers/redirect_to_spec.rb
+spec/spec/rails/matchers/render_template_spec.rb
+spec/spec/rails/matchers/should_change_spec.rb
+spec/spec/rails/mocks/ar_classes.rb
+spec/spec/rails/mocks/mock_model_spec.rb
+spec/spec/rails/mocks/stub_model_spec.rb
+spec/spec/rails/sample_modified_fixture.rb
+spec/spec/rails/sample_spec.rb
+spec/spec/rails/spec_spec.rb
+spec/spec_helper.rb
diff --git a/vendor/plugins/rspec-rails/README.rdoc b/vendor/plugins/rspec-rails/README.rdoc
new file mode 100644
index 000000000..b74fc0881
--- /dev/null
+++ b/vendor/plugins/rspec-rails/README.rdoc
@@ -0,0 +1,45 @@
+= Spec::Rails
+
+* http://rspec.info
+* http://rubyforge.org/projects/rspec
+* http://github.com/dchelimsky/rspec-rails
+* http://wiki.github.com/dchelimsky/rspec/rails
+* mailto:rspec-devel@rubyforge.org
+
+== DESCRIPTION:
+
+Behaviour Driven Development for Ruby on Rails.
+
+rspec-rails is an RSpec extension that allows you to drive the development of
+Ruby on Rails applications with RSpec.
+
+== FEATURES:
+
+* Use RSpec to independently specify Rails Models, Views, Controllers and Helpers
+* Integrated fixture loading
+* Special generators for Resources, Models, Views and Controllers that generate RSpec code examples.
+
+== VISION:
+
+For people for whom TDD is a brand new concept, the testing support built into
+Ruby on Rails is a huge leap forward. The fact that it is built right in is
+fantastic, and Ruby on Rails apps are generally much easier to maintain than
+they might have been without such support.
+
+For those of us coming from a history with TDD, and now BDD, the existing
+support presents some problems related to dependencies across examples. To
+that end, RSpec on Rails supports 4 types of examples. We’ve also built in
+first class mocking and stubbing support in order to break dependencies across
+these different concerns.
+
+== MORE INFORMATION:
+
+See Spec::Rails::Example for information about the different kinds of example
+groups you can use to spec the different Rails components
+
+See Spec::Rails::Matchers for information about Rails-specific
+expectations you can set on responses and models, etc.
+
+== INSTALL
+
+* Visit http://wiki.github.com/dchelimsky/rspec/rails for installation instructions.
diff --git a/vendor/plugins/rspec-rails/Rakefile b/vendor/plugins/rspec-rails/Rakefile
new file mode 100644
index 000000000..f5ba456cd
--- /dev/null
+++ b/vendor/plugins/rspec-rails/Rakefile
@@ -0,0 +1,72 @@
+# -*- ruby -*-
+gem 'hoe', '>=2.0.0'
+require 'hoe'
+
+$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"..","rspec","lib")))
+$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"lib")))
+
+require 'spec/rails/version'
+require 'spec/rake/spectask'
+require 'cucumber/rake/task'
+
+Hoe.spec 'rspec-rails' do
+ self.version = Spec::Rails::VERSION::STRING
+ self.summary = Spec::Rails::VERSION::SUMMARY
+ self.description = "Behaviour Driven Development for Ruby on Rails."
+ self.rubyforge_name = 'rspec'
+ self.developer 'RSpec Development Team', 'rspec-devel@rubyforge.org'
+ self.extra_deps = [["rspec",">=1.2.9"],["rack",">=1.0.0"]]
+ self.extra_dev_deps = [["cucumber",">= 0.3.99"]]
+ self.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
+ self.history_file = 'History.rdoc'
+ self.readme_file = 'README.rdoc'
+ self.post_install_message = <<-POST_INSTALL_MESSAGE
+#{'*'*50}
+
+ Thank you for installing rspec-rails-#{Spec::Rails::VERSION::STRING}
+
+ If you are upgrading, do this in each of your rails apps
+ that you want to upgrade:
+
+ $ ruby script/generate rspec
+
+ Please be sure to read History.rdoc and Upgrade.rdoc
+ for useful information about this release.
+
+#{'*'*50}
+POST_INSTALL_MESSAGE
+end
+
+['audit','test','test_deps','default','post_blog', 'release'].each do |task|
+ Rake.application.instance_variable_get('@tasks').delete(task)
+end
+
+task :post_blog do
+ # no-op
+end
+
+task :release => [:clean, :package] do |t|
+ version = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
+ abort "Versions don't match #{version} vs #{Spec::Rails::VERSION::STRING}" unless version == Spec::Rails::VERSION::STRING
+ pkg = "pkg/rspec-rails-#{version}"
+
+ rubyforge = RubyForge.new.configure
+ puts "Logging in to rubyforge ..."
+ rubyforge.login
+
+ puts "Releasing rspec-rails version #{version} ..."
+ ["#{pkg}.gem", "#{pkg}.tgz"].each do |file|
+ rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file)
+ end
+end
+
+Cucumber::Rake::Task.new
+
+task :default => [:features]
+
+namespace :update do
+ desc "update the manifest"
+ task :manifest do
+ system %q[touch Manifest.txt; rake check_manifest | grep -v "(in " | patch]
+ end
+end
diff --git a/vendor/plugins/rspec-rails/TODO.txt b/vendor/plugins/rspec-rails/TODO.txt
new file mode 100644
index 000000000..99a54c7f7
--- /dev/null
+++ b/vendor/plugins/rspec-rails/TODO.txt
@@ -0,0 +1,17 @@
+* wiki
+ * need a matrix of which rspec-rails versions support which rails versions
+* CI
+ * need a robust CI setup that runs
+ * Multiple rubies
+ * MRI: 1.8.6
+ * MRI: 1.8.7
+ * MRI: 1.9.1
+ * JRuby
+ * IronRuby??? (perhaps using mono)
+ * Multiple rails-es
+ * 2.0.5
+ * 2.1.2
+ * 2.2.2
+ * 2.3.4
+ * 3.0 (once available)
+ * With and without ActiveRecord
diff --git a/vendor/plugins/rspec-rails/Upgrade.rdoc b/vendor/plugins/rspec-rails/Upgrade.rdoc
new file mode 100644
index 000000000..ba7d02c3b
--- /dev/null
+++ b/vendor/plugins/rspec-rails/Upgrade.rdoc
@@ -0,0 +1,148 @@
+= Upgrade to 1.2.8 (in git)
+
+== What's new
+
+=== route_to and be_routable matchers
+
+Stop using route_for and params_from today! These new matchers from Randy
+Harmon are more expressive and more reliable. Here's how you use them:
+
+ { :put => "/projects/37" }.should route_to(:controller => 'projects', :action => 'update', :id => '37')
+
+ { :get => "/nonexisting_route" }.should_not be_routable
+
+== What's changed
+
+=== spec_server has been removed
+
+spec_server was deprecated in 1.2.7 and has now been removed. Admittedly, this
+was a short deprecation cycle, but spec server never quite worked right in all
+situations and spork is a great solution that you can use today! This is all
+you need to do:
+
+ [sudo] gem install spork
+ cd path/to/project
+ spork --bootsrap
+
+Now open up spec/spec_helper.rb and follow the directions at the top. You'll
+be up and running in no time.
+
+For more info:
+
+* http://github.com/timcharper/spork
+* http://groups.google.com/group/sporkgem
+
+= Upgrade to 1.2.7
+
+== What's changed
+
+=== spec_server is deprecated
+
+spec_server is deprecated in favor of Tim Harper's new spork library
+(http://github.com/timcharper/spork). Get it. Use it. Love it.
+
+ gem install spork
+
+= Upgrade to 1.2.0-1.2.6
+
+== What's changed
+
+=== Supported Rails Versions
+
+This release supports the following versions of rails:
+
+* 2.0.5
+* 2.1.2
+* 2.2.2
+* 2.3.2
+
+=== update generated files
+
+Be sure to run "script/generate rspec" and allow the following files to be overwritten:
+
+* lib/tasks/rspec.rake
+* script/spec
+* script/spec_server
+
+=== controller.use_rails_error_handling! is deprecated
+
+Use <tt>rescue_action_in_public!</tt> instead. It comes directly from rails and does
+exactly the same thing
+
+=== route_for
+
+After a change to edge rails broke our monkey-patched <tt>route_for</tt> method, I
+decided to just delegate to rails' <tt>assert_generates</tt> method. For most cases,
+this will not present a problem, but for some it might. You'll know if you
+upgrade and see any newly failing, route-related examples. Here are the things
+that you might need to change.
+
+==== Make sure IDs are strings
+
+If you had :id => 1 before, you need to change that to :id => "1"
+
+ #old
+ route_for(:controller => 'things', :action => 'show', :id => 1).should == "/things/1"
+
+ #new
+ route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1"
+
+==== Convert paths for non-get methods to hashes
+
+If you had an example with a route that requires post, put, or delete, you'll
+need to declare that explicitly.
+
+ #old
+ route_for(:controller => 'things', :action => 'create').should == "/things"
+
+ #new
+ route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post}
+
+=== Controller/template isolation
+
+Even though controller specs do not render views by default (use
+<tt>integrate_views</tt> to get them to render views), the way this works has
+changed in this version.
+
+It used to be that the view template need not even exist, but due to changes
+in rails it became much more difficult to manage that for all the different
+versions of rails that rspec-rails supports. So now the template must exist,
+but it still won't be rendered unless you declare <tt>integrate_views</tt>.
+
+== What's new
+
+=== render no longer requires a path
+
+The <tt>render()</tt> method in view specs will infer the path from the
+first argument passed to <tt>describe()</tt>.
+
+ describe "players/show" do
+ it "does something" do
+ render
+ response.should have_tag("....")
+ end
+ end
+
+=== routing specs live in spec/routing
+
+<tt>script/generate rspec_scaffold</tt> now generates its routing spec in
+<tt>spec/routing/</tt>.
+
+=== bypass_rescue
+
+Added a new <tt>bypass_rescue()</tt> declaration for controller specs. Use this
+when you want to specify that an error is raised by an action, even if that
+error is later captured by a <tt>rescue_from()</tt> declaration.
+
+ describe AccountController do
+ describe "GET @account" do
+ context "requested by anonymous user" do
+ it "denies access" do
+ bypass_rescue
+ lambda do
+ get :show, :id => "37"
+ end.should raise_error(AccessDenied)
+ end
+ end
+ end
+ end
diff --git a/vendor/plugins/rspec-rails/generators/integration_spec/integration_spec_generator.rb b/vendor/plugins/rspec-rails/generators/integration_spec/integration_spec_generator.rb
new file mode 100644
index 000000000..12a80e4fd
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/integration_spec/integration_spec_generator.rb
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
+class IntegrationSpecGenerator < ModelGenerator
+ def manifest
+ record do |m|
+ m.class_collisions class_path, class_name
+ m.template 'integration_spec.rb', File.join('spec/integration', class_path, "#{class_name.tableize}_spec.rb")
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/integration_spec/templates/integration_spec.rb b/vendor/plugins/rspec-rails/generators/integration_spec/templates/integration_spec.rb
new file mode 100644
index 000000000..d4b91f87f
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/integration_spec/templates/integration_spec.rb
@@ -0,0 +1,4 @@
+require 'spec_helper'
+
+describe "<%= class_name.pluralize %>" do
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec/CHANGES b/vendor/plugins/rspec-rails/generators/rspec/CHANGES
new file mode 100644
index 000000000..69f37090e
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/CHANGES
@@ -0,0 +1 @@
+Please refer to the CHANGES file for RSpec's core \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb b/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
new file mode 100644
index 000000000..7dad53cbc
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
@@ -0,0 +1,53 @@
+require 'rbconfig'
+
+# This generator bootstraps a Rails project for use with RSpec
+class RspecGenerator < Rails::Generator::Base
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
+ Config::CONFIG['ruby_install_name'])
+
+ def initialize(runtime_args, runtime_options = {})
+ if test ?f, 'spec/spec_helper.rb'
+
+ puts <<-HELPFUL_INSTRUCTIONS
+
+It looks like you are upgrading rspec-rails in this application. Please let
+this script overwrite everything it wants to with the following exceptions,
+*if* you have customized any of these files:
+
+ * spec/spec.opts
+ * spec/rcov.opts
+ * spec/spec_helper.rb
+
+If you have customized spec/spec_helper.rb, please set aside a copy of that
+file so that it can be updated and you can manually restore your changes.
+
+HELPFUL_INSTRUCTIONS
+ end
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
+ super
+ end
+
+ def manifest
+ record do |m|
+ script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
+
+ m.directory 'lib/tasks'
+ m.file 'rspec.rake', 'lib/tasks/rspec.rake'
+
+ m.file 'script/autospec', 'script/autospec', script_options
+ m.file 'script/spec', 'script/spec', script_options
+
+ m.directory 'spec'
+ m.file 'rcov.opts', 'spec/rcov.opts'
+ m.file 'spec.opts', 'spec/spec.opts'
+ m.template 'spec_helper.rb', 'spec/spec_helper.rb'
+ end
+ end
+
+protected
+
+ def banner
+ "Usage: #{$0} rspec"
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt b/vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts b/vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts
new file mode 100644
index 000000000..274ed51ad
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts
@@ -0,0 +1,2 @@
+--exclude "spec/*,gems/*"
+--rails \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake b/vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
new file mode 100644
index 000000000..dba3ffcc1
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
@@ -0,0 +1,144 @@
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+rspec_gem_dir = nil
+Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
+ rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
+end
+rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
+
+if rspec_gem_dir && (test ?d, rspec_plugin_dir)
+ raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
+end
+
+if rspec_gem_dir
+ $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
+elsif File.exist?(rspec_plugin_dir)
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
+end
+
+# Don't load rspec if running "rake gems:*"
+unless ARGV.any? {|a| a =~ /^gems/}
+
+begin
+ require 'spec/rake/spectask'
+rescue MissingSourceFile
+ module Spec
+ module Rake
+ class SpecTask
+ def initialize(name)
+ task name do
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
+ require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
+
+ # ... otherwise, do this:
+ raise <<-MSG
+
+#{"*" * 80}
+* You are trying to run an rspec rake task defined in
+* #{__FILE__},
+* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
+#{"*" * 80}
+MSG
+ end
+ end
+ end
+ end
+ end
+end
+
+Rake.application.instance_variable_get('@tasks').delete('default')
+
+spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+task :noop do
+end
+
+task :default => :spec
+task :stats => "spec:statsetup"
+
+desc "Run all specs in spec directory (excluding plugin specs)"
+Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :spec do
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = lambda do
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+ end
+ end
+
+ desc "Print Specdoc for all specs (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ end
+
+ desc "Print Specdoc for all plugin examples"
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
+ end
+
+ [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
+ desc "Run the code examples in spec/#{sub}"
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
+ end
+ end
+
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
+ end
+
+ namespace :plugins do
+ desc "Runs the examples for rspec_on_rails"
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
+ end
+ end
+
+ # Setup specs for stats
+ task :statsetup do
+ require 'code_statistics'
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
+ ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
+ ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
+ end
+
+ namespace :db do
+ namespace :fixtures do
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
+ task :load => :environment do
+ ActiveRecord::Base.establish_connection(Rails.env)
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
+
+ require 'active_record/fixtures'
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
+ end
+ end
+ end
+ end
+end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec b/vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec
new file mode 100644
index 000000000..837bbd7f4
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+ENV['RSPEC'] = 'true' # allows autotest to discover rspec
+ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
+system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
+ $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/script/spec b/vendor/plugins/rspec-rails/generators/rspec/templates/script/spec
new file mode 100644
index 000000000..46fdbe6e4
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/script/spec
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
+else
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+ ENV["RAILS_ENV"] ||= 'test'
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
+end
+require 'spec/autorun'
+exit ::Spec::Runner::CommandLine.run
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts b/vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts
new file mode 100644
index 000000000..391705bf8
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts
@@ -0,0 +1,4 @@
+--colour
+--format progress
+--loadby mtime
+--reverse
diff --git a/vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb b/vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
new file mode 100644
index 000000000..0ba147062
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
@@ -0,0 +1,54 @@
+# This file is copied to ~/spec when you run 'ruby script/generate rspec'
+# from the project root directory.
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
+require 'spec/autorun'
+require 'spec/rails'
+
+# Uncomment the next line to use webrat's matchers
+#require 'webrat/integrations/rspec-rails'
+
+# Requires supporting files with custom matchers and macros, etc,
+# in ./support/ and its subdirectories.
+Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
+
+Spec::Runner.configure do |config|
+ # If you're not using ActiveRecord you should remove these
+ # lines, delete config/database.yml and disable :active_record
+ # in your config/boot.rb
+ config.use_transactional_fixtures = true
+ config.use_instantiated_fixtures = false
+ config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+
+ # == Fixtures
+ #
+ # You can declare fixtures for each example_group like this:
+ # describe "...." do
+ # fixtures :table_a, :table_b
+ #
+ # Alternatively, if you prefer to declare them only once, you can
+ # do so right here. Just uncomment the next line and replace the fixture
+ # names with your fixtures.
+ #
+ # config.global_fixtures = :table_a, :table_b
+ #
+ # If you declare global fixtures, be aware that they will be declared
+ # for all of your examples, even those that don't use them.
+ #
+ # You can also declare which fixtures to use (for example fixtures for test/fixtures):
+ #
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+ #
+ # == Mock Framework
+ #
+ # RSpec uses it's own mocking framework by default. If you prefer to
+ # use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ #
+ # == Notes
+ #
+ # For more information take a look at Spec::Runner::Configuration and Spec::Runner
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_controller/USAGE b/vendor/plugins/rspec-rails/generators/rspec_controller/USAGE
new file mode 100755
index 000000000..1546c325d
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_controller/USAGE
@@ -0,0 +1,33 @@
+Description:
+ The rspec_controller generator creates stub specs and files for a new
+ controller and its views.
+
+ The generator takes a controller name and a list of views as arguments.
+ The controller name may be given in CamelCase or under_score and should
+ not be suffixed with 'Controller'. To create a controller within a
+ module, specify the controller name as 'module/controller'.
+
+ The generator creates stubs for a controller (and spec), a view (and spec)
+ for each view in the argument list, plus a helper.
+
+Example:
+ ./script/generate rspec_controller dog bark fetch
+ ...
+ create spec/controllers/dog_controller_spec.rb
+ create app/controllers/dog_controller.rb
+ create app/helpers/dog_helper.rb
+ create spec/views/dog/bark_view_spec.rb
+ create app/views/dog/bark.rhtml
+ create spec/views/dog/fetch_view_spec.rb
+ create app/views/dog/fetch.rhtml
+
+Modules Example:
+ ./script/generate rspec_controller 'pets/dog' bark fetch
+ ...
+ create spec/controllers/pets/dog_controller_spec.rb
+ create app/controllers/pets/dog_controller.rb
+ create app/helpers/pets/dog_helper.rb
+ create spec/views/pets/dog/bark_view_spec.rb
+ create app/views/pets/dog/bark.rhtml
+ create spec/views/pets/dog/fetch_view_spec.rb
+ create app/views/pets/dog/fetch.rhtml
diff --git a/vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb b/vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb
new file mode 100755
index 000000000..0064986d2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb
@@ -0,0 +1,47 @@
+require 'rails_generator/generators/components/controller/controller_generator'
+
+class RspecControllerGenerator < ControllerGenerator
+
+ def manifest
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions class_path, "#{class_name}Controller", "#{class_name}Helper"
+
+ # Controller, helper, views, and spec directories.
+ m.directory File.join('app/controllers', class_path)
+ m.directory File.join('app/helpers', class_path)
+ m.directory File.join('app/views', class_path, file_name)
+ m.directory File.join('spec/controllers', class_path)
+ m.directory File.join('spec/helpers', class_path)
+ m.directory File.join('spec/views', class_path, file_name)
+
+ @default_file_extension = "html.erb"
+
+ # Controller spec, class, and helper.
+ m.template 'controller_spec.rb',
+ File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
+
+ m.template 'helper_spec.rb',
+ File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")
+
+ m.template 'controller:controller.rb',
+ File.join('app/controllers', class_path, "#{file_name}_controller.rb")
+
+ m.template 'controller:helper.rb',
+ File.join('app/helpers', class_path, "#{file_name}_helper.rb")
+
+
+
+ # Spec and view template for each action.
+ actions.each do |action|
+ m.template 'view_spec.rb',
+ File.join('spec/views', class_path, file_name, "#{action}.#{@default_file_extension}_spec.rb"),
+ :assigns => { :action => action, :model => file_name }
+ path = File.join('app/views', class_path, file_name, "#{action}.#{@default_file_extension}")
+ m.template "controller:view.#{@default_file_extension}",
+ path,
+ :assigns => { :action => action, :path => path }
+ end
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb
new file mode 100755
index 000000000..9d13c49c6
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe <%= class_name %>Controller do
+
+<% if actions.empty? -%>
+ #Delete this example and add some real ones
+<% else -%>
+ #Delete these examples and add some real ones
+<% end -%>
+ it "should use <%= class_name %>Controller" do
+ controller.should be_an_instance_of(<%= class_name %>Controller)
+ end
+
+<% unless actions.empty? -%>
+<% for action in actions -%>
+
+ describe "GET '<%= action %>'" do
+ it "should be successful" do
+ get '<%= action %>'
+ response.should be_success
+ end
+ end
+<% end -%>
+<% end -%>
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb
new file mode 100644
index 000000000..ffdfd14f2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe <%= class_name %>Helper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should be included in the object returned by #helper" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(<%= class_name %>Helper)
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb
new file mode 100644
index 000000000..31469c606
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe "/<%= class_name.underscore %>/<%= action %>" do
+ before(:each) do
+ render '<%= class_name.underscore %>/<%= action %>'
+ end
+
+ #Delete this example and add some real ones or delete this file
+ it "should tell you where to find the file" do
+ response.should have_tag('p', %r[Find me in app/views/<%= class_name.underscore %>/<%= action %>])
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_default_values.rb b/vendor/plugins/rspec-rails/generators/rspec_default_values.rb
new file mode 100644
index 000000000..162681a36
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_default_values.rb
@@ -0,0 +1,28 @@
+module Rails
+ module Generator
+ class GeneratedAttribute
+ def default_value
+ @default_value ||= case type
+ when :int, :integer then "1"
+ when :float then "1.5"
+ when :decimal then "9.99"
+ when :datetime, :timestamp, :time then "Time.now"
+ when :date then "Date.today"
+ when :string, :text then "\"value for #{@name}\""
+ when :boolean then "false"
+ when :belongs_to, :references then "1"
+ else
+ ""
+ end
+ end
+
+ def name_or_reference
+ if ::Rails::VERSION::STRING >= '2.2'
+ reference? ? :"#{name}_id" : name
+ else
+ name
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_model/USAGE b/vendor/plugins/rspec-rails/generators/rspec_model/USAGE
new file mode 100755
index 000000000..a7b781414
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_model/USAGE
@@ -0,0 +1,18 @@
+Description:
+ The rspec_model generator creates stubs for a new model.
+
+ The generator takes a model name as its argument. The model name may be
+ given in CamelCase or under_score and should not be suffixed with 'Model'.
+
+ The generator creates a model class in app/models, an RSpec spec in
+ spec/models, database fixtures in spec/fixtures/plural_name.yml, and a migration
+ in db/migrate.
+
+Example:
+ ./script/generate rspec_model Account
+
+ This will create an Account model:
+ Model: app/models/account.rb
+ Spec: spec/models/account_spec.rb
+ Fixtures: spec/fixtures/accounts.yml
+ Migration: db/migrate/XXX_add_accounts.rb
diff --git a/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb b/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
new file mode 100755
index 000000000..66e873e31
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
@@ -0,0 +1,35 @@
+require 'rails_generator/generators/components/model/model_generator'
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
+class RspecModelGenerator < ModelGenerator
+
+ def manifest
+
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions class_path, class_name
+
+ # Model, spec, and fixture directories.
+ m.directory File.join('app/models', class_path)
+ m.directory File.join('spec/models', class_path)
+ unless options[:skip_fixture]
+ m.directory File.join('spec/fixtures', class_path)
+ end
+
+ # Model class, spec and fixtures.
+ m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
+ m.template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
+ unless options[:skip_fixture]
+ m.template 'model:fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml")
+ end
+
+ unless options[:skip_migration]
+ m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
+ :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
+ }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
+ end
+
+ end
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
new file mode 100755
index 000000000..c7cb1ce78
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
@@ -0,0 +1,13 @@
+require 'spec_helper'
+
+describe <%= class_name %> do
+ before(:each) do
+ @valid_attributes = {
+ <%= attributes.map{|a| ":#{a.name_or_reference} => #{a.default_value}" }.join(",\n ") %>
+ }
+ end
+
+ it "should create a new instance given valid attributes" do
+ <%= class_name %>.create!(@valid_attributes)
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
new file mode 100644
index 000000000..0761c0031
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
@@ -0,0 +1,154 @@
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
+class RspecScaffoldGenerator < Rails::Generator::NamedBase
+ default_options :skip_migration => false
+
+ attr_reader :controller_name,
+ :controller_class_path,
+ :controller_file_path,
+ :controller_class_nesting,
+ :controller_class_nesting_depth,
+ :controller_class_name,
+ :controller_singular_name,
+ :controller_plural_name,
+ :resource_edit_path,
+ :default_file_extension
+ alias_method :controller_file_name, :controller_singular_name
+ alias_method :controller_table_name, :controller_plural_name
+
+ def initialize(runtime_args, runtime_options = {})
+ super
+
+ @controller_name = @name.pluralize
+
+ base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
+ @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
+
+ if @controller_class_nesting.empty?
+ @controller_class_name = @controller_class_name_without_nesting
+ else
+ @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
+ end
+
+ @default_file_extension = "html.erb"
+ end
+
+ def manifest
+ record do |m|
+
+ # Check for class naming collisions.
+ m.class_collisions(controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}Helper")
+ m.class_collisions(class_path, "#{class_name}")
+
+ # Controller, helper, views, and spec directories.
+ m.directory(File.join('app/models', class_path))
+ m.directory(File.join('app/controllers', controller_class_path))
+ m.directory(File.join('app/helpers', controller_class_path))
+ m.directory(File.join('app/views', controller_class_path, controller_file_name))
+ m.directory(File.join('app/views/layouts', controller_class_path))
+ m.directory(File.join('public/stylesheets', class_path))
+
+ m.directory(File.join('spec/controllers', controller_class_path))
+ m.directory(File.join('spec/routing', controller_class_path))
+ m.directory(File.join('spec/models', class_path))
+ m.directory(File.join('spec/helpers', class_path))
+ m.directory File.join('spec/fixtures', class_path)
+ m.directory File.join('spec/views', controller_class_path, controller_file_name)
+ m.directory File.join('spec/integration', class_path)
+
+ # Layout and stylesheet.
+ m.template("scaffold:layout.html.erb", File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
+ m.template("scaffold:style.css", 'public/stylesheets/scaffold.css')
+
+ # Controller spec, class, and helper.
+ m.template 'rspec_scaffold:routing_spec.rb',
+ File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
+
+ m.template 'rspec_scaffold:controller_spec.rb',
+ File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
+
+ m.template "scaffold:controller.rb",
+ File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
+
+ m.template 'rspec_scaffold:helper_spec.rb',
+ File.join('spec/helpers', class_path, "#{controller_file_name}_helper_spec.rb")
+
+ m.template "scaffold:helper.rb",
+ File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb")
+
+ for action in scaffold_views
+ m.template(
+ "scaffold:view_#{action}.#{@default_file_extension}",
+ File.join('app/views', controller_class_path, controller_file_name, "#{action}.#{default_file_extension}")
+ )
+ end
+
+ # Model class, unit test, and fixtures.
+ m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
+ m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
+ m.template 'rspec_model:model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
+
+ # View specs
+ m.template "rspec_scaffold:edit_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "edit.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:index_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "index.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:new_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "new.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:show_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "show.#{default_file_extension}_spec.rb")
+
+ # Integration
+ m.template 'integration_spec:integration_spec.rb', File.join('spec/integration', class_path, "#{table_name}_spec.rb")
+
+ unless options[:skip_migration]
+ m.migration_template(
+ 'model:migration.rb', 'db/migrate',
+ :assigns => {
+ :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}",
+ :attributes => attributes
+ },
+ :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
+ )
+ end
+
+ m.route_resources controller_file_name
+
+ end
+ end
+
+ protected
+ # Override with your own usage banner.
+ def banner
+ "Usage: #{$0} rspec_scaffold ModelName [field:type field:type]"
+ end
+
+ def add_options!(opt)
+ opt.separator ''
+ opt.separator 'Options:'
+ opt.on("--skip-migration",
+ "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
+ end
+
+ def scaffold_views
+ %w[ index show new edit ]
+ end
+
+ def model_name
+ class_name.demodulize
+ end
+end
+
+module Rails
+ module Generator
+ class GeneratedAttribute
+ def input_type
+ @input_type ||= case type
+ when :text then "textarea"
+ else
+ "input"
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb
new file mode 100755
index 000000000..5de71bb58
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb
@@ -0,0 +1,131 @@
+require 'spec_helper'
+
+describe <%= controller_class_name %>Controller do
+
+ def mock_<%= file_name %>(stubs={})
+ @mock_<%= file_name %> ||= mock_model(<%= class_name %>, stubs)
+ end
+
+ describe "GET index" do
+ it "assigns all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
+ <%= class_name %>.stub!(:find).with(:all).and_return([mock_<%= file_name %>])
+ get :index
+ assigns[:<%= table_name %>].should == [mock_<%= file_name %>]
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).with("37").and_return(mock_<%= file_name %>)
+ get :show, :id => "37"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>)
+ get :new
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).with("37").and_return(mock_<%= file_name %>)
+ get :edit, :id => "37"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+ end
+
+ describe "POST create" do
+
+ describe "with valid params" do
+ it "assigns a newly created <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => true))
+ post :create, :<%= file_name %> => {:these => 'params'}
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ it "redirects to the created <%= file_name %>" do
+ <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => true))
+ post :create, :<%= file_name %> => {}
+ response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => false))
+ post :create, :<%= file_name %> => {:these => 'params'}
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ it "re-renders the 'new' template" do
+ <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => false))
+ post :create, :<%= file_name %> => {}
+ response.should render_template('new')
+ end
+ end
+
+ end
+
+ describe "PUT update" do
+
+ describe "with valid params" do
+ it "updates the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
+ end
+
+ it "assigns the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
+ put :update, :id => "1"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ it "redirects to the <%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
+ put :update, :id => "1"
+ response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
+ end
+ end
+
+ describe "with invalid params" do
+ it "updates the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
+ end
+
+ it "assigns the <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
+ put :update, :id => "1"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ it "re-renders the 'edit' template" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
+ put :update, :id => "1"
+ response.should render_template('edit')
+ end
+ end
+
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:destroy)
+ delete :destroy, :id => "37"
+ end
+
+ it "redirects to the <%= table_name %> list" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:destroy => true))
+ delete :destroy, :id => "1"
+ response.should redirect_to(<%= table_name %>_url)
+ end
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
new file mode 100644
index 000000000..4f9a7911c
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/edit.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %>,
+ :new_record? => false<%= output_attributes.empty? ? '' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+ )
+ end
+
+ it "renders the edit <%= file_name %> form" do
+ render
+
+ response.should have_tag("form[action=#{<%= file_name %>_path(@<%= file_name %>)}][method=post]") do
+<% for attribute in output_attributes -%>
+ with_tag('<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]', "<%= file_name %>[<%= attribute.name %>]")
+<% end -%>
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb
new file mode 100644
index 000000000..ad657cf05
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe <%= controller_class_name %>Helper do
+
+ #Delete this example and add some real ones or delete this file
+ it "is included in the helper object" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(<%= controller_class_name %>Helper)
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb
new file mode 100644
index 000000000..5aa33d5b2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/index.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= table_name %>] = [
+<% [1,2].each_with_index do |id, model_index| -%>
+ stub_model(<%= class_name %><%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+<% if !output_attributes.empty? -%>
+ <%= model_index == 1 ? ')' : '),' %>
+<% end -%>
+<% end -%>
+ ]
+ end
+
+ it "renders a list of <%= table_name %>" do
+ render
+<% for attribute in output_attributes -%>
+ response.should have_tag("tr>td", <%= attribute.default_value %>.to_s, 2)
+<% end -%>
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb
new file mode 100644
index 000000000..29f08e558
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/new.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= file_name %>] = stub_model(<%= class_name %>,
+ :new_record? => true<%= output_attributes.empty? ? '' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+ )
+ end
+
+ it "renders new <%= file_name %> form" do
+ render
+
+ response.should have_tag("form[action=?][method=post]", <%= table_name %>_path) do
+<% for attribute in output_attributes -%>
+ with_tag("<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]")
+<% end -%>
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb
new file mode 100644
index 000000000..ad4731aee
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe <%= controller_class_name %>Controller do
+ describe "routing" do
+ it "recognizes and generates #index" do
+ { :get => "/<%= table_name %>" }.should route_to(:controller => "<%= table_name %>", :action => "index")
+ end
+
+ it "recognizes and generates #new" do
+ { :get => "/<%= table_name %>/new" }.should route_to(:controller => "<%= table_name %>", :action => "new")
+ end
+
+ it "recognizes and generates #show" do
+ { :get => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "show", :id => "1")
+ end
+
+ it "recognizes and generates #edit" do
+ { :get => "/<%= table_name %>/1/edit" }.should route_to(:controller => "<%= table_name %>", :action => "edit", :id => "1")
+ end
+
+ it "recognizes and generates #create" do
+ { :post => "/<%= table_name %>" }.should route_to(:controller => "<%= table_name %>", :action => "create")
+ end
+
+ it "recognizes and generates #update" do
+ { :put => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "update", :id => "1")
+ end
+
+ it "recognizes and generates #destroy" do
+ { :delete => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "destroy", :id => "1")
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb
new file mode 100644
index 000000000..f2c11db89
--- /dev/null
+++ b/vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/show.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+ before(:each) do
+ assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %><%= output_attributes.empty? ? ')' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+<% if !output_attributes.empty? -%>
+ )
+<% end -%>
+ end
+
+ it "renders attributes in <p>" do
+ render
+<% for attribute in output_attributes -%>
+ response.should have_text(/<%= Regexp.escape(attribute.default_value).gsub(/^"|"$/, '')%>/)
+<% end -%>
+ end
+end
diff --git a/vendor/plugins/rspec-rails/init.rb b/vendor/plugins/rspec-rails/init.rb
new file mode 100644
index 000000000..6262f0368
--- /dev/null
+++ b/vendor/plugins/rspec-rails/init.rb
@@ -0,0 +1,9 @@
+# Placeholder to satisfy Rails.
+#
+# Do NOT add any require statements to this file. Doing
+# so will cause Rails to load this plugin all of the time.
+#
+# Running 'ruby script/generate rspec' will
+# generate spec/spec_helper.rb, which includes the necessary
+# require statements and configuration. This file should
+# be required by all of your spec files. \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/lib/autotest/discover.rb b/vendor/plugins/rspec-rails/lib/autotest/discover.rb
new file mode 100644
index 000000000..d3a6fbaaf
--- /dev/null
+++ b/vendor/plugins/rspec-rails/lib/autotest/discover.rb
@@ -0,0 +1,5 @@
+Autotest.add_discovery do
+ style = []
+ style << "rails" if File.exist? 'config/environment.rb'
+ style
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb b/vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb
new file mode 100644
index 000000000..2aa4f5f71
--- /dev/null
+++ b/vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb
@@ -0,0 +1,76 @@
+# (c) Copyright 2006 Nick Sieger <nicksieger@gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+$:.push(*Dir["vendor/rails/*/lib"])
+
+require 'active_support'
+require 'autotest/rspec'
+
+Autotest.add_hook :initialize do |at|
+ %w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins previous_failures.txt}.each do |exception|
+ at.add_exception(exception)
+ end
+
+ at.clear_mappings
+
+ at.add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
+ ["spec/models/#{m[2].singularize}_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
+ }
+ at.add_mapping(%r%^spec/(models|controllers|routing|views|helpers|lib)/.*rb$%) { |filename, _|
+ filename
+ }
+ at.add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
+ ["spec/models/#{m[1]}_spec.rb"]
+ }
+ at.add_mapping(%r%^app/views/(.*)$%) { |_, m|
+ at.files_matching %r%^spec/views/#{m[1]}_spec.rb$%
+ }
+ at.add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
+ if m[1] == "application"
+ at.files_matching %r%^spec/controllers/.*_spec\.rb$%
+ else
+ ["spec/controllers/#{m[1]}_spec.rb"]
+ end
+ }
+ at.add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
+ if m[1] == "application" then
+ at.files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
+ else
+ ["spec/helpers/#{m[1]}_helper_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
+ end
+ }
+ at.add_mapping(%r%^config/routes\.rb$%) {
+ at.files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^config/database\.yml$%) { |_, m|
+ at.files_matching %r%^spec/models/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
+ at.files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
+ ["spec/lib/#{m[1]}_spec.rb"]
+ }
+end
+
+class Autotest::RailsRspec < Autotest::Rspec
+end
diff --git a/vendor/plugins/rspec-rails/lib/spec/rails.rb b/vendor/plugins/rspec-rails/lib/spec/rails.rb
new file mode 100644
index 000000000..2a20d70b5
--- /dev/null
+++ b/vendor/plugins/rspec-rails/lib/spec/rails.rb
@@ -0,0 +1,26 @@
+begin
+ require_dependency 'application_controller'
+rescue MissingSourceFile
+ require_dependency 'application'
+end
+require 'rack/utils'
+
+require 'action_controller/test_process'
+require 'action_controller/integration'
+require 'active_support/test_case'
+require 'active_record/fixtures' if defined?(ActiveRecord::Base)
+
+require 'spec/test/unit'
+
+require 'spec/rails/matchers'
+require 'spec/rails/mocks'
+require 'spec/rails/example'
+require 'spec/rails/extensions'
+require 'spec/rails/interop/testcase'
+
+Spec::Example::ExampleGroupFactory.default(ActiveSupport::TestCase)
+
+if ActionView::Base.respond_to?(:cache_template_extensions)
+ ActionView::Base.cache_template_extensions = false
+end
+
diff --git a/vendor/plugins/rspec-rails/spec/autotest/mappings_spec.rb b/vendor/plugins/rspec-rails/spec/autotest/mappings_spec.rb
new file mode 100644
index 000000000..1e0ec738d
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/autotest/mappings_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+require File.dirname(__FILE__) + '/../../lib/autotest/rails_rspec'
+require File.dirname(__FILE__) + '/../../../rspec/spec/autotest/autotest_matchers'
+
+describe Autotest::RailsRspec, "file mapping" do
+ before(:each) do
+ @autotest = Autotest::RailsRspec.new
+ @autotest.hook :initialize
+ end
+
+ it "should map model example to model" do
+ @autotest.should map_specs(['spec/models/thing_spec.rb']).
+ to('app/models/thing.rb')
+ end
+
+ it "should map controller example to controller" do
+ @autotest.should map_specs(['spec/controllers/things_controller_spec.rb']).
+ to('app/controllers/things_controller.rb')
+ end
+
+ it "should map view.rhtml" do
+ @autotest.should map_specs(['spec/views/things/index.rhtml_spec.rb']).
+ to('app/views/things/index.rhtml')
+ end
+
+ it "should map view.rhtml with underscores in example filename" do
+ @autotest.should map_specs(['spec/views/things/index_rhtml_spec.rb']).
+ to('app/views/things/index.rhtml')
+ end
+
+ it "should map view.html.erb" do
+ @autotest.should map_specs(['spec/views/things/index.html.erb_spec.rb']).
+ to('app/views/things/index.html.erb')
+ end
+
+ describe "between routes.rb and things which depend on routes" do
+ it "should map routes.rb to controllers" do
+ @autotest.should map_specs(['spec/controllers/things_controller_spec.rb']).
+ to('config/routes.rb')
+ end
+
+ it "should map routes.rb to views" do
+ @autotest.should map_specs(['spec/views/things/action.html.erb_spec.rb']).
+ to('config/routes.rb')
+ end
+
+ it "should map routes.rb to helpers" do
+ @autotest.should map_specs(['spec/helpers/things_helper_spec.rb']).
+ to('config/routes.rb')
+ end
+
+ it "should map routing example to routes" do
+ @autotest.should map_specs(['spec/routing/thing_spec.rb']).
+ to('config/routes.rb')
+ end
+ end
+
+ describe "between the config and specs" do
+ ['spec/controllers/things_controller_spec.rb',
+ 'spec/views/things/action.html.erb_spec.rb',
+ 'spec/helpers/things_helper_spec.rb',
+ 'spec/routing/thing_spec.rb',
+ 'spec/models/thing_spec.rb'].each do |file_path|
+
+ it "should map environment.rb to #{file_path}" do
+ @autotest.should map_specs([file_path]).
+ to('config/environment.rb')
+ end
+
+ it "should map environments/test.rb to #{file_path}" do
+ @autotest.should map_specs([file_path]).
+ to('config/environments/test.rb')
+ end
+
+ it "should map boot.rb to #{file_path}" do
+ @autotest.should map_specs([file_path]).
+ to('config/boot.rb')
+ end
+
+ it "should map spec_helper.rb to #{file_path}" do
+ @autotest.should map_specs([file_path]).
+ to('spec/spec_helper.rb')
+ end
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/rails_suite.rb b/vendor/plugins/rspec-rails/spec/rails_suite.rb
new file mode 100644
index 000000000..15effae1c
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/rails_suite.rb
@@ -0,0 +1,7 @@
+dir = File.dirname(__FILE__)
+Dir["#{dir}/**/*_example.rb"].each do |file|
+ require file
+end
+Dir["#{dir}/**/*_spec.rb"].each do |file|
+ require file
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/action_view_base_spec_controller.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/action_view_base_spec_controller.rb
new file mode 100644
index 000000000..924022178
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/action_view_base_spec_controller.rb
@@ -0,0 +1,2 @@
+class ActionViewBaseSpecController < ActionController::Base
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/application.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/application.rb
new file mode 100644
index 000000000..343fdd7bc
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/application.rb
@@ -0,0 +1,9 @@
+class ApplicationController < ActionController::Base
+ before_filter :i_should_only_be_run_once,
+ :only => 'action_with_inherited_before_filter'
+
+ def i_should_only_be_run_once
+ true
+ end
+ private :i_should_only_be_run_once
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb
new file mode 100644
index 000000000..d5b5627d1
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb
@@ -0,0 +1,127 @@
+class ControllerSpecController < ActionController::Base
+ before_filter :raise_error, :only => :action_with_skipped_before_filter
+
+ def raise_error
+ raise "from a before filter"
+ end
+
+ skip_before_filter :raise_error
+
+ prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
+
+ def some_action
+ render :template => "template/that/does/not/actually/exist"
+ end
+
+ def some_action_with_implied_template
+ end
+
+ def action_with_template
+ render :template => "controller_spec/action_with_template"
+ end
+
+ def action_which_sets_flash
+ flash[:flash_key] = "flash value"
+ render :text => ""
+ end
+
+ def action_which_gets_session
+ raise "expected #{params[:session_key].inspect}\ngot #{session[:session_key].inspect}" unless (session[:session_key] == params[:expected])
+ render :text => ""
+ end
+
+ def action_which_sets_session
+ session[:session_key] = "session value"
+ end
+
+ def action_which_gets_cookie
+ raise "expected #{params[:expected].inspect}, got #{cookies[:cookie_key].inspect}" unless (cookies[:cookie_key] == params[:expected])
+ render :text => ""
+ end
+
+ def action_which_sets_cookie
+ cookies['cookie_key'] = params[:value]
+ render :text => ""
+ end
+
+ def action_with_partial
+ render :partial => "controller_spec/partial"
+ end
+
+ def action_with_partial_with_object
+ render :partial => "controller_spec/partial", :object => params[:thing]
+ end
+
+ def action_with_partial_with_locals
+ render :partial => "controller_spec/partial", :locals => {:thing => params[:thing]}
+ end
+
+ def action_with_errors_in_template
+ render :template => "controller_spec/action_with_errors_in_template"
+ end
+
+ def action_setting_the_assigns_hash
+ @indirect_assigns_key = :indirect_assigns_key_value
+ end
+
+ def action_setting_flash_after_session_reset
+ reset_session
+ flash[:after_reset] = "available"
+ end
+
+ def action_setting_flash_before_session_reset
+ flash[:before_reset] = 'available'
+ reset_session
+ end
+
+ def action_with_render_update
+ render :update do |page|
+ page.replace :bottom, 'replace_me',
+ :partial => 'non_existent_partial'
+ end
+ end
+
+ def action_with_skipped_before_filter
+ render :text => ""
+ end
+
+ def action_that_renders_inline
+ render :inline => "<%= 'inline code' %>"
+ end
+
+ def action_that_assigns_false_to_a_variable
+ @a_variable = false
+ render :text => ""
+ end
+
+ def action_with_two_arg_render
+ render :update, :status => 404 do |page|
+ page.visual_effect :highlight, 'user_list'
+ end
+ end
+
+ class RescuedError < Exception; end
+ class UnRescuedError < Exception; end
+
+ rescue_from RescuedError do |e|
+ render :text => 'Rescued!'
+ end
+
+ def rescued_error_action
+ raise ControllerSpecController::RescuedError
+ end
+
+ def un_rescued_error_action
+ raise ControllerSpecController::UnRescuedError
+ end
+
+ def action_that_returns_headers
+ render :text => request.headers[params[:header]]
+ end
+end
+
+class ControllerInheritingFromApplicationControllerController < ApplicationController
+ def action_with_inherited_before_filter
+ render :text => ""
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/example.txt b/vendor/plugins/rspec-rails/spec/resources/controllers/example.txt
new file mode 100644
index 000000000..380965314
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/example.txt
@@ -0,0 +1 @@
+This is an example file to download. \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/redirect_spec_controller.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/redirect_spec_controller.rb
new file mode 100644
index 000000000..7b63c99f2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/redirect_spec_controller.rb
@@ -0,0 +1,70 @@
+class RedirectSpecController < ApplicationController
+
+ def action_with_no_redirect
+ render :text => "this is just here to keep this from causing a MissingTemplate error"
+ end
+
+ def action_with_redirect_to_somewhere
+ redirect_to :action => 'somewhere'
+ end
+
+ def action_with_redirect_to_other_somewhere
+ redirect_to :controller => 'render_spec', :action => 'text_action'
+ end
+
+ def action_with_redirect_to_somewhere_and_return
+ redirect_to :action => 'somewhere' and return
+ render :text => "this is after the return"
+ end
+
+ def somewhere
+ render :text => "this is just here to keep this from causing a MissingTemplate error"
+ end
+
+ def action_with_redirect_to_rspec_site
+ redirect_to "http://rspec.rubyforge.org"
+ end
+
+ def action_with_redirect_back
+ redirect_to :back
+ end
+
+ def action_with_redirect_in_respond_to
+ respond_to do |wants|
+ wants.html { redirect_to :action => 'somewhere' }
+ end
+ end
+
+ def action_with_redirect_which_creates_query_string
+ redirect_to :action => "somewhere", :id => 1111, :param1 => "value1", :param2 => "value2"
+ end
+
+ # note: sometimes this is the URL which rails will generate from the hash in
+ # action_with_redirect_which_creates_query_string
+ def action_with_redirect_with_query_string_order1
+ redirect_to "http://test.host/redirect_spec/somewhere/1111?param1=value1&param2=value2"
+ end
+
+ # note: sometimes this is the URL which rails will generate from the hash in
+ # action_with_redirect_which_creates_query_string
+ def action_with_redirect_with_query_string_order2
+ redirect_to "http://test.host/redirect_spec/somewhere/1111?param2=value2&param1=value1"
+ end
+
+ def action_with_redirect_to_unroutable_url_inside_app
+ redirect_to :controller => "nonexistant", :action => "none"
+ end
+
+ def action_with_method_restriction
+ render :text => ''
+ end
+
+ def action_to_redirect_to_action_with_method_restriction
+ redirect_to :action => 'action_with_method_restriction'
+ end
+
+ def action_with_redirect_to_somewhere_with_status
+ redirect_to :action => 'somewhere', :status => 301
+ end
+end
+
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/render_spec_controller.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/render_spec_controller.rb
new file mode 100644
index 000000000..1efe61ff8
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/render_spec_controller.rb
@@ -0,0 +1,34 @@
+class RenderSpecController < ApplicationController
+ prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
+
+ def some_action
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
+ def action_which_renders_template_from_other_controller
+ render :template => 'controller_spec/action_with_template'
+ end
+
+ def text_action
+ render :text => "this is the text for this action"
+ end
+
+ def action_with_redirect
+ redirect_to :action => :some_action
+ end
+
+ def action_with_partial
+ render :partial => "a_partial"
+ end
+
+ def action_that_renders_nothing
+ render :nothing => true
+ end
+
+ def action_with_alternate_layout
+ render :layout => 'simple'
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/controllers/rjs_spec_controller.rb b/vendor/plugins/rspec-rails/spec/resources/controllers/rjs_spec_controller.rb
new file mode 100644
index 000000000..4fd9a41c0
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/controllers/rjs_spec_controller.rb
@@ -0,0 +1,58 @@
+class RjsSpecController < ApplicationController
+ prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
+
+ def replace_html
+ end
+
+ def insert_html
+ end
+
+ def replace
+ end
+
+ def hide_div
+ end
+
+ def hide_page_element
+ end
+
+ def replace_html_with_partial
+ end
+
+ def render_replace_html
+ render :update do |page|
+ page.replace_html 'mydiv', 'replacement text'
+ page.replace_html 'myotherdiv', 'other replacement text'
+ end
+ end
+
+ def render_replace_html_with_partial
+ render :update do |page|
+ page.replace_html 'mydiv', :partial => 'rjs_spec/replacement_partial'
+ end
+ end
+
+ def render_insert_html
+ render :update do |page|
+ page.insert_html 'mydiv', 'replacement text'
+ end
+ end
+
+ def render_replace
+ render :update do |page|
+ page.replace 'mydiv', 'replacement text'
+ end
+ end
+
+ def render_hide_div
+ render :update do |page|
+ page.hide 'mydiv'
+ end
+ end
+
+ def render_hide_page_element
+ render :update do |page|
+ page['mydiv'].hide
+ end
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/helpers/addition_helper.rb b/vendor/plugins/rspec-rails/spec/resources/helpers/addition_helper.rb
new file mode 100644
index 000000000..14ad70c3e
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/helpers/addition_helper.rb
@@ -0,0 +1,5 @@
+module AdditionHelper
+ def plus(addend)
+ @addend + addend
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/helpers/explicit_helper.rb b/vendor/plugins/rspec-rails/spec/resources/helpers/explicit_helper.rb
new file mode 100644
index 000000000..f75d1ddcb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/helpers/explicit_helper.rb
@@ -0,0 +1,46 @@
+module ExplicitHelper
+ def method_in_explicit_helper
+ "<div>This is text from a method in the ExplicitHelper</div>"
+ end
+
+ # this is an example of a method spec'able with eval_erb in helper specs
+ def prepend(arg, &block)
+ begin # rails edge after 2.1.0 eliminated need for block.binding
+ concat(arg) + block.call
+ rescue
+ concat(arg, block.binding) + block.call
+ end
+ end
+
+ def named_url
+ rspec_on_rails_specs_url
+ end
+
+ def named_path
+ rspec_on_rails_specs_path
+ end
+
+ def params_foo
+ params[:foo]
+ end
+
+ def session_foo
+ session[:foo]
+ end
+
+ def request_thing
+ request.thing
+ end
+
+ def flash_thing
+ flash[:thing]
+ end
+
+ def method_using_output_buffer
+ concat("the_text_from_concat")
+ end
+
+ def method_using_template
+ update_page { |p| p["#some_id"].replace_html "" }
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/helpers/more_explicit_helper.rb b/vendor/plugins/rspec-rails/spec/resources/helpers/more_explicit_helper.rb
new file mode 100644
index 000000000..7468741b2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/helpers/more_explicit_helper.rb
@@ -0,0 +1,5 @@
+module MoreExplicitHelper
+ def method_in_more_explicit_helper
+ "<div>This is text from a method in the MoreExplicitHelper</div>"
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/helpers/plugin_application_helper.rb b/vendor/plugins/rspec-rails/spec/resources/helpers/plugin_application_helper.rb
new file mode 100644
index 000000000..2107d2218
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/helpers/plugin_application_helper.rb
@@ -0,0 +1,6 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+ def method_in_plugin_application_helper
+ "<div>This is text from a method in the ApplicationHelper</div>"
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/helpers/view_spec_helper.rb b/vendor/plugins/rspec-rails/spec/resources/helpers/view_spec_helper.rb
new file mode 100644
index 000000000..b05fc53f7
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/helpers/view_spec_helper.rb
@@ -0,0 +1,13 @@
+module ViewSpecHelper
+ def method_in_helper
+ "<div>This is text from a method in the ViewSpecHelper</div>"
+ end
+
+ def method_in_template_with_partial
+ "<div>method_in_template_with_partial in ViewSpecHelper</div>"
+ end
+
+ def method_in_partial
+ "<div>method_in_partial in ViewSpecHelper</div>"
+ end
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/models/animal.rb b/vendor/plugins/rspec-rails/spec/resources/models/animal.rb
new file mode 100644
index 000000000..3ce078ad4
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/models/animal.rb
@@ -0,0 +1,4 @@
+class Animal < ActiveRecord::Base
+ belongs_to :person
+ validates_uniqueness_of :name
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/models/person.rb b/vendor/plugins/rspec-rails/spec/resources/models/person.rb
new file mode 100644
index 000000000..7f9607e57
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/models/person.rb
@@ -0,0 +1,18 @@
+class Person < ActiveRecord::Base
+ has_many :animals do
+ def pups
+ find(:all, :conditions => 'age < 1')
+ end
+ def adults
+ find(:all, :conditions => 'age >= 1')
+ end
+ end
+ validates_presence_of :name
+
+ def add_animal animal
+ animal.person = self
+ animals << animal
+ animal.save
+ end
+
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/models/thing.rb b/vendor/plugins/rspec-rails/spec/resources/models/thing.rb
new file mode 100644
index 000000000..c674804ac
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/models/thing.rb
@@ -0,0 +1,3 @@
+class Thing < ActiveRecord::Base
+ validates_presence_of :name
+end
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/_partial.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/_partial.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb
@@ -0,0 +1 @@
+
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb
@@ -0,0 +1 @@
+
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb
new file mode 100644
index 000000000..0f957b2c8
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb
@@ -0,0 +1 @@
+<% raise %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_template.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_template.html.erb
new file mode 100644
index 000000000..6e1f05847
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/action_with_template.html.erb
@@ -0,0 +1 @@
+<div>This is action_with_template.rhtml</div>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/layouts/application.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/layouts/application.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/layouts/application.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/layouts/simple.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/layouts/simple.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/layouts/simple.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/objects/_object.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/objects/_object.html.erb
new file mode 100644
index 000000000..b751f09c4
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/objects/_object.html.erb
@@ -0,0 +1 @@
+<%= object.name %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/render_spec/_a_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/_a_partial.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/_a_partial.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.js.rjs
new file mode 100644
index 000000000..4472f4b4c
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.js.rjs
@@ -0,0 +1 @@
+# This is used for rails > 1.2.3 \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/_replacement_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/_replacement_partial.html.erb
new file mode 100644
index 000000000..d2820659c
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/_replacement_partial.html.erb
@@ -0,0 +1 @@
+This is the text in the replacement partial. \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_div.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_div.js.rjs
new file mode 100644
index 000000000..1fe2139be
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_div.js.rjs
@@ -0,0 +1 @@
+page.hide 'mydiv'
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_page_element.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_page_element.js.rjs
new file mode 100644
index 000000000..de1ebc9d0
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/hide_page_element.js.rjs
@@ -0,0 +1 @@
+page['mydiv'].hide
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/insert_html.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/insert_html.js.rjs
new file mode 100644
index 000000000..f8a59e0ca
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/insert_html.js.rjs
@@ -0,0 +1 @@
+page.insert_html 'mydiv', 'replacement text'
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace.js.rjs
new file mode 100644
index 000000000..aca59a97a
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace.js.rjs
@@ -0,0 +1 @@
+page.replace 'mydiv', 'replacement text'
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html.js.rjs
new file mode 100644
index 000000000..717c598e6
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html.js.rjs
@@ -0,0 +1 @@
+page.replace_html 'mydiv', 'replacement text' \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs
new file mode 100644
index 000000000..0531804dd
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs
@@ -0,0 +1 @@
+page.replace_html 'mydiv', :partial => 'rjs_spec/replacement_partial' \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_effect.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_effect.js.rjs
new file mode 100644
index 000000000..1c37b32ad
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_effect.js.rjs
@@ -0,0 +1 @@
+page.visual_effect :fade, 'mydiv'
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs
new file mode 100644
index 000000000..97cf6bbeb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs
@@ -0,0 +1 @@
+page.visual_effect :toggle_blind, 'mydiv'
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/no_tags.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/no_tags.html.erb
new file mode 100644
index 000000000..877b90815
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/no_tags.html.erb
@@ -0,0 +1 @@
+<!-THIS FILE HAS NO TAGS-> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb
new file mode 100644
index 000000000..281c6866c
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb
@@ -0,0 +1 @@
+<div></div> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb
new file mode 100644
index 000000000..c664e76e7
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb
@@ -0,0 +1 @@
+<div key="value"></div> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial.html.erb
new file mode 100644
index 000000000..39505da3d
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial.html.erb
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_partial %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.html.erb
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.html.erb
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_local_variable.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_local_variable.html.erb
new file mode 100644
index 000000000..47274481b
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_local_variable.html.erb
@@ -0,0 +1 @@
+<div><%= x %></div> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb
new file mode 100644
index 000000000..90207a30d
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'partial', :object => partial %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_spacer.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_spacer.html.erb
new file mode 100644
index 000000000..c952f6e9a
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/_spacer.html.erb
@@ -0,0 +1 @@
+<hr id="spacer" />
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/accessor.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/accessor.html.erb
new file mode 100644
index 000000000..1d6f96b01
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/accessor.html.erb
@@ -0,0 +1,5 @@
+<div id="session"><%= session[:key] %></div>
+<div id="params"><%= params[:key] %></div>
+<div id="flash"><%= flash[:key] %></div>
+<div id="controller"><%= params[:controller] %></div>
+<div id="action"><%= params[:action] %></div>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/block_helper.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/block_helper.html.erb
new file mode 100644
index 000000000..3a1dcd5de
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/block_helper.html.erb
@@ -0,0 +1,3 @@
+<% if_allowed do %>
+ <div>block helper was rendered</div>
+<% end %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/entry_form.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/entry_form.html.erb
new file mode 100755
index 000000000..7b11d9723
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/entry_form.html.erb
@@ -0,0 +1,2 @@
+<% form_tag do %>
+<% end %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/explicit_helper.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/explicit_helper.html.erb
new file mode 100644
index 000000000..49aa081cd
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/explicit_helper.html.erb
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_explicit_helper %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/foo/show.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/foo/show.html.erb
new file mode 100644
index 000000000..2cc5fd98e
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/foo/show.html.erb
@@ -0,0 +1 @@
+<%= method_in_plugin_application_helper %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/implicit_helper.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/implicit_helper.html.erb
new file mode 100644
index 000000000..816c66744
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/implicit_helper.html.erb
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_helper %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/multiple_helpers.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/multiple_helpers.html.erb
new file mode 100644
index 000000000..ae5a72b65
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/multiple_helpers.html.erb
@@ -0,0 +1,3 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_explicit_helper %>
+<%= method_in_more_explicit_helper %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/path_params.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/path_params.html.erb
new file mode 100644
index 000000000..a31e98f83
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/path_params.html.erb
@@ -0,0 +1 @@
+<%= params[:controller] %> \ No newline at end of file
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/should_not_receive.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/should_not_receive.html.erb
new file mode 100644
index 000000000..d3e5f441e
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/should_not_receive.html.erb
@@ -0,0 +1,3 @@
+<% if @obj.render_partial? %>
+ <%= render :partial => 'some_partial' %>
+<% end %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial.html.erb
new file mode 100644
index 000000000..0e13ba3b2
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial.html.erb
@@ -0,0 +1,5 @@
+<%= method_in_template_with_partial %>
+<%= render :partial => 'partial' %>
+
+<%= render :partial => 'partial_used_twice' %>
+<%= render :partial => 'partial_used_twice' %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb
new file mode 100644
index 000000000..79d82156e
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb
@@ -0,0 +1,3 @@
+<%= render :partial => 'partial',
+ :collection => ['Alice', 'Bob'],
+ :spacer_template => 'spacer' %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_with_array.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_with_array.html.erb
new file mode 100644
index 000000000..7d53476d6
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/template_with_partial_with_array.html.erb
@@ -0,0 +1 @@
+<%= render :partial => @array %>
diff --git a/vendor/plugins/rspec-rails/spec/resources/views/view_spec/view_helpers.html.erb b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/view_helpers.html.erb
new file mode 100644
index 000000000..7e4f3df15
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/resources/views/view_spec/view_helpers.html.erb
@@ -0,0 +1 @@
+<span><%= link_to "edit", "this_is_the_link" %></span>
diff --git a/vendor/plugins/rspec-rails/spec/spec_helper.rb b/vendor/plugins/rspec-rails/spec/spec_helper.rb
new file mode 100644
index 000000000..b450d8a7d
--- /dev/null
+++ b/vendor/plugins/rspec-rails/spec/spec_helper.rb
@@ -0,0 +1,78 @@
+$LOAD_PATH.unshift '../rspec/lib'
+$LOAD_PATH.unshift '../../../'
+$LOAD_PATH.unshift 'spec/resources/controllers'
+$LOAD_PATH.unshift 'spec/resources/helpers'
+
+require '../../../spec/spec_helper'
+
+require 'spec/resources/controllers/application'
+require 'spec/resources/controllers/render_spec_controller'
+require 'spec/resources/controllers/controller_spec_controller'
+require 'spec/resources/controllers/rjs_spec_controller'
+require 'spec/resources/controllers/redirect_spec_controller'
+require 'spec/resources/controllers/action_view_base_spec_controller'
+require 'spec/resources/helpers/addition_helper'
+require 'spec/resources/helpers/explicit_helper'
+require 'spec/resources/helpers/more_explicit_helper'
+require 'spec/resources/helpers/view_spec_helper'
+require 'spec/resources/helpers/plugin_application_helper'
+require 'spec/resources/models/animal'
+require 'spec/resources/models/person'
+require 'spec/resources/models/thing'
+
+unless ActionController::Routing.controller_paths.include?('spec/resources/controllers')
+ ActionController::Routing.instance_eval {@possible_controllers = nil}
+ ActionController::Routing.controller_paths << 'spec/resources/controllers'
+end
+
+module Spec
+ module Rails
+ module Example
+ class ViewExampleGroupController
+ prepend_view_path 'spec/resources/views'
+ end
+ end
+ end
+end
+
+def fail()
+ raise_error(Spec::Expectations::ExpectationNotMetError)
+end
+
+def fail_with(message)
+ raise_error(Spec::Expectations::ExpectationNotMetError,message)
+end
+
+class Proc
+ def should_pass
+ lambda { self.call }.should_not raise_error
+ end
+end
+
+ActionController::Routing::Routes.draw do |map|
+ map.connect 'action_with_method_restriction', :controller => 'redirect_spec', :action => 'action_with_method_restriction', :conditions => { :method => :get }
+ map.connect 'action_to_redirect_to_action_with_method_restriction', :controller => 'redirect_spec', :action => 'action_to_redirect_to_action_with_method_restriction'
+
+ map.resources :rspec_on_rails_specs
+ map.custom_route 'custom_route', :controller => 'custom_route_spec', :action => 'custom_route'
+ map.connect ':controller/:action/:id'
+end
+
+module HelperMethods
+ def method_in_module_included_in_configuration
+ end
+end
+
+module HelperMacros
+ def accesses_configured_helper_methods
+ it "has access to methods in modules included in configuration" do
+ method_in_module_included_in_configuration
+ end
+ end
+end
+
+Spec::Runner.configure do |config|
+ config.include HelperMethods
+ config.extend HelperMacros
+end
+
diff --git a/vendor/plugins/rspec-rails/tasks/rspec.rake b/vendor/plugins/rspec-rails/tasks/rspec.rake
new file mode 100644
index 000000000..dba3ffcc1
--- /dev/null
+++ b/vendor/plugins/rspec-rails/tasks/rspec.rake
@@ -0,0 +1,144 @@
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+rspec_gem_dir = nil
+Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
+ rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
+end
+rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
+
+if rspec_gem_dir && (test ?d, rspec_plugin_dir)
+ raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
+end
+
+if rspec_gem_dir
+ $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
+elsif File.exist?(rspec_plugin_dir)
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
+end
+
+# Don't load rspec if running "rake gems:*"
+unless ARGV.any? {|a| a =~ /^gems/}
+
+begin
+ require 'spec/rake/spectask'
+rescue MissingSourceFile
+ module Spec
+ module Rake
+ class SpecTask
+ def initialize(name)
+ task name do
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
+ require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
+
+ # ... otherwise, do this:
+ raise <<-MSG
+
+#{"*" * 80}
+* You are trying to run an rspec rake task defined in
+* #{__FILE__},
+* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
+#{"*" * 80}
+MSG
+ end
+ end
+ end
+ end
+ end
+end
+
+Rake.application.instance_variable_get('@tasks').delete('default')
+
+spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+task :noop do
+end
+
+task :default => :spec
+task :stats => "spec:statsetup"
+
+desc "Run all specs in spec directory (excluding plugin specs)"
+Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :spec do
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = lambda do
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+ end
+ end
+
+ desc "Print Specdoc for all specs (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ end
+
+ desc "Print Specdoc for all plugin examples"
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
+ end
+
+ [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
+ desc "Run the code examples in spec/#{sub}"
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
+ end
+ end
+
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
+ end
+
+ namespace :plugins do
+ desc "Runs the examples for rspec_on_rails"
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
+ end
+ end
+
+ # Setup specs for stats
+ task :statsetup do
+ require 'code_statistics'
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
+ ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
+ ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
+ end
+
+ namespace :db do
+ namespace :fixtures do
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
+ task :load => :environment do
+ ActiveRecord::Base.establish_connection(Rails.env)
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
+
+ require 'active_record/fixtures'
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
+ end
+ end
+ end
+ end
+end
+
+end