incubator-olio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wso...@apache.org
Subject svn commit: r725524 [3/14] - in /incubator/olio/webapp/rails/trunk: app/controllers/ app/models/ app/views/events/ config/ config/environments/ spec/controllers/ spec/models/ vendor/plugins/attachment_fu/ vendor/plugins/attachment_fu/lib/ vendor/plugin...
Date Thu, 11 Dec 2008 01:34:30 GMT
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb Wed Dec 10 17:34:18 2008
@@ -8,22 +8,21 @@
   module Rails
 
     module Example
-      class RailsExampleGroup < Test::Unit::TestCase
-        
-        # Rails >= r8570 uses setup/teardown_fixtures explicitly
-        before(:each) do
-          setup_fixtures if self.respond_to?(:setup_fixtures)
+      if ActiveSupport.const_defined?(:TestCase)
+        class RailsExampleGroup < ActiveSupport::TestCase
+          include ActionController::Assertions::SelectorAssertions
         end
-        after(:each) do
-          teardown_fixtures if self.respond_to?(:teardown_fixtures)
+      else
+        class RailsExampleGroup < Test::Unit::TestCase
         end
-        
+      end
+      
+      class RailsExampleGroup
         include Spec::Rails::Matchers
         include Spec::Rails::Mocks
-        
         Spec::Example::ExampleGroupFactory.default(self)
-        
       end
+      
     end
   end
 end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb Wed Dec 10 17:34:18 2008
@@ -3,61 +3,39 @@
 module Spec
   module Rails
     module Example
-      # Provides specialized mock-like behaviour for controller and view examples,
-      # allowing you to mock or stub calls to render with specific arguments while
-      # ignoring all other calls.
+      # Extends the #should_receive, #should_not_receive and #stub! methods in rspec's
+      # mocking framework to handle #render calls to controller in controller examples
+      # and template and view examples
       module RenderObserver
 
-        # Similar to mocking +render+ with the exception that calls to +render+ with
-        # any other options are passed on to the receiver (i.e. controller in
-        # controller examples, template in view examples).
-        #
-        # This is necessary because Rails uses the +render+ method on both
-        # controllers and templates as a dispatcher to render different kinds of
-        # things, sometimes resulting in many calls to the render method within one
-        # request. This approach makes it impossible to use a normal mock object, which
-        # is designed to observe all incoming messages with a given name.
-        #
-        # +expect_render+ is auto-verifying, so failures will be reported without
-        # requiring you to explicitly request verification.
-        #
-        # Also, +expect_render+ uses parts of RSpec's mock expectation framework. Because
-        # it wraps only a subset of the framework, using this will create no conflict with
-        # other mock frameworks if you choose to use them. Additionally, the object returned
-        # by expect_render is an RSpec mock object, which means that you can call any of the
-        # chained methods available in RSpec's mocks.
-        #
-        # == Controller Examples
-        #
-        #   controller.expect_render(:partial => 'thing', :object => thing)
-        #   controller.expect_render(:partial => 'thing', :collection => things).once
-        #
-        #   controller.stub_render(:partial => 'thing', :object => thing)
-        #   controller.stub_render(:partial => 'thing', :collection => things).twice
-        #
-        # == View Examples
-        #
-        #   template.expect_render(:partial => 'thing', :object => thing)
-        #   template.expect_render(:partial => 'thing', :collection => things)
-        #
-        #   template.stub_render(:partial => 'thing', :object => thing)
-        #   template.stub_render(:partial => 'thing', :collection => things)
+        # DEPRECATED
         #
+        # Use should_receive(:render).with(opts) instead
         def expect_render(opts={})
+          warn_deprecation("expect_render", "should_receive")
           register_verify_after_each
-          expect_render_mock_proxy.should_receive(:render, :expected_from => caller(1)[0]).with(opts)
+          render_proxy.should_receive(:render, :expected_from => caller(1)[0]).with(opts)
         end
 
-        # This is exactly like expect_render, with the exception that the call to render will not
-        # be verified. Use this if you are trying to isolate your example from a complicated render
-        # operation but don't care whether it is called or not.
+        # DEPRECATED
+        #
+        # Use stub!(:render).with(opts) instead
         def stub_render(opts={})
+          warn_deprecation("stub_render", "stub!")
           register_verify_after_each
-          expect_render_mock_proxy.stub!(:render, :expected_from => caller(1)[0]).with(opts)
+          render_proxy.stub!(:render, :expected_from => caller(1)[0]).with(opts)
+        end
+        
+        def warn_deprecation(deprecated_method, new_method)
+          Kernel.warn <<-WARNING
+#{deprecated_method} is deprecated and will be removed from a future version of rspec-rails.
+
+Please just use object.#{new_method} instead.
+WARNING
         end
   
         def verify_rendered # :nodoc:
-          expect_render_mock_proxy.rspec_verify
+          render_proxy.rspec_verify
         end
   
         def unregister_verify_after_each #:nodoc:
@@ -65,7 +43,32 @@
           Spec::Example::ExampleGroup.remove_after(:each, &proc)
         end
 
-        protected
+        def should_receive(*args)
+          if args[0] == :render
+            register_verify_after_each
+            render_proxy.should_receive(:render, :expected_from => caller(1)[0])
+          else
+            super
+          end
+        end
+        
+        def should_not_receive(*args)
+          if args[0] == :render
+            register_verify_after_each
+            render_proxy.should_not_receive(:render)
+          else
+            super
+          end
+        end
+        
+        def stub!(*args)
+          if args[0] == :render
+            register_verify_after_each
+            render_proxy.stub!(:render, :expected_from => caller(1)[0])
+          else
+            super
+          end
+        end
 
         def verify_rendered_proc #:nodoc:
           template = self
@@ -80,8 +83,8 @@
           Spec::Example::ExampleGroup.after(:each, &proc)
         end
   
-        def expect_render_mock_proxy #:nodoc:
-          @expect_render_mock_proxy ||= Spec::Mocks::Mock.new("expect_render_mock_proxy")
+        def render_proxy #:nodoc:
+          @render_proxy ||= Spec::Mocks::Mock.new("render_proxy")
         end
   
       end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb Wed Dec 10 17:34:18 2008
@@ -32,7 +32,7 @@
           ensure_that_base_view_path_is_not_set_across_example_groups
         end
 
-        def initialize(defined_description, &implementation) #:nodoc:
+        def initialize(defined_description, options={}, &implementation) #:nodoc:
           super
           @controller_class_name = "Spec::Rails::Example::ViewExampleGroupController"
         end
@@ -63,7 +63,7 @@
 
         def derived_action_name(options) #:nodoc:
           parts = subject_of_render(options).split('/').reject { |part| part.empty? }
-          "#{parts.last}"
+          "#{parts.last}".split('.').first
         end
 
         def subject_of_render(options) #:nodoc:
@@ -103,11 +103,11 @@
           add_helpers(options)
 
           assigns[:action_name] = @action_name
-
-          @request.path_parameters = {
-          :controller => derived_controller_name(options),
-          :action => derived_action_name(options)
-          }
+          
+          @request.path_parameters = @request.path_parameters.merge(
+            :controller => derived_controller_name(options),
+            :action => derived_action_name(options)
+          ).merge(options[:path_parameters] || {})
 
           defaults = { :layout => false }
           options = defaults.merge options
@@ -150,7 +150,9 @@
 
         protected
         def _assigns_hash_proxy
-          @_assigns_hash_proxy ||= AssignsHashProxy.new @controller
+          @_assigns_hash_proxy ||= AssignsHashProxy.new self do
+            @response.template
+          end
         end
       end
 
@@ -172,6 +174,9 @@
             include helper_module
           end
         end
