You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/05/03 02:14:05 UTC
svn commit: r652957 [4/4] - in /ode/sandbox/singleshot: ./ app/controllers/
app/helpers/ app/models/ config/ db/ db/migrate/ lib/tasks/
public/javascripts/ spec/controllers/ vendor/plugins/rspec_on_rails/
vendor/plugins/rspec_on_rails/generators/ vendo...
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,62 @@
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+
+describe "have_text" do
+
+ describe "where target is a Regexp" do
+ it 'should should match submitted text using a regexp' do
+ string = 'foo'
+ string.should have_text(/fo*/)
+ end
+ end
+
+ describe "where target is a String" do
+ it 'should match submitted text using a string' do
+ string = 'foo'
+ string.should have_text('foo')
+ end
+ end
+
+end
+
+describe "have_text",
+ :type => :controller do
+ ['isolation','integration'].each do |mode|
+ if mode == 'integration'
+ integrate_views
+ end
+
+ describe "where target is a response (in #{mode} mode)" do
+ controller_name :render_spec
+
+ it "should pass with exactly matching text" do
+ post 'text_action'
+ response.should have_text("this is the text for this action")
+ end
+
+ it "should pass with matching text (using Regexp)" do
+ post 'text_action'
+ response.should have_text(/is the text/)
+ end
+
+ it "should fail with matching text" do
+ post 'text_action'
+ lambda {
+ response.should have_text("this is NOT the text for this action")
+ }.should fail_with("expected \"this is NOT the text for this action\", got \"this is the text for this action\"")
+ end
+
+ it "should fail when a template is rendered" do
+ post 'some_action'
+ lambda {
+ response.should have_text("this is the text for this action")
+ }.should fail_with(/expected \"this is the text for this action\", got .*/)
+ end
+
+ it "should pass using should_not with incorrect text" do
+ post 'text_action'
+ response.should_not have_text("the accordian guy")
+ end
+ end
+ end
+end
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,203 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+['isolation','integration'].each do |mode|
+ describe "redirect_to behaviour", :type => :controller do
+ if mode == 'integration'
+ integrate_views
+ end
+ controller_name :redirect_spec
+
+ it "redirected to another action" do
+ get 'action_with_redirect_to_somewhere'
+ response.should redirect_to(:action => 'somewhere')
+ end
+
+ it "redirected to another controller and action" do
+ get 'action_with_redirect_to_other_somewhere'
+ response.should redirect_to(:controller => 'render_spec', :action => 'text_action')
+ end
+
+ it "redirected to another action (with 'and return')" do
+ get 'action_with_redirect_to_somewhere_and_return'
+ response.should redirect_to(:action => 'somewhere')
+ end
+
+ it "redirected to correct path with leading /" do
+ get 'action_with_redirect_to_somewhere'
+ response.should redirect_to('/redirect_spec/somewhere')
+ end
+
+ it "redirected to correct path without leading /" do
+ get 'action_with_redirect_to_somewhere'
+ response.should redirect_to('redirect_spec/somewhere')
+ end
+
+ it "redirected to correct internal URL" do
+ get 'action_with_redirect_to_somewhere'
+ response.should redirect_to("http://test.host/redirect_spec/somewhere")
+ end
+
+ it "redirected to correct external URL" do
+ get 'action_with_redirect_to_rspec_site'
+ response.should redirect_to("http://rspec.rubyforge.org")
+ end
+
+ it "redirected :back" do
+ request.env['HTTP_REFERER'] = "http://test.host/previous/page"
+ get 'action_with_redirect_back'
+ response.should redirect_to(:back)
+ end
+
+ it "redirected :back and should redirect_to URL matches" do
+ request.env['HTTP_REFERER'] = "http://test.host/previous/page"
+ get 'action_with_redirect_back'
+ response.should redirect_to("http://test.host/previous/page")
+ end
+
+ it "redirected from within a respond_to block" do
+ get 'action_with_redirect_in_respond_to'
+ response.should redirect_to('redirect_spec/somewhere')
+ end
+
+ params_as_hash = {:action => "somewhere", :id => 1111, :param1 => "value1", :param2 => "value2"}
+
+ it "redirected to an internal URL containing a query string" do
+ get "action_with_redirect_which_creates_query_string"
+ response.should redirect_to(params_as_hash)
+ end
+
+ it "redirected to an internal URL containing a query string, one way it might be generated" do
+ get "action_with_redirect_with_query_string_order1"
+ response.should redirect_to(params_as_hash)
+ end
+
+ it "redirected to an internal URL containing a query string, another way it might be generated" do
+ get "action_with_redirect_with_query_string_order2"
+ response.should redirect_to(params_as_hash)
+ end
+
+ it "redirected to an internal URL which is unroutable but matched via a string" do
+ get "action_with_redirect_to_unroutable_url_inside_app"
+ response.should redirect_to("http://test.host/nonexistant/none")
+ end
+
+ end
+
+
+ describe "redirect_to with a controller spec in #{mode} mode and a custom request.host", :type => :controller do
+ if mode == 'integration'
+ integrate_views
+ end
+ controller_name :redirect_spec
+ before do
+ request.host = "some.custom.host"
+ end
+
+ it "should pass when redirected to another action" do
+ get 'action_with_redirect_to_somewhere'
+ response.should redirect_to(:action => 'somewhere')
+ end
+ end
+
+ describe "Given a controller spec in #{mode} mode", :type => :controller do
+ if mode == 'integration'
+ integrate_views
+ end
+ controller_name :redirect_spec
+
+ it "an action that redirects should not result in an error if no should redirect_to expectation is called" do
+ get 'action_with_redirect_to_somewhere'
+ end
+
+ it "an action that redirects should not result in an error if should_not redirect_to expectation was called, but not to that action" do
+ get 'action_with_redirect_to_somewhere'
+ response.should_not redirect_to(:action => 'another_destination')
+ end
+
+ it "an action that redirects should result in an error if should_not redirect_to expectation was called to that action" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should_not redirect_to(:action => 'somewhere')
+ }.should fail_with("expected not to be redirected to {:action=>\"somewhere\"}, but was")
+ end
+
+ it "an action that does not redirects should not result in an error if should_not redirect_to expectation was called" do
+ get 'action_with_no_redirect'
+ response.should_not redirect_to(:action => 'any_destination')
+ end
+
+
+ end
+
+ describe "Given a controller spec in #{mode} mode, should redirect_to should fail when", :type => :controller do
+ if mode == 'integration'
+ integrate_views
+ end
+ controller_name :redirect_spec
+
+ it "redirected to wrong action" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should redirect_to(:action => 'somewhere_else')
+ }.should fail_with("expected redirect to {:action=>\"somewhere_else\"}, got redirect to \"http://test.host/redirect_spec/somewhere\"")
+ end
+
+ it "redirected to incorrect path with leading /" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should redirect_to('/redirect_spec/somewhere_else')
+ }.should fail_with('expected redirect to "/redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
+ end
+
+ it "redirected to incorrect path without leading /" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should redirect_to('redirect_spec/somewhere_else')
+ }.should fail_with('expected redirect to "redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
+ end
+
+ it "redirected to incorrect internal URL (based on the action)" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should redirect_to("http://test.host/redirect_spec/somewhere_else")
+ }.should fail_with('expected redirect to "http://test.host/redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
+ end
+
+ it "redirected to wrong external URL" do
+ get 'action_with_redirect_to_rspec_site'
+ lambda {
+ response.should redirect_to("http://test.unit.rubyforge.org")
+ }.should fail_with('expected redirect to "http://test.unit.rubyforge.org", got redirect to "http://rspec.rubyforge.org"')
+ end
+
+ it "redirected to incorrect internal URL (based on the directory path)" do
+ get 'action_with_redirect_to_somewhere'
+ lambda {
+ response.should redirect_to("http://test.host/non_existent_controller/somewhere")
+ }.should fail_with('expected redirect to "http://test.host/non_existent_controller/somewhere", got redirect to "http://test.host/redirect_spec/somewhere"')
+ end
+
+ it "expected redirect :back, but redirected to a new URL" do
+ get 'action_with_no_redirect'
+ lambda {
+ response.should redirect_to(:back)
+ }.should fail_with('expected redirect to :back, got no redirect')
+ end
+
+ it "no redirect at all" do
+ get 'action_with_no_redirect'
+ lambda {
+ response.should redirect_to(:action => 'nowhere')
+ }.should fail_with("expected redirect to {:action=>\"nowhere\"}, got no redirect")
+ end
+
+ it "redirected to an internal URL which is unroutable and matched via a hash" do
+ get "action_with_redirect_to_unroutable_url_inside_app"
+ route = {:controller => "nonexistant", :action => "none"}
+ lambda {
+ response.should redirect_to(route)
+ }.should raise_error(ActionController::RoutingError, /(no route found to match|No route matches) \"\/nonexistant\/none\" with \{\}/)
+ end
+
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,169 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+['isolation','integration'].each do |mode|
+ describe "response.should render_template (in #{mode} mode)",
+ :type => :controller do
+ controller_name :render_spec
+ if mode == 'integration'
+ integrate_views
+ end
+
+ it "should match a simple path" do
+ post 'some_action'
+ response.should render_template('some_action')
+ end
+
+ it "should match a less simple path" do
+ post 'some_action'
+ response.should render_template('render_spec/some_action')
+ end
+
+ it "should match a less simple path to another controller" do
+ post 'action_which_renders_template_from_other_controller'
+ response.should render_template('controller_spec/action_with_template')
+ end
+
+ it "should match a symbol" do
+ post 'some_action'
+ response.should render_template(:some_action)
+ end
+
+ it "should match an rjs template" do
+ xhr :post, 'some_action'
+ if Rails::VERSION::STRING < "2.0.0"
+ response.should render_template('render_spec/some_action.rjs')
+ else
+ response.should render_template('render_spec/some_action')
+ end
+ end
+
+ it "should match a partial template (simple path)" do
+ get 'action_with_partial'
+ response.should render_template("_a_partial")
+ end
+
+ it "should match a partial template (complex path)" do
+ get 'action_with_partial'
+ response.should render_template("render_spec/_a_partial")
+ end
+
+ it "should fail when the wrong template is rendered" do
+ post 'some_action'
+ lambda do
+ response.should render_template('non_existent_template')
+ end.should fail_with("expected \"non_existent_template\", got \"render_spec/some_action\"")
+ end
+
+ it "should fail without full path when template is associated with a different controller" do
+ post 'action_which_renders_template_from_other_controller'
+ lambda do
+ response.should render_template('action_with_template')
+ end.should fail_with(%Q|expected "action_with_template", got "controller_spec/action_with_template"|)
+ end
+
+ it "should fail with incorrect full path when template is associated with a different controller" do
+ post 'action_which_renders_template_from_other_controller'
+ lambda do
+ response.should render_template('render_spec/action_with_template')
+ end.should fail_with(%Q|expected "render_spec/action_with_template", got "controller_spec/action_with_template"|)
+ end
+
+ it "should fail on the wrong extension (given rhtml)" do
+ get 'some_action'
+ lambda {
+ response.should render_template('render_spec/some_action.rjs')
+ }.should fail_with("expected \"render_spec/some_action.rjs\", got \"render_spec/some_action\"")
+ end
+
+ it "should fail when TEXT is rendered" do
+ post 'text_action'
+ lambda do
+ response.should render_template('some_action')
+ end.should fail_with("expected \"some_action\", got nil")
+ end
+ end
+
+ describe "response.should_not render_template (in #{mode} mode)",
+ :type => :controller do
+ controller_name :render_spec
+ if mode == 'integration'
+ integrate_views
+ end
+
+ it "should pass when the action renders nothing" do
+ post 'action_that_renders_nothing'
+ response.should_not render_template('action_that_renders_nothing')
+ end
+
+ it "should pass when the action renders nothing (symbol)" do
+ post 'action_that_renders_nothing'
+ response.should_not render_template(:action_that_renders_nothing)
+ end
+
+ it "should pass when the action does not render the template" do
+ post 'some_action'
+ response.should_not render_template('some_other_template')
+ end
+
+ it "should pass when the action does not render the template (symbol)" do
+ post 'some_action'
+ response.should_not render_template(:some_other_template)
+ end
+
+ it "should pass when the action does not render the template (named with controller)" do
+ post 'some_action'
+ response.should_not render_template('render_spec/some_other_template')
+ end
+
+ it "should pass when the action renders the template with a different controller" do
+ post 'action_which_renders_template_from_other_controller'
+ response.should_not render_template('action_with_template')
+ end
+
+ it "should pass when the action renders the template (named with controller) with a different controller" do
+ post 'action_which_renders_template_from_other_controller'
+ response.should_not render_template('render_spec/action_with_template')
+ end
+
+ it "should pass when TEXT is rendered" do
+ post 'text_action'
+ response.should_not render_template('some_action')
+ end
+
+ it "should fail when the action renders the template" do
+ post 'some_action'
+ lambda do
+ response.should_not render_template('some_action')
+ end.should fail_with("expected not to render \"some_action\", but did")
+ end
+
+ it "should fail when the action renders the template (symbol)" do
+ post 'some_action'
+ lambda do
+ response.should_not render_template(:some_action)
+ end.should fail_with("expected not to render \"some_action\", but did")
+ end
+
+ it "should fail when the action renders the template (named with controller)" do
+ post 'some_action'
+ lambda do
+ response.should_not render_template('render_spec/some_action')
+ end.should fail_with("expected not to render \"render_spec/some_action\", but did")
+ end
+
+ it "should fail when the action renders the partial" do
+ post 'action_with_partial'
+ lambda do
+ response.should_not render_template('_a_partial')
+ end.should fail_with("expected not to render \"_a_partial\", but did")
+ end
+
+ it "should fail when the action renders the partial (named with controller)" do
+ post 'action_with_partial'
+ lambda do
+ response.should_not render_template('render_spec/_a_partial')
+ end.should fail_with("expected not to render \"render_spec/_a_partial\", but did")
+ end
+
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,65 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+class MockableModel < ActiveRecord::Base
+ has_one :associated_model
+end
+
+class SubMockableModel < MockableModel
+end
+
+class AssociatedModel < ActiveRecord::Base
+ belongs_to :mockable_model
+end
+
+describe "mock_model", :type => :view do
+ before(:each) do
+ @model = mock_model(SubMockableModel)
+ end
+ it "should say it is_a? if it is" do
+ @model.is_a?(SubMockableModel).should be(true)
+ end
+ it "should say it is_a? if it's ancestor is" do
+ @model.is_a?(MockableModel).should be(true)
+ end
+ it "should say it is kind_of? if it is" do
+ @model.kind_of?(SubMockableModel).should be(true)
+ end
+ it "should say it is kind_of? if it's ancestor is" do
+ @model.kind_of?(MockableModel).should be(true)
+ end
+ it "should say it is instance_of? if it is" do
+ @model.instance_of?(SubMockableModel).should be(true)
+ end
+ it "should not say it instance_of? if it isn't, even if it's ancestor is" do
+ @model.instance_of?(MockableModel).should be(false)
+ end
+end
+
+describe "mock_model with null_object", :type => :view do
+ before(:each) do
+ @model = mock_model(MockableModel, :null_object => true, :mocked_method => "mocked")
+ end
+
+ it "should be able to mock methods" do
+ @model.mocked_method.should == "mocked"
+ end
+ it "should return itself to unmocked methods" do
+ @model.unmocked_method.should equal(@model)
+ end
+end
+
+describe "mock_model as association", :type => :view do
+ before(:each) do
+ @real = AssociatedModel.create!
+ @mock_model = mock_model(MockableModel)
+ @real.mockable_model = @mock_model
+ end
+
+ it "should pass associated_model == mock" do
+ @mock_model.should == @real.mockable_model
+ end
+
+ it "should pass mock == associated_model" do
+ @real.mockable_model.should == @mock_model
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe "A sample spec" do
+ it "should pass" do
+ true.should === true
+ end
+end
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,89 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe "script/spec_server file", :shared => true do
+ attr_accessor :tmbundle_install_directory
+
+ after do
+ system "kill -9 #{@pid}"
+ end
+
+ it "runs a spec" do
+ dir = File.dirname(__FILE__)
+ output = ""
+ Timeout.timeout(10) do
+ loop do
+ output = `#{RAILS_ROOT}/script/spec #{dir}/sample_spec.rb --drb 2>&1`
+ break unless output.include?("No server is running")
+ end
+ end
+
+ unless $?.exitstatus == 0
+ flunk "command 'script/spec spec/sample_spec' failed\n#{output}"
+ end
+ end
+
+ def start_spec_server
+ create_spec_server_pid_file
+ start_spec_server_process
+ end
+
+ def create_spec_server_pid_file
+ current_dir = File.dirname(__FILE__)
+ pid_dir = "#{Dir.tmpdir}/#{Time.now.to_i}"
+ @spec_server_pid_file = "#{pid_dir}/spec_server.pid"
+ FileUtils.mkdir_p pid_dir
+ system "touch #{@spec_server_pid_file}"
+ @rspec_path = File.expand_path("#{current_dir}/../../../rspec/lib")
+ end
+
+ def start_spec_server_process
+ dir = File.dirname(__FILE__)
+ spec_server_cmd = %Q|export HOME=#{Dir.tmpdir}; |
+ spec_server_cmd << %Q|ruby -e 'system("echo " + Process.pid.to_s + " > #{@spec_server_pid_file}"); |
+ spec_server_cmd << %Q|$LOAD_PATH.unshift("#{@rspec_path}"); require "spec"; |
+ spec_server_cmd << %Q|load "#{RAILS_ROOT}/script/spec_server"' &|
+ system spec_server_cmd
+
+ file_content = ""
+ Timeout.timeout(5) do
+ loop do
+ file_content = File.read(@spec_server_pid_file)
+ break unless file_content.blank?
+ end
+ end
+ @pid = Integer(File.read(@spec_server_pid_file))
+ end
+end
+
+describe "script/spec_server file without TextMate bundle" do
+ it_should_behave_like "script/spec_server file"
+ before do
+ start_spec_server
+ end
+end
+
+describe "script/spec_server file with TextMate bundle" do
+ it_should_behave_like "script/spec_server file"
+ before do
+ dir = File.dirname(__FILE__)
+ @tmbundle_install_directory = File.expand_path("#{Dir.tmpdir}/Library/Application Support/TextMate/Bundles")
+ @bundle_name = "RSpec.tmbundle"
+ FileUtils.mkdir_p(tmbundle_install_directory)
+ bundle_dir = File.expand_path("#{dir}/../../../../../../#{@bundle_name}")
+ File.directory?(bundle_dir).should be_true
+ unless system(%Q|ln -s #{bundle_dir} "#{tmbundle_install_directory}"|)
+ raise "Creating link to Textmate Bundle"
+ end
+ start_spec_server
+ end
+
+ after do
+ bundle_file_to_remove = "#{tmbundle_install_directory}/#{@bundle_name}"
+ if bundle_file_to_remove == "/"
+ raise "bundle file path resolved to '/' - could not call rm"
+ end
+ unless system(%Q|rm "#{bundle_file_to_remove}"|)
+ raise "Removing Textmate bundle link failed"
+ end
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe "script/spec file" do
+ it "should run a spec" do
+ dir = File.dirname(__FILE__)
+ output = `#{RAILS_ROOT}/script/spec #{dir}/sample_spec.rb`
+ unless $?.exitstatus == 0
+ flunk "command 'script/spec spec/sample_spec' failed\n#{output}"
+ end
+ end
+end
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails_suite.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails_suite.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails_suite.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/rails_suite.rb Fri May 2 17:14:01 2008
@@ -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
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/spec_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/spec_helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/spec_helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec/spec_helper.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,46 @@
+dir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../rspec/lib"))
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../spec_resources/controllers"))
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../spec_resources/helpers"))
+require File.expand_path("#{dir}/../../../../spec/spec_helper")
+require File.expand_path("#{dir}/../spec_resources/controllers/render_spec_controller")
+require File.expand_path("#{dir}/../spec_resources/controllers/rjs_spec_controller")
+require File.expand_path("#{dir}/../spec_resources/controllers/redirect_spec_controller")
+require File.expand_path("#{dir}/../spec_resources/controllers/action_view_base_spec_controller")
+require File.expand_path("#{dir}/../spec_resources/helpers/explicit_helper")
+require File.expand_path("#{dir}/../spec_resources/helpers/more_explicit_helper")
+require File.expand_path("#{dir}/../spec_resources/helpers/view_spec_helper")
+require File.expand_path("#{dir}/../spec_resources/helpers/plugin_application_helper")
+
+ActionController::Routing.controller_paths << "#{dir}/../spec_resources/controllers"
+
+module Spec
+ module Rails
+ module Example
+ class ViewExampleGroupController
+ set_view_path File.join(File.dirname(__FILE__), "..", "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.resources :rspec_on_rails_specs
+ map.connect 'custom_route', :controller => 'custom_route_spec', :action => 'custom_route'
+ map.connect ":controller/:action/:id"
+end
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,2 @@
+class ActionViewBaseSpecController < ActionController::Base
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,56 @@
+class ControllerSpecController < ActionController::Base
+ if ['edge','2.0.0'].include?(ENV['RSPEC_RAILS_VERSION'])
+ set_view_path [File.join(File.dirname(__FILE__), "..", "views")]
+ else
+ set_view_path File.join(File.dirname(__FILE__), "..", "views")
+ end
+
+ def some_action
+ render :template => "template/that/does/not/actually/exist"
+ end
+
+ def action_with_template
+ session[:session_key] = "session value"
+ flash[:flash_key] = "flash value"
+ render :template => "controller_spec/action_with_template"
+ 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
+ assigns['direct_assigns_key'] = :direct_assigns_key_value
+ @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
+end
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,59 @@
+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¶m2=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¶m1=value1"
+ end
+
+ def action_with_redirect_to_unroutable_url_inside_app
+ redirect_to :controller => "nonexistant", :action => "none"
+ end
+
+end
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,26 @@
+class RenderSpecController < ApplicationController
+ set_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_partial
+ render :partial => "a_partial"
+ end
+
+ def action_that_renders_nothing
+ render :nothing => true
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,58 @@
+class RjsSpecController < ApplicationController
+ set_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
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,10 @@
+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)
+ concat(arg, block.binding) + block.call
+ end
+end
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb Fri May 2 17:14:01 2008
@@ -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
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb Fri May 2 17:14:01 2008
@@ -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
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb Fri May 2 17:14:01 2008
@@ -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
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/_partial.rhtml?rev=652957&view=auto
==============================================================================
(empty)
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml?rev=652957&view=auto
==============================================================================
(empty)
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<% raise %>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<div>This is action_with_template.rhtml</div>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/_a_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/_a_partial.rhtml?rev=652957&view=auto
==============================================================================
(empty)
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+# This is used for rails > 1.2.3
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rhtml?rev=652957&view=auto
==============================================================================
(empty)
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+# This is used for rails <= 1.2.3
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+This is the text in the replacement partial.
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.hide 'mydiv'
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page['mydiv'].hide
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.insert_html 'mydiv', 'replacement text'
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.replace 'mydiv', 'replacement text'
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.replace_html 'mydiv', 'replacement text'
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.replace_html 'mydiv', :partial => 'rjs_spec/replacement_partial'
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.visual_effect :fade, 'mydiv'
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+page.visual_effect :toggle_blind, 'mydiv'
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<!-THIS FILE HAS NO TAGS->
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<div></div>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<div key="value"></div>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_partial %>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_used_twice.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_used_twice.rhtml?rev=652957&view=auto
==============================================================================
(empty)
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<div><%= x %></div>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<%= render :partial => 'partial', :object => partial %>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<hr id="spacer" />
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,3 @@
+<div id="session"><%= session[:key] %></div>
+<div id="params"><%= params[:key] %></div>
+<div id="flash"><%= flash[:key] %></div>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,2 @@
+<% form_tag do %>
+<% end %>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_explicit_helper %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<%= method_in_plugin_application_helper %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,2 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_helper %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,3 @@
+<%= method_in_plugin_application_helper %>
+<%= method_in_explicit_helper %>
+<%= method_in_more_explicit_helper %>
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,5 @@
+<%= method_in_template_with_partial %>
+<%= render :partial => 'partial' %>
+
+<%= render :partial => 'partial_used_twice' %>
+<%= render :partial => 'partial_used_twice' %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1,3 @@
+<%= render :partial => 'partial',
+ :collection => ['Alice', 'Bob'],
+ :spacer_template => 'spacer' %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml Fri May 2 17:14:01 2008
@@ -0,0 +1 @@
+<%= render :partial => @array %>
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/all.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/all.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/all.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/all.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,10 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+require File.join(File.dirname(__FILE__), *%w[steps people])
+
+# Run transactions_should_rollback in Ruby
+require File.join(File.dirname(__FILE__), *%w[transactions_should_rollback])
+
+# Run transactions_should_rollback in Plain Text
+with_steps_for :people do
+ run File.join(File.dirname(__FILE__), *%w[transactions_should_rollback]), :type => RailsStory
+end
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/helper.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/helper.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/helper.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,5 @@
+dir = File.dirname(__FILE__)
+$LOAD_PATH.unshift File.expand_path("#{dir}/../lib")
+require File.expand_path("#{dir}/../../../../spec/spec_helper")
+
+require 'spec/rails/story_adapter'
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/steps/people.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/steps/people.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/steps/people.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/steps/people.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,8 @@
+steps_for :people do
+ When "I add a Person" do
+ Person.create!(:name => "Foo")
+ end
+ Then "there should be one person" do
+ Person.count.should == 1
+ end
+end
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback Fri May 2 17:14:01 2008
@@ -0,0 +1,15 @@
+Story: transactions should rollback in plain text
+ As an RSpec/Rails Story author
+ I want transactions to roll back between scenarios in plain text
+ So that I can have confidence in the state of the database
+
+ Scenario: add one Person
+ When I add a Person
+
+ Scenario: add another person
+ GivenScenario: add one Person
+ Then there should be one person
+
+ Scenario: add yet another person
+ GivenScenario: add one Person
+ Then there should be one person
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb Fri May 2 17:14:01 2008
@@ -0,0 +1,25 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+
+Story "transactions should rollback", %{
+ As an RSpec/Rails Story author
+ I want transactions to roll back between scenarios
+ So that I can have confidence in the state of the database
+}, :type => RailsStory do
+ Scenario "add one Person" do
+ When "I add a Person" do
+ Person.create!(:name => "Foo")
+ end
+ end
+
+ Scenario "add another person" do
+ GivenScenario "add one Person"
+ Then "there should be one person" do
+ Person.count.should == 1
+ end
+ end
+
+ Scenario "add yet another person" do
+ GivenScenario "add one Person"
+ Then "there should be one person"
+ end
+end
\ No newline at end of file
Added: ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/tasks/rspec.rake
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/tasks/rspec.rake?rev=652957&view=auto
==============================================================================
--- ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/tasks/rspec.rake (added)
+++ ode/sandbox/singleshot/vendor/plugins/rspec_on_rails/tasks/rspec.rake Fri May 2 17:14:01 2008
@@ -0,0 +1,137 @@
+# In rails 1.2, plugins aren't available in the path until they're loaded.
+# Check to see if the rspec plugin is installed first and require
+# it if it is. If not, use the gem version.
+rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../rspec/lib')
+$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+require 'spec/rake/spectask'
+require 'spec/translator'
+
+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 specs"
+ 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].each do |sub|
+ desc "Run the specs under 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 specs under 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_on_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_on_rails/spec/**/*_spec.rb']
+ end
+ end
+
+ desc "Translate/upgrade specs using the built-in translator"
+ task :translate do
+ translator = ::Spec::Translator.new
+ dir = RAILS_ROOT + '/spec'
+ translator.translate(dir, dir)
+ 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')
+ ::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')
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
+ 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"
+ task :load => :environment do
+ require 'active_record/fixtures'
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
+ end
+ end
+ end
+ end
+
+ namespace :server do
+ daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
+
+ desc "start spec_server."
+ task :start do
+ if File.exist?(daemonized_server_pid)
+ $stderr.puts "spec_server is already running."
+ else
+ $stderr.puts "Starting up spec server."
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
+ end
+ end
+
+ desc "stop spec_server."
+ task :stop do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Shutting down spec_server."
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
+ File.delete(daemonized_server_pid)
+ end
+ end
+
+ desc "reload spec_server."
+ task :restart do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Reloading down spec_server."
+ system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
+ end
+ end
+ end
+end