Sha256: 585d7f57db742fe58ddef160099ef3732069f3438d7b4419aaf7059cc71b587e

Contents?: true

Size: 1.17 KB

Versions: 128

Compression:

Stored size: 1.17 KB

Contents

module RSpec
  module Core
    # Exposes [ExampleGroup](ExampleGroup)-level methods to a module, so you
    # can include that module in an [ExampleGroup](ExampleGroup).
    #
    # @example
    #
    #     module LoggedInAsAdmin
    #       extend RSpec::Core::SharedContext
    #       before(:each) do
    #         log_in_as :admin
    #       end
    #     end
    #
    #     describe "admin section" do
    #       include LoggedInAsAdmin
    #       # ...
    #     end
    module SharedContext
      include Hooks
      include Let::ExampleGroupMethods

      def included(group)
        [:before, :after].each do |type|
          [:all, :each].each do |scope|
            group.hooks[type][scope].concat hooks[type][scope]
          end
        end
        _nested_group_declarations.each do |name, block, *args|
          group.describe name, *args, &block
        end
      end

      def describe(name, *args, &block)
        _nested_group_declarations << [name, block, *args]
      end

      alias_method :context, :describe

      private

      def _nested_group_declarations
        @_nested_group_declarations ||= []
      end
    end
  end

  SharedContext = Core::SharedContext
end

Version data entries

128 entries across 75 versions & 9 rubygems

Version Path
classiccms-0.3.0 vendor/bundle/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-core-2.8.0/lib/rspec/core/shared_context.rb
rspec-core-2.10.1 lib/rspec/core/shared_context.rb
ftl-0.2.0 vendor/bundle/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-core-2.10.0/lib/rspec/core/shared_context.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
rspec-core-2.10.0 lib/rspec/core/shared_context.rb
horseman-0.0.5 vendor/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
classicCMS-0.2.3 vendor/bundle/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
classicCMS-0.2.2 vendor/bundle/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb
classicCMS-0.2.1 vendor/bundle/gems/rspec-core-2.9.0/lib/rspec/core/shared_context.rb