+        
+        def forget_variables_added_to_assigns
+        end
       end
     end
   end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb Wed Dec 10 17:34:18 2008
@@ -2,6 +2,8 @@
   class Base #:nodoc:
     include Spec::Rails::Example::RenderObserver
     cattr_accessor :base_view_path
+
+    alias_method :orig_render_partial, :render_partial
     def render_partial(partial_path, local_assigns = nil, deprecated_local_assigns = nil) #:nodoc:
       if partial_path.is_a?(String)
         unless partial_path.include?("/")
@@ -10,15 +12,19 @@
           end
         end
       end
-      super(partial_path, local_assigns, deprecated_local_assigns)
+      begin
+        orig_render_partial(partial_path, local_assigns, deprecated_local_assigns)
+      rescue ArgumentError # edge rails > 2.1 changed render_partial to accept only one arg
+        orig_render_partial(partial_path)
+      end
     end
 
     alias_method :orig_render, :render
     def render(options = {}, old_local_assigns = {}, &block)
-      if expect_render_mock_proxy.send(:__mock_proxy).send(:find_matching_expectation, :render, options)
-        expect_render_mock_proxy.render(options)
+      if render_proxy.send(:__mock_proxy).send(:find_matching_expectation, :render, options)
+        render_proxy.render(options)
       else
-        unless expect_render_mock_proxy.send(:__mock_proxy).send(:find_matching_method_stub, :render, options)
+        unless render_proxy.send(:__mock_proxy).send(:find_matching_method_stub, :render, options)
           orig_render(options, old_local_assigns, &block)
         end
       end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb Wed Dec 10 17:34:18 2008
@@ -1,8 +1,13 @@
 require 'spec/example/configuration'
+require 'test_help'
+
 begin
 module Spec
   module Example
     class Configuration
+      
+      TEST_CASE = ActiveSupport.const_defined?(:TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase
+      
       # Rails 1.2.3 does a copy of the @inheritable_attributes to the subclass when the subclass is
       # created. This causes an ordering issue when setting state on Configuration because the data is
       # already copied.
@@ -10,7 +15,7 @@
       # @inheritable_attributes updated.
       # TODO: BT - When we no longer support Rails 1.2.3, we can remove this functionality
       EXAMPLE_GROUP_CLASSES = [
-        ::Test::Unit::TestCase,
+        TEST_CASE,
         ::Spec::Rails::Example::RailsExampleGroup,
         ::Spec::Rails::Example::FunctionalExampleGroup,
         ::Spec::Rails::Example::ControllerExampleGroup,
@@ -26,7 +31,7 @@
         end
 
         def use_transactional_fixtures
-          Test::Unit::TestCase.use_transactional_fixtures
+          TEST_CASE.use_transactional_fixtures
         end
         def use_transactional_fixtures=(value)
           EXAMPLE_GROUP_CLASSES.each do |example_group|
@@ -35,7 +40,7 @@
         end
 
         def use_instantiated_fixtures
-          Test::Unit::TestCase.use_instantiated_fixtures
+          TEST_CASE.use_instantiated_fixtures
         end
         def use_instantiated_fixtures=(value)
           EXAMPLE_GROUP_CLASSES.each do |example_group|
@@ -44,7 +49,7 @@
         end
 
         def fixture_path
-          Test::Unit::TestCase.fixture_path
+          TEST_CASE.fixture_path
         end
         def fixture_path=(path)
           EXAMPLE_GROUP_CLASSES.each do |example_group|
@@ -53,7 +58,7 @@
         end
 
         def global_fixtures
-          ::Test::Unit::TestCase.fixture_table_names
+          TEST_CASE.fixture_table_names
         end
         def global_fixtures=(fixtures)
           EXAMPLE_GROUP_CLASSES.each do |example_group|

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb Wed Dec 10 17:34:18 2008
@@ -5,8 +5,8 @@
     class Have #:nodoc:
       alias_method :__original_failure_message, :failure_message
       def failure_message
-        return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@actual}" if @collection_name == :errors_on
-        return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@actual}" if @collection_name == :error_on
+        return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@given}" if @collection_name == :errors_on
+        return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@given}" if @collection_name == :error_on
         return __original_failure_message
       end
       

Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,14 @@
+module Test
+  module Unit
+    class TestCase
+      # Edge rails (r8664) introduces class-wide setup & teardown callbacks for Test::Unit::TestCase.
+      # Make sure these still get run when running TestCases under rspec:
+      prepend_before(:each) do
+        run_callbacks :setup if respond_to?(:run_callbacks)
+      end
+      append_after(:each) do
+        run_callbacks :teardown if respond_to?(:run_callbacks)
+      end
+    end
+  end
+end
\ No newline at end of file

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers.rb Wed Dec 10 17:34:18 2008
@@ -1,5 +1,6 @@
 dir = File.dirname(__FILE__)
 require 'spec/rails/matchers/assert_select'
+require 'spec/rails/matchers/change'
 require 'spec/rails/matchers/have_text'
 require 'spec/rails/matchers/include_text'
 require 'spec/rails/matchers/redirect_to'

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/assert_select.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/assert_select.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/assert_select.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/assert_select.rb Wed Dec 10 17:34:18 2008
@@ -16,6 +16,7 @@
         def matches?(response_or_text, &block)
           if ActionController::TestResponse === response_or_text and
                    response_or_text.headers.key?('Content-Type') and
+                   !response_or_text.headers['Content-Type'].blank? and
                    response_or_text.headers['Content-Type'].to_sym == :xml
             @args.unshift(HTML::Document.new(response_or_text.body, false, true).root)           
           elsif String === response_or_text

Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,11 @@
+module Spec
+  module Matchers
+    class Change
+      def evaluate_value_proc_with_ensured_evaluation_of_proxy
+        value = evaluate_value_proc_without_ensured_evaluation_of_proxy
+        ActiveRecord::Associations::AssociationProxy === value ? value.dup : value
+      end
+      alias_method_chain :evaluate_value_proc, :ensured_evaluation_of_proxy
+    end
+  end
+end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb Wed Dec 10 17:34:18 2008
@@ -10,10 +10,18 @@
         end
       
         def matches?(response)
-          @actual = response.rendered_file
-          full_path(@actual) == full_path(@expected)
+          
+          if response.respond_to?(:rendered_file)
+            @actual = response.rendered_file
+          else
+            @actual = response.rendered_template.to_s
+          end
+          return false if @actual.blank?
+          given_controller_path, given_file = path_and_file(@actual)
+          expected_controller_path, expected_file = path_and_file(@expected)
+          given_controller_path == expected_controller_path && given_file.match(expected_file)
         end
-
+        
         def failure_message
           "expected #{@expected.inspect}, got #{@actual.inspect}"
         end
@@ -27,22 +35,43 @@
         end
       
         private
-          def full_path(path)
-            return nil if path.nil?
-            path.include?('/') ? path : "#{@controller.class.to_s.underscore.gsub('_controller','')}/#{path}"
+          def path_and_file(path)
+            parts = path.split('/')
+            file = parts.pop
+            controller = parts.empty? ? current_controller_path : parts.join('/')
+            return controller, file
           end
         
-      end
+          def controller_path_from(path)
+            parts = path.split('/')
+            parts.pop
+            parts.join('/')
+          end
 
+          def current_controller_path
+            @controller.class.to_s.underscore.gsub(/_controller$/,'')
+          end
+        
+      end
+      
       # :call-seq:
-      #   response.should render_template(path)
-      #   response.should_not render_template(path)
+      #   response.should render_template(template)
+      #   response.should_not render_template(template)
       #
-      # Passes if the specified template is rendered by the response.
-      # Useful in controller specs (integration or isolation mode).
+      # For use in controller code examples (integration or isolation mode).
       #
-      # <code>path</code> can include the controller path or not. It
-      # can also include an optional extension (no extension assumes .rhtml).
+      # Passes if the specified template (view file) is rendered by the
+      # response. This file can be any view file, including a partial. However
+      # if it is a partial it must be rendered directly i.e. you can't detect
+      # that a partial has been rendered as part of a view using
+      # render_template. For that you should use a message expectation
+      # (mock) instead:
+      #
+      #   controller.should_receive(:render).with(:partial => 'path/to/partial')
+      #
+      # <code>template</code> can include the controller path. It can also
+      # include an optional extension, which you only need to use when there
+      # is ambiguity.
       #
       # Note that partials must be spelled with the preceding underscore.
       #
@@ -52,12 +81,13 @@
       #   response.should render_template('same_controller/list')
       #   response.should render_template('other_controller/list')
       #
-      #   #rjs
+      #   # with extensions
       #   response.should render_template('list.rjs')
+      #   response.should render_template('list.haml')
       #   response.should render_template('same_controller/list.rjs')
       #   response.should render_template('other_controller/list.rjs')
       #
-      #   #partials
+      #   # partials
       #   response.should render_template('_a_partial')
       #   response.should render_template('same_controller/_a_partial')
       #   response.should render_template('other_controller/_a_partial')

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb Wed Dec 10 17:34:18 2008
@@ -9,15 +9,21 @@
       # methods stubbed out. Additional methods may be easily stubbed (via
       # add_stubs) if +stubs+ is passed.
       def mock_model(model_class, options_and_stubs = {})
-        id = next_id
-        options_and_stubs.reverse_merge!({
+        id = options_and_stubs[:id] || next_id
+        options_and_stubs = options_and_stubs.reverse_merge({
           :id => id,
           :to_param => id.to_s,
           :new_record? => false,
           :errors => stub("errors", :count => 0)
         })
-        m = mock("#{model_class.name}_#{options_and_stubs[:id]}", options_and_stubs)
+        m = mock("#{model_class.name}_#{id}", options_and_stubs)
         m.send(:__mock_proxy).instance_eval <<-CODE
+          def @target.as_new_record
+            self.stub!(:id).and_return nil
+            self.stub!(:to_param).and_return nil
+            self.stub!(:new_record?).and_return true
+            self
+          end
           def @target.is_a?(other)
             #{model_class}.ancestors.include?(other)
           end
@@ -52,24 +58,33 @@
       #   stub_model(Model)
       #   stub_model(Model).as_new_record
       #   stub_model(Model, hash_of_stubs)
+      #   stub_model(Model, instance_variable_name, hash_of_stubs)
       #
       # Creates an instance of +Model+ that is prohibited from accessing the
-      # database. For each key in +hash_of_stubs+, if the model has a
-      # matching attribute (determined by asking it, which it answers based
-      # on schema.rb) are simply assigned the submitted values. If the model
-      # does not have a matching attribute, the key/value pair is assigned
-      # as a stub return value using RSpec's mocking/stubbing framework.
-      #
-      # new_record? is overridden to return the result of id.nil? This means
-      # that by default new_record? will return false. If  you want the
-      # object to behave as a new record, sending it +as_new_record+ will
+      # database*. For each key in +hash_of_stubs+, if the model has a
+      # matching attribute (determined by asking it) are simply assigned the
+      # submitted values. If the model does not have a matching attribute, the
+      # key/value pair is assigned as a stub return value using RSpec's
+      # mocking/stubbing framework.
+      #
+      # <tt>new_record?</tt> is overridden to return the result of id.nil?
+      # This means that by default new_record? will return false. If  you want
+      # the object to behave as a new record, sending it +as_new_record+ will
       # set the id to nil. You can also explicitly set :id => nil, in which
-      # case new_record? will return true, but using +as_new_record+ makes
-      # the example a bit more descriptive.
+      # case new_record? will return true, but using +as_new_record+ makes the
+      # example a bit more descriptive.
+      #
+      # While you can use stub_model in any example (model, view, controller,
+      # helper), it is especially useful in view examples, which are
+      # inherently more state-based than interaction-based.
+      #
+      # == Database Independence
       #
-      # While you can use stub_model in any example (model, view,
-      # controller, helper), it is especially useful in view examples,
-      # which are inherently more state-based than interaction-based.
+      # +stub_model+ does not make your examples entirely
+      # database-independent. It does not stop the model class itself from
+      # loading up its columns from the database. It just prevents data access
+      # from the object itself. To completely decouple from the database, take
+      # a look at libraries like unit_record or NullDB.
       #
       # == Examples
       #
@@ -77,9 +92,9 @@
       #   stub_model(Person).as_new_record
       #   stub_model(Person, :id => 37)
       #   stub_model(Person) do |person|
-      #     model.first_name = "David"
+      #     person.first_name = "David"
       #   end
-      def stub_model(model_class, stubs = {})
+      def stub_model(model_class, stubs={})
         stubs = {:id => next_id}.merge(stubs)
         returning model_class.new do |model|
           model.id = stubs.delete(:id)
@@ -99,7 +114,7 @@
       # - object.stub!(:method => return_value, :method2 => return_value2, :etc => etc)
       #++
       # Stubs methods on +object+ (if +object+ is a symbol or string a new mock
-      # with that name will be created). +stubs+ is a Hash of <tt>method=>value</tt>
+      # with that name will be created). +stubs+ is a Hash of +method=>value+
       def add_stubs(object, stubs = {}) #:nodoc:
         m = [String, Symbol].index(object.class) ? mock(object.to_s) : object
         stubs.each {|k,v| m.stub!(k).and_return(v)}
@@ -114,4 +129,4 @@
 
     end
   end
-end
\ No newline at end of file
+end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb Wed Dec 10 17:34:18 2008
@@ -40,15 +40,23 @@
   include Singleton
   def scenario_started(*args)
     if defined?(ActiveRecord::Base)
-      ActiveRecord::Base.send :increment_open_transactions unless Rails::VERSION::STRING == "1.1.6"
-      ActiveRecord::Base.connection.begin_db_transaction
+      if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
+        ActiveRecord::Base.connection.increment_open_transactions
+      else
+        ActiveRecord::Base.send :increment_open_transactions
+      end
     end
+    ActiveRecord::Base.connection.begin_db_transaction
   end
 
   def scenario_succeeded(*args)
     if defined?(ActiveRecord::Base)
       ActiveRecord::Base.connection.rollback_db_transaction
-      ActiveRecord::Base.send :decrement_open_transactions unless Rails::VERSION::STRING == "1.1.6"
+      if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
+        ActiveRecord::Base.connection.decrement_open_transactions
+      else
+        ActiveRecord::Base.send :decrement_open_transactions
+      end
     end
   end
   alias :scenario_pending :scenario_succeeded

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/version.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/version.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/version.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/lib/spec/rails/version.rb Wed Dec 10 17:34:18 2008
@@ -1,23 +1,16 @@
-module Spec
-  module Rails
-    module VERSION #:nodoc:
-      BUILD_TIME_UTC = 20080615141040
-    end
-  end
-end
-
-# Verify that the plugin has the same revision as RSpec
-if Spec::Rails::VERSION::BUILD_TIME_UTC != Spec::VERSION::BUILD_TIME_UTC
-  raise <<-EOF
-
-############################################################################
-Your RSpec on Rails plugin is incompatible with your installed RSpec.
-
-RSpec          : #{Spec::VERSION::BUILD_TIME_UTC}
-RSpec on Rails : #{Spec::Rails::VERSION::BUILD_TIME_UTC}
-
-Make sure your RSpec on Rails plugin is compatible with your RSpec gem.
-See http://rspec.rubyforge.org/documentation/rails/install.html for details.
-############################################################################
-EOF
-end
+module Spec
+  module Rails
+    module VERSION #:nodoc:
+      unless defined? MAJOR
+        MAJOR  = 1
+        MINOR  = 1
+        TINY   = 11
+        MINESCULE = 1
+
+        STRING = [MAJOR, MINOR, TINY, MINESCULE].join('.')
+
+        SUMMARY = "rspec-rails #{STRING}"
+      end
+    end
+  end
+end
\ No newline at end of file

Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/rspec-rails.gemspec
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/rspec-rails.gemspec?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/rspec-rails.gemspec (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/rspec-rails.gemspec Wed Dec 10 17:34:18 2008
@@ -0,0 +1,35 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+  s.name = %q{rspec-rails}
+  s.version = "1.1.11.1"
+
+  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+  s.authors = ["RSpec Development Team"]
+  s.date = %q{2008-11-24}
+  s.description = %q{Behaviour Driven Development for Ruby on Rails.}
+  s.email = ["rspec-devel@rubyforge.org"]
+  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "generators/rspec/templates/previous_failures.txt"]
+  s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "UPGRADE", "generators/rspec/CHANGES", "generators/rspec/rspec_generator.rb", "generators/rspec/templates/all_stories.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/script/spec_server", "generators/rspec/templates/spec.opts", "generators/rspec/templates/spec_helper.rb", "generators/rspec/templates/stories_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_gene
 rator.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/model_example_group.rb", "lib/spec/rails/example/rails_example_group.rb", "lib/spec/rai
 ls/example/render_observer.rb", "lib/spec/rails/example/view_example_group.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/extensions/action_controller/rescue.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/object.rb", "lib/spec/rails/extensions/spec/example/configuration.rb", "lib/spec/rails/extensions/spec/matchers/have.rb", "lib/spec/rails/interop/testcase.rb", "lib/spec/rails/matchers.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/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/version.rb", "rspec-rails.gemspec", "spec/rails/autote
 st/mappings_spec.rb", "spec/rails/example/assigns_hash_proxy_spec.rb", "spec/rails/example/configuration_spec.rb", "spec/rails/example/controller_isolation_spec.rb", "spec/rails/example/controller_spec_spec.rb", "spec/rails/example/cookies_proxy_spec.rb", "spec/rails/example/example_group_factory_spec.rb", "spec/rails/example/helper_spec_spec.rb", "spec/rails/example/model_spec_spec.rb", "spec/rails/example/shared_behaviour_spec.rb", "spec/rails/example/test_unit_assertion_accessibility_spec.rb", "spec/rails/example/view_spec_spec.rb", "spec/rails/extensions/action_controller_rescue_action_spec.rb", "spec/rails/extensions/action_view_base_spec.rb", "spec/rails/extensions/active_record_spec.rb", "spec/rails/interop/testcase_spec.rb", "spec/rails/matchers/assert_select_spec.rb", "spec/rails/matchers/description_generation_spec.rb", "spec/rails/matchers/errors_on_spec.rb", "spec/rails/matchers/have_text_spec.rb", "spec/rails/matchers/include_text_spec.rb", "spec/rails/matchers/
 redirect_to_spec.rb", "spec/rails/matchers/render_template_spec.rb", "spec/rails/matchers/should_change_spec.rb", "spec/rails/mocks/ar_classes.rb", "spec/rails/mocks/mock_model_spec.rb", "spec/rails/mocks/stub_model_spec.rb", "spec/rails/sample_modified_fixture.rb", "spec/rails/sample_spec.rb", "spec/rails/spec_server_spec.rb", "spec/rails/spec_spec.rb", "spec/rails_suite.rb", "spec/resources/controllers/action_view_base_spec_controller.rb", "spec/resources/controllers/controller_spec_controller.rb", "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/views/controller_spec/_partial.rhtml", "spec/resources/view
 s/controller_spec/action_setting_flash_after_session_reset.rhtml", "spec/resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml", "spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml", "spec/resources/views/controller_spec/action_with_errors_in_template.rhtml", "spec/resources/views/controller_spec/action_with_template.rhtml", "spec/resources/views/layouts/application.rhtml", "spec/resources/views/layouts/simple.rhtml", "spec/resources/views/objects/_object.html.erb", "spec/resources/views/render_spec/_a_partial.rhtml", "spec/resources/views/render_spec/action_with_alternate_layout.rhtml", "spec/resources/views/render_spec/some_action.js.rjs", "spec/resources/views/render_spec/some_action.rhtml", "spec/resources/views/render_spec/some_action.rjs", "spec/resources/views/rjs_spec/_replacement_partial.rhtml", "spec/resources/views/rjs_spec/hide_div.rjs", "spec/resources/views/rjs_spec/hide_page_element.rjs", "spec/resources/views/
 rjs_spec/insert_html.rjs", "spec/resources/views/rjs_spec/replace.rjs", "spec/resources/views/rjs_spec/replace_html.rjs", "spec/resources/views/rjs_spec/replace_html_with_partial.rjs", "spec/resources/views/rjs_spec/visual_effect.rjs", "spec/resources/views/rjs_spec/visual_toggle_effect.rjs", "spec/resources/views/tag_spec/no_tags.rhtml", "spec/resources/views/tag_spec/single_div_with_no_attributes.rhtml", "spec/resources/views/tag_spec/single_div_with_one_attribute.rhtml", "spec/resources/views/view_spec/_partial.rhtml", "spec/resources/views/view_spec/_partial_used_twice.rhtml", "spec/resources/views/view_spec/_partial_with_local_variable.rhtml", "spec/resources/views/view_spec/_partial_with_sub_partial.rhtml", "spec/resources/views/view_spec/_spacer.rhtml", "spec/resources/views/view_spec/accessor.rhtml", "spec/resources/views/view_spec/block_helper.rhtml", "spec/resources/views/view_spec/entry_form.rhtml", "spec/resources/views/view_spec/explicit_helper.rhtml", "spec/res
 ources/views/view_spec/foo/show.rhtml", "spec/resources/views/view_spec/implicit_helper.rhtml", "spec/resources/views/view_spec/multiple_helpers.rhtml", "spec/resources/views/view_spec/should_not_receive.rhtml", "spec/resources/views/view_spec/template_with_partial.rhtml", "spec/resources/views/view_spec/template_with_partial_using_collection.rhtml", "spec/resources/views/view_spec/template_with_partial_with_array.rhtml", "spec/spec_helper.rb", "stories/all.rb", "stories/configuration/stories.rb", "stories/helper.rb", "stories/steps/people.rb", "stories/transactions_should_rollback", "stories/transactions_should_rollback.rb"]
+  s.has_rdoc = true
+  s.homepage = %q{http://rspec.info/}
+  s.rdoc_options = ["--main", "README.txt"]
+  s.require_paths = ["lib"]
+  s.rubyforge_project = %q{rspec}
+  s.rubygems_version = %q{1.3.1}
+  s.summary = %q{rspec-rails 1.1.11.1}
+
+  if s.respond_to? :specification_version then
+    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+    s.specification_version = 2
+
+    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+      s.add_runtime_dependency(%q<rspec>, ["= 1.1.11.1"])
+      s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
+    else
+      s.add_dependency(%q<rspec>, ["= 1.1.11.1"])
+    end
+  else
+    s.add_dependency(%q<rspec>, ["= 1.1.11.1"])
+  end
+end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb Wed Dec 10 17:34:18 2008
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 require File.join(File.dirname(__FILE__), *%w[.. .. .. lib autotest rails_rspec])
-require File.join(File.dirname(__FILE__), *%w[.. .. .. .. rspec spec autotest_matchers])
+require File.join(File.dirname(__FILE__), *%w[.. .. .. .. rspec spec autotest autotest_matchers])
 
 describe Autotest::RailsRspec, "file mapping" do
   before(:each) do

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb Wed Dec 10 17:34:18 2008
@@ -1,31 +1,51 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
 describe "AssignsHashProxy" do
+  def orig_assigns
+    @object.assigns
+  end
+  
   before(:each) do
-    @object = Object.new
-    @assigns = Hash.new
-    @object.stub!(:assigns).and_return(@assigns)
-    @proxy = Spec::Rails::Example::AssignsHashProxy.new(@object)
+    @object = Class.new do
+      attr_accessor :assigns
+    end.new
+    @object.assigns = Hash.new
+    @proxy = Spec::Rails::Example::AssignsHashProxy.new self do
+      @object
+    end
   end
-
-  it "has [] accessor" do
+  
+  it "should set ivars on object using string" do
     @proxy['foo'] = 'bar'
-    @assigns['foo'].should == 'bar'
+    @object.instance_eval{@foo}.should == 'bar'
+  end
+  
+  it "should set ivars on object using symbol" do
+    @proxy[:foo] = 'bar'
+    @object.instance_eval{@foo}.should == 'bar'
+  end
+  
+  it "should access object's assigns with a string" do
+    @object.assigns['foo'] = 'bar'
     @proxy['foo'].should == 'bar'
   end
-
-  it "works for symbol key" do
-    @assigns[:foo] = 2
-    @proxy[:foo].should == 2
+  
+  it "should access object's assigns with a symbol" do
+    @object.assigns['foo'] = 'bar'
+    @proxy[:foo].should == 'bar'
   end
 
-  it "checks for string key before symbol key" do
-    @assigns['foo'] = false
-    @assigns[:foo] = 2
-    @proxy[:foo].should == false
+  it "should access object's ivars with a string" do
+    @object.instance_variable_set('@foo', 'bar')
+    @proxy['foo'].should == 'bar'
+  end
+  
+  it "should access object's ivars with a symbol" do
+    @object.instance_variable_set('@foo', 'bar')
+    @proxy[:foo].should == 'bar'
   end
 
-  it "each method iterates through each element like a Hash" do
+  it "should iterate through each element like a Hash" do
     values = {
       'foo' => 1,
       'bar' => 2,
@@ -34,27 +54,43 @@
     @proxy['foo'] = values['foo']
     @proxy['bar'] = values['bar']
     @proxy['baz'] = values['baz']
-
+  
     @proxy.each do |key, value|
       key.should == key
       value.should == values[key]
     end
   end
-
-  it "delete method deletes the element of passed in key" do
-    @proxy['foo'] = 'bar'
-    @proxy.delete('foo').should == 'bar'
+  
+  it "should delete the ivar of passed in key" do
+    @object.instance_variable_set('@foo', 'bar')
+    @proxy.delete('foo')
     @proxy['foo'].should be_nil
   end
-
-  it "has_key? detects the presence of a key" do
-    @proxy['foo'] = 'bar'
+  
+  it "should delete the assigned element of passed in key" do
+    @object.assigns['foo'] = 'bar'
+    @proxy.delete('foo')
+    @proxy['foo'].should be_nil
+  end
+  
+  it "should detect the presence of a key in assigns" do
+    @object.assigns['foo'] = 'bar'
     @proxy.has_key?('foo').should == true
     @proxy.has_key?('bar').should == false
   end
   
-  it "should sets an instance var" do
-    @proxy['foo'] = 'bar'
-    @object.instance_eval { @foo }.should == 'bar'
+  it "should expose values set in example back to the example" do
+    @proxy[:foo] = 'bar'
+    @proxy[:foo].should == 'bar'
+  end
+  
+  it "should allow assignment of false via proxy" do
+    @proxy['foo'] = false
+    @proxy['foo'].should be_false
+  end
+  
+  it "should allow assignment of false" do
+    @object.instance_variable_set('@foo',false)
+    @proxy['foo'].should be_false
   end
 end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb Wed Dec 10 17:34:18 2008
@@ -2,82 +2,78 @@
 
 module Spec
   module Example
-    describe Configuration, :shared => true do
-      before(:each) { @config = Configuration.new }
-    end
-
-    describe Configuration, "#use_transactional_fixtures" do
-      it_should_behave_like "Spec::Example::Configuration"
+    describe Configuration do
 
-      it "should return Test::Unit::TestCase.use_transactional_fixtures" do
-        @config.use_transactional_fixtures.should == Test::Unit::TestCase.use_transactional_fixtures
+      def config
+        @config ||= Configuration.new
       end
 
-      it "should set Test::Unit::TestCase.use_transactional_fixtures to false" do
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.should_receive(:use_transactional_fixtures=).with(false)
+      describe "#use_transactional_fixtures" do
+        it "should return #{Spec::Example::Configuration::TEST_CASE}.use_transactional_fixtures" do
+          config.use_transactional_fixtures.should == Spec::Example::Configuration::TEST_CASE.use_transactional_fixtures
         end
-        @config.use_transactional_fixtures = false
-      end
 
-      it "should set Test::Unit::TestCase.use_transactional_fixtures to true" do
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.should_receive(:use_transactional_fixtures=).with(true)
+        it "should set #{Spec::Example::Configuration::TEST_CASE}.use_transactional_fixtures to false" do
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.should_receive(:use_transactional_fixtures=).with(false)
+          end
+          config.use_transactional_fixtures = false
         end
-        @config.use_transactional_fixtures = true
-      end
-    end
-
-    describe Configuration, "#use_instantiated_fixtures" do
-      it_should_behave_like "Spec::Example::Configuration"
-
-      it "should return Test::Unit::TestCase.use_transactional_fixtures" do
-        @config.use_instantiated_fixtures.should == Test::Unit::TestCase.use_instantiated_fixtures
-      end
 
-      it "should set Test::Unit::TestCase.use_instantiated_fixtures to false" do
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.should_receive(:use_instantiated_fixtures=).with(false)
+        it "should set #{Spec::Example::Configuration::TEST_CASE}.use_transactional_fixtures to true" do
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.should_receive(:use_transactional_fixtures=).with(true)
+          end
+          config.use_transactional_fixtures = true
         end
-        @config.use_instantiated_fixtures = false
       end
 
-      it "should set Test::Unit::TestCase.use_instantiated_fixtures to true" do
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.should_receive(:use_instantiated_fixtures=).with(true)
+      describe "#use_instantiated_fixtures" do
+        it "should return #{Spec::Example::Configuration::TEST_CASE}.use_transactional_fixtures" do
+          config.use_instantiated_fixtures.should == Spec::Example::Configuration::TEST_CASE.use_instantiated_fixtures
         end
-        @config.use_instantiated_fixtures = true
-      end
-    end
 
-    describe Configuration, "#fixture_path" do
-      it_should_behave_like "Spec::Example::Configuration"
+        it "should set #{Spec::Example::Configuration::TEST_CASE}.use_instantiated_fixtures to false" do
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.should_receive(:use_instantiated_fixtures=).with(false)
+          end
+          config.use_instantiated_fixtures = false
+        end
 
-      it "should default to RAILS_ROOT + '/spec/fixtures'" do
-        @config.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
+        it "should set #{Spec::Example::Configuration::TEST_CASE}.use_instantiated_fixtures to true" do
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.should_receive(:use_instantiated_fixtures=).with(true)
+          end
+          config.use_instantiated_fixtures = true
         end
       end
 
-      it "should set fixture_path" do
-        @config.fixture_path = "/new/path"
-        @config.fixture_path.should == "/new/path"
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.fixture_path.should == "/new/path"
+      describe "#fixture_path" do
+        it "should default to RAILS_ROOT + '/spec/fixtures'" do
+          config.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.fixture_path.should == RAILS_ROOT + '/spec/fixtures'
+          end
         end
-      end
-    end
 
-    describe Configuration, "#global_fixtures" do
-      it_should_behave_like "Spec::Example::Configuration"
+        it "should set fixture_path" do
+          config.fixture_path = "/new/path"
+          config.fixture_path.should == "/new/path"
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.fixture_path.should == "/new/path"
+          end
+        end
+      end
 
-      it "should set fixtures on TestCase" do
-        Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
-          example_group.should_receive(:fixtures).with(:blah)
+      describe "#global_fixtures" do
+        it "should set fixtures on TestCase" do
+          Configuration::EXAMPLE_GROUP_CLASSES.each do |example_group|
+            example_group.should_receive(:fixtures).with(:blah)
+          end
+          config.global_fixtures = [:blah]
         end
-        @config.global_fixtures = [:blah]
       end
+      
     end
   end
 end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb Wed Dec 10 17:34:18 2008
@@ -5,7 +5,9 @@
   describe "A controller example running in #{mode} mode", :type => :controller do
     controller_name :controller_spec
     integrate_views if mode == 'integration'
-  
+    
+    specify "this example should be pending, not an error"
+    
     it "should provide controller.session as session" do
       get 'action_with_template'
       session.should equal(controller.session)
@@ -38,24 +40,24 @@
       response.should render_template("_partial")
     end
     
-    it "should allow specifying a partial with expect_render" do
-      controller.expect_render(:partial => "controller_spec/partial")
+    it "should allow specifying a partial with should_receive(:render)" do
+      controller.should_receive(:render).with(:partial => "controller_spec/partial")
       get 'action_with_partial'
     end
     
-    it "should allow specifying a partial with expect_render with object" do
-      controller.expect_render(:partial => "controller_spec/partial", :object => "something")
+    it "should allow specifying a partial with should_receive(:render) with object" do
+      controller.should_receive(:render).with(:partial => "controller_spec/partial", :object => "something")
       get 'action_with_partial_with_object', :thing => "something"
     end
     
-    it "should allow specifying a partial with expect_render with locals" do
-      controller.expect_render(:partial => "controller_spec/partial", :locals => {:thing => "something"})
+    it "should allow specifying a partial with should_receive(:render) with locals" do
+      controller.should_receive(:render).with(:partial => "controller_spec/partial", :locals => {:thing => "something"})
       get 'action_with_partial_with_locals', :thing => "something"
     end
     
     it "should yield to render :update" do
       template = stub("template")
-      controller.expect_render(:update).and_yield(template)
+      controller.should_receive(:render).with(:update).and_yield(template)
       template.should_receive(:replace).with(:bottom, "replace_me", :partial => "non_existent_partial")
       get 'action_with_render_update'
     end
@@ -87,6 +89,71 @@
       end.should_not raise_error
     end
 
+    describe "handling should_receive(:render)" do
+      it "should warn" do
+        controller.should_receive(:render).with(:template => "controller_spec/action_with_template")
+        get :action_with_template
+      end
+    end
+    
+    describe "handling should_not_receive(:render)" do
+      it "should warn" do
+        controller.should_not_receive(:render).with(:template => "the/wrong/template")
+        get :action_with_template
+      end
+    end
+    
+    describe "handling deprecated expect_render" do
+      it "should warn" do
+        Kernel.should_receive(:warn).with(/expect_render is deprecated/)
+        controller.expect_render(:template => "controller_spec/action_with_template")
+        get :action_with_template
+      end
+    end
+    
+    describe "handling deprecated stub_render" do
+      it "should warn" do
+        Kernel.should_receive(:warn).with(/stub_render is deprecated/)
+        controller.stub_render(:template => "controller_spec/action_with_template")
+        get :action_with_template
+      end
+    end
+    
+    describe "setting cookies in the request" do
+    
+      it "should support a String key" do
+        cookies['cookie_key'] = 'cookie value'
+        get 'action_which_gets_cookie', :expected => "cookie value"
+      end
+
+      it "should support a Symbol key" do
+        cookies[:cookie_key] = 'cookie value'
+        get 'action_which_gets_cookie', :expected => "cookie value"
+      end
+      
+      if Rails::VERSION::STRING >= "2.0.0"
+        it "should support a Hash value" do
+          cookies[:cookie_key] = {'value' => 'cookie value', 'path' => '/not/default'}
+          get 'action_which_gets_cookie', :expected => {'value' => 'cookie value', 'path' => '/not/default'}
+        end
+      end
+      
+    end
+  
+    describe "reading cookies from the response" do
+  
+      it "should support a Symbol key" do
+        get 'action_which_sets_cookie', :value => "cookie value"
+        cookies[:cookie_key].value.should == ["cookie value"]
+      end
+
+      it "should support a String key" do
+        get 'action_which_sets_cookie', :value => "cookie value"
+        cookies['cookie_key'].value.should == ["cookie value"]
+      end
+    
+    end
+
     it "should support custom routes" do
       route_for(:controller => "custom_route_spec", :action => "custom_route").should == "/custom_route"
     end
@@ -108,22 +175,9 @@
       assigns[:indirect_assigns_key].should == :indirect_assigns_key_value
     end
     
-    it "should expose the assigns hash directly" do
-      get 'action_setting_the_assigns_hash'
-      assigns[:direct_assigns_key].should == :direct_assigns_key_value
-    end
-    
-    it "should complain when calling should_receive(:render) on the controller" do
-      lambda {
-        controller.should_receive(:render)
-      }.should raise_error(RuntimeError, /should_receive\(:render\) has been disabled/)
-    end
-
-    it "should complain when calling stub!(:render) on the controller" do
-      controller.extend Spec::Mocks::Methods
-      lambda {
-        controller.stub!(:render)
-      }.should raise_error(RuntimeError, /stub!\(:render\) has been disabled/)
+    it "should expose instance vars through the assigns hash that are set to false" do
+      get 'action_that_assigns_false_to_a_variable'
+      assigns[:a_variable].should be_false
     end
     
     it "should NOT complain when calling should_receive with arguments other than :render" do
@@ -132,6 +186,12 @@
         controller.rspec_verify
       }.should raise_error(Exception, /expected :anything_besides_render/)
     end
+    
+    it "should not run a skipped before_filter" do
+      lambda {
+        get 'action_with_skipped_before_filter'
+      }.should_not raise_error
+    end
   end
 
   describe "Given a controller spec for RedirectSpecController running in #{mode} mode", :type => :controller do
@@ -172,6 +232,19 @@
   
 end
 
+['integration', 'isolation'].each do |mode|
+  describe "A controller example running in #{mode} mode", :type => :controller do
+    controller_name :controller_inheriting_from_application_controller
+    integrate_views if mode == 'integration'
+    
+    it "should only have a before filter inherited from ApplicationController run once..." do
+      controller.should_receive(:i_should_only_be_run_once).once
+      get :action_with_inherited_before_filter
+    end
+  end
+end
+
+
 describe ControllerSpecController, :type => :controller do
   it "should not require naming the controller if describe is passed a type" do
   end  

Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,74 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+class CookiesProxyExamplesController < ActionController::Base
+  def index
+    cookies[:key] = cookies[:key]
+  end
+end
+
+module Spec
+  module Rails
+    module Example
+      describe CookiesProxy, :type => :controller do
+        controller_name :cookies_proxy_examples
+      
+        describe "with a String key" do
+        
+          it "should accept a String value" do
+            cookies = CookiesProxy.new(self)
+            cookies['key'] = 'value'
+            get :index
+            cookies['key'].should == ['value']
+          end
+          
+          if Rails::VERSION::STRING >= "2.0.0"
+            it "should accept a Hash value" do
+              cookies = CookiesProxy.new(self)
+              cookies['key'] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' }
+              get :index
+              cookies['key'].should == ['value']
+              cookies['key'].value.should == ['value']
+              cookies['key'].expires.should == expiration
+              cookies['key'].path.should == path
+            end
+          end
+            
+        end
+      
+        describe "with a Symbol key" do
+        
+          it "should accept a String value" do
+            example_cookies = CookiesProxy.new(self)
+            example_cookies[:key] = 'value'
+            get :index
+            example_cookies[:key].should == ['value']
+          end
+
+          if Rails::VERSION::STRING >= "2.0.0"
+            it "should accept a Hash value" do
+              example_cookies = CookiesProxy.new(self)
+              example_cookies[:key] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' }
+              get :index
+              example_cookies[:key].should == ['value']
+              example_cookies[:key].value.should == ['value']
+              example_cookies[:key].expires.should == expiration
+              example_cookies[:key].path.should == path
+            end
+          end
+
+        end
+    
+        describe "#delete" do
+          it "should delete from the response cookies" do
+            example_cookies = CookiesProxy.new(self)
+            response_cookies = mock('cookies')
+            response.should_receive(:cookies).and_return(response_cookies)
+            response_cookies.should_receive(:delete).with('key')
+            example_cookies.delete :key
+          end
+        end
+      end
+    
+    end
+  end
+end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb Wed Dec 10 17:34:18 2008
@@ -130,6 +130,19 @@
           helper.protect_against_forgery?.should be_false
         end
       end
+      
+      describe HelperExampleGroup, "#assigns", :type => :helper do
+        helper_name :addition
+        it "should expose variables to helper" do
+          assigns[:addend] = 3
+          helper.plus(4).should == 7
+        end
+
+        it "should make helper ivars available in example" do
+          assigns[:addend] = 3
+          assigns[:addend].should == 3
+        end
+      end
     end
   end
 end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb Wed Dec 10 17:34:18 2008
@@ -82,14 +82,14 @@
     response.should have_tag('div', "This is text from a method in the ApplicationHelper")
   end
   
-  it "should pass expect_render with the right partial" do
-    template.expect_render(:partial => 'partial')
+  it "should pass should_receive(:render) with the right partial" do
+    template.should_receive(:render).with(:partial => 'partial')
     render!
     template.verify_rendered
   end
   
-  it "should fail expect_render with the wrong partial" do
-    template.expect_render(:partial => 'non_existent')
+  it "should fail should_receive(:render) with the wrong partial" do
+    template.should_receive(:render).with(:partial => 'non_existent')
     render!
     begin
       template.verify_rendered
@@ -99,14 +99,14 @@
     end
   end
   
-  it "should pass expect_render when a partial is expected twice and happens twice" do
-    template.expect_render(:partial => 'partial_used_twice').twice
+  it "should pass should_receive(:render) when a partial is expected twice and happens twice" do
+    template.should_receive(:render).with(:partial => 'partial_used_twice').twice
     render!
     template.verify_rendered
   end
   
-  it "should pass expect_render when a partial is expected once and happens twice" do
-    template.expect_render(:partial => 'partial_used_twice')
+  it "should pass should_receive(:render) when a partial is expected once and happens twice" do
+    template.should_receive(:render).with(:partial => 'partial_used_twice')
     render!
     begin
       template.verify_rendered
@@ -116,17 +116,17 @@
     end
   end
   
-  it "should fail expect_render with the right partial but wrong options" do
-    template.expect_render(:partial => 'partial', :locals => {:thing => Object.new})
+  it "should fail should_receive(:render) with the right partial but wrong options" do
+    template.should_receive(:render).with(:partial => 'partial', :locals => {:thing => Object.new})
     render!
     lambda {template.verify_rendered}.should raise_error(Spec::Mocks::MockExpectationError)
   end
 end
 
 describe "A partial that includes a partial", :type => :view do
-  it "should support expect_render with nested partial" do
+  it "should support should_receive(:render) with nested partial" do
     obj = Object.new
-    template.expect_render(:partial => 'partial', :object => obj)
+    template.should_receive(:render).with(:partial => 'partial', :object => obj)
     render :partial => "view_spec/partial_with_sub_partial", :locals => { :partial => obj }
   end
 end
@@ -141,7 +141,7 @@
   end
 
   it "should render the partial" do
-    template.expect_render(:partial => 'partial',
+    template.should_receive(:render).with(:partial => 'partial',
                :collection => ['Alice', 'Bob'],
                :spacer_template => 'spacer')
     render "view_spec/template_with_partial_using_collection"
@@ -149,37 +149,19 @@
 
 end
 
-describe "A view that includes a partial using an array as partial_path", :type => :view do
-  before(:each) do
-    module ActionView::Partials
-      def render_template_with_partial_with_array_support(partial_path, local_assigns = nil, deprecated_local_assigns = nil)
-        if partial_path.is_a?(Array)
-          "Array Partial"
-        else
-          render_partial_without_array_support(partial_path, local_assigns, deprecated_local_assigns)
-        end
-      end
-
-      alias :render_partial_without_array_support :render_partial
-      alias :render_partial :render_template_with_partial_with_array_support
+if Rails::VERSION::MAJOR >= 2
+  describe "A view that includes a partial using an array as partial_path", :type => :view do
+    before(:each) do
+      renderable_object = Object.new
+      renderable_object.stub!(:name).and_return("Renderable Object")
+      assigns[:array] = [renderable_object]
     end
 
-    @array = ['Alice', 'Bob']
-    assigns[:array] = @array
-  end
-
-  after(:each) do
-    module ActionView::Partials
-      alias :render_template_with_partial_with_array_support :render_partial
-      alias :render_partial :render_partial_without_array_support
-      undef render_template_with_partial_with_array_support
+    it "should render the array passed through to render_partial without modification" do
+      render "view_spec/template_with_partial_with_array" 
+      response.body.should match(/^Renderable Object$/)
     end
   end
-
-  it "should render have the array passed through to render_partial without modification" do
-    render "view_spec/template_with_partial_with_array" 
-    response.body.should match(/^Array Partial$/)
-  end
 end
 
 describe "Different types of renders (not :template)", :type => :view do
@@ -239,6 +221,20 @@
   end
 end
 
+describe "a block helper", :type => :view do
+  it "should not yield when not told to in the example" do
+    template.should_receive(:if_allowed)
+    render "view_spec/block_helper"
+    response.should_not have_tag("div","block helper was rendered")
+  end
+
+  it "should yield when told to in the example" do
+    template.should_receive(:if_allowed).and_yield
+    render "view_spec/block_helper"
+    response.should have_tag("div","block helper was rendered")
+  end
+end
+
 describe "render :inline => ...", :type => :view do
   it "should render ERB right in the spec" do
     render :inline => %|<%= text_field_tag('field_name', 'Value') %>|
@@ -246,6 +242,34 @@
   end
 end
 
+describe "render 'view_spec/foo/show.rhtml'", :type => :view do
+  it "should derive action name using the first part of the template name" do
+    render 'view_spec/foo/show.rhtml'
+    request.path_parameters[:action].should == 'show'
+  end
+end
+
+describe "setting path parameters", :type => :view do
+  describe "(controller)" do
+    it "should supercede the default path parameters" do
+      render "view_spec/entry_form", :path_parameters => {:controller => 'foo'}
+      request.path_parameters[:controller].should == 'foo'
+    end
+  end
+  describe "(action)" do
+    it "should supercede the default path parameters" do
+      render "view_spec/entry_form", :path_parameters => {:action => 'foo'}
+      request.path_parameters[:action].should == 'foo'
+    end
+  end
+  describe "(something arbitrary)" do
+    it "should supercede the default path parameters" do
+      render "view_spec/entry_form", :path_parameters => {:foo => 'bar'}
+      request.path_parameters[:foo].should == 'bar'
+    end
+  end
+end
+
 module Spec
   module Rails
     module Example
@@ -270,3 +294,15 @@
     end
   end
 end
+
+describe "bug http://rspec.lighthouseapp.com/projects/5645/tickets/510", :type => :view do
+  describe "a view example with should_not_receive" do
+    it "should render the view" do
+      obj = mock('model')
+      obj.should_receive(:render_partial?).and_return false
+      assigns[:obj] = obj
+      template.should_not_receive(:render).with(:partial => 'some_partial')
+      render "view_spec/should_not_receive"
+    end
+  end
+end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb Wed Dec 10 17:34:18 2008
@@ -3,44 +3,44 @@
 
 describe ActionView::Base, "with RSpec extensions:", :type => :view do 
   
-  describe "expect_render" do
+  describe "should_receive(:render)" do
     it "should not raise when render has been received" do
-      template.expect_render(:partial => "name")
+      template.should_receive(:render).with(:partial => "name")
       template.render :partial => "name"
     end
   
     it "should raise when render has NOT been received" do
-      template.expect_render(:partial => "name")
+      template.should_receive(:render).with(:partial => "name")
       lambda {
         template.verify_rendered
       }.should raise_error
     end
     
     it "should return something (like a normal mock)" do
-      template.expect_render(:partial => "name").and_return("Little Johnny")
+      template.should_receive(:render).with(:partial => "name").and_return("Little Johnny")
       result = template.render :partial => "name"
       result.should == "Little Johnny"
     end
   end
   
-  describe "stub_render" do
+  describe "stub!(:render)" do
     it "should not raise when stubbing and render has been received" do
-      template.stub_render(:partial => "name")
+      template.stub!(:render).with(:partial => "name")
       template.render :partial => "name"
     end
   
     it "should not raise when stubbing and render has NOT been received" do
-      template.stub_render(:partial => "name")
+      template.stub!(:render).with(:partial => "name")
     end
   
     it "should not raise when stubbing and render has been received with different options" do
-      template.stub_render(:partial => "name")
+      template.stub!(:render).with(:partial => "name")
       template.render :partial => "view_spec/spacer"
     end
 
     it "should not raise when stubbing and expecting and render has been received" do
-      template.stub_render(:partial => "name")
-      template.expect_render(:partial => "name")
+      template.stub!(:render).with(:partial => "name")
+      template.should_receive(:render).with(:partial => "name")
       template.render(:partial => "name")
     end
   end

Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,66 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+
+if ActiveSupport.const_defined?(:Callbacks) && Test::Unit::TestCase.include?(ActiveSupport::Callbacks)
+
+  class TestUnitTesting < Test::Unit::TestCase
+    @@setup_callback_count = 0
+    @@setup_method_count = 0
+    @@teardown_callback_count = 0
+    @@teardown_method_count = 0
+    cattr_accessor :setup_callback_count, :setup_method_count, :teardown_callback_count, :teardown_method_count
+    
+    setup :do_some_setup
+    teardown :do_some_teardown
+    
+    @@has_been_run = false
+    def self.run?
+      @@has_been_run
+    end
+    
+    def do_some_setup
+      @@setup_callback_count += 1
+    end
+    
+    def setup
+      @@setup_method_count += 1
+    end
+    
+    def test_something
+      assert_equal true, true
+      @@has_been_run = true
+    end
+    
+    def teardown
+      @@teardown_method_count += 1
+    end
+    
+    def do_some_teardown
+      @@teardown_callback_count += 1
+    end
+  end
+
+  module Test
+    module Unit
+      describe "Running TestCase tests" do
+        before(:all) do
+          TestUnitTesting.run unless TestUnitTesting.run?
+        end
+        
+        it "should call the setup callbacks" do
+          TestUnitTesting.setup_callback_count.should == 1
+        end
+        it "should still only call the normal setup method once" do
+          TestUnitTesting.setup_method_count.should == 1
+        end
+        it "should call the teardown callbacks" do
+          TestUnitTesting.teardown_callback_count.should == 1
+        end
+        it "should still only call the normal teardown method once" do
+          TestUnitTesting.teardown_method_count.should == 1
+        end
+      end
+    end
+  end
+  
+end
\ No newline at end of file

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb Wed Dec 10 17:34:18 2008
@@ -601,9 +601,6 @@
       with_tag("div", 1)
       with_tag("#1")
     end
-    lambda {
-      response.should have_rjs(:insert, :top, "test2")
-    }.should raise_error(SpecFailed)
     response.should have_rjs(:insert, :bottom) {|rjs|
       with_tag("div", 1)
       with_tag("#2")
@@ -629,6 +626,17 @@
       with_tag("#4")
     }
   end
+  
+  it "should find rjs using :insert (positioned)" do
+    pending("await fix for http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/982")
+    render_rjs do |page|
+      page.insert_html :top, "test1", "<div id=\"1\">foo</div>"
+      page.insert_html :bottom, "test2", "<div id=\"2\">bar</div>"
+    end
+    lambda {
+      response.should have_rjs(:insert, :top, "test2")
+    }.should raise_error(SpecFailed)
+  end
 end
 
 describe "send_email behaviour_type", :type => :controller do

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb Wed Dec 10 17:34:18 2008
@@ -1,13 +1,25 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
 describe "error_on" do
-  it "should provide a message including the name of what the error is on" do
+  it "should provide a description including the name of what the error is on" do
     have(1).error_on(:whatever).description.should == "should have 1 error on :whatever"
   end
+  
+  it "should provide a failure message including the number actually given" do
+    lambda {
+      [].should have(1).error_on(:whatever)
+    }.should fail_with("expected 1 error on :whatever, got 0")
+  end
 end
 
 describe "errors_on" do
-  it "should provide a message including the name of what the error is on" do
+  it "should provide a description including the name of what the error is on" do
     have(2).errors_on(:whatever).description.should == "should have 2 errors on :whatever"
   end
-end
+  
+  it "should provide a failure message including the number actually given" do
+    lambda {
+      [1].should have(3).errors_on(:whatever)
+    }.should fail_with("expected 3 errors on :whatever, got 1")
+  end
+end
\ No newline at end of file

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb Wed Dec 10 17:34:18 2008
@@ -40,30 +40,24 @@
         response.should include_text('text for this')
       end
 
-      it "should fail with matching text" do
+      it "should fail with incorrect text" do
         post 'text_action'
         lambda {
-          response.should include_text("this is NOT the text for this action")
-        }.should fail_with("expected to find \"this is NOT the text for this action\" in \"this is the text for this action\"")
-      end
-
-      it "should fail when a template is rendered" do
-        post 'some_action'
-        failure_message = case mode
-        when 'isolation'
-          /expected to find \"this is the text for this action\" in \"render_spec\/some_action\"/
-        when 'integration'
-          /expected to find \"this is the text for this action\" in \"\"/
-        end
-        lambda {
-          response.should include_text("this is the text for this action")
-        }.should fail_with(failure_message)
+          response.should include_text("the accordian guy")
+        }.should fail_with("expected to find \"the accordian guy\" in \"this is the text for this action\"")
       end
 
       it "should pass using should_not with incorrect text" do
         post 'text_action'
         response.should_not include_text("the accordian guy")
       end
+
+      it "should fail when a template is rendered" do
+        get 'some_action'
+        lambda {
+          response.should include_text("this is the text for this action")
+        }.should fail_with(/expected to find \"this is the text for this action\"/)
+      end
     end
   end
 end

Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/redirect_to_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/redirect_to_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/redirect_to_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec-rails/spec/rails/matchers/redirect_to_spec.rb Wed Dec 10 17:34:18 2008
@@ -6,7 +6,7 @@
       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')



Mime
View raw message