Class: RSpec::Core::World

### Home Classes Methods

### In Files

- lib/rspec/core/world.rb

### Parent

Object

### Methods

- ::new
- #announce_exclusion_filter
- #announce_filters
- #announce_inclusion_filter
- #configure_group
- #everything_filtered_message
- #example_count
- #exclusion_filter
- #filter_manager
- #inclusion_filter
- #preceding_declaration_line
- #register
- #reporter
- #reset

### Included Modules

- RSpec::Core::Hooks

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Core
- RSpec::Core::BacktraceCleaner
- RSpec::Core::BacktraceFormatter
- RSpec::Core::CommandLine
- RSpec::Core::Configuration
- RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError
- RSpec::Core::ConfigurationOptions
- RSpec::Core::ConstMissing
- RSpec::Core::DRbCommandLine
- RSpec::Core::DSL
- RSpec::Core::Deprecation
- RSpec::Core::DrbOptions
- RSpec::Core::Example
- RSpec::Core::Example::NotPendingExampleFixed
- RSpec::Core::Example::Procsy
- RSpec::Core::ExampleGroup
- RSpec::Core::Extensions
- RSpec::Core::Extensions::InstanceEvalWithArgs
- RSpec::Core::Extensions::ModuleEvalWithArgs
- RSpec::Core::Extensions::Ordered
- RSpec::Core::Extensions::Ordered::ExampleGroups
- RSpec::Core::Extensions::Ordered::Examples
- RSpec::Core::FilterManager
- RSpec::Core::FilterManager::BackwardCompatibility
- RSpec::Core::FilterManager::Describable
- RSpec::Core::Formatters
- RSpec::Core::Formatters::BaseFormatter
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec::Core::Formatters::DeprecationFormatter
- RSpec::Core::Formatters::DocumentationFormatter
- RSpec::Core::Formatters::Helpers
- RSpec::Core::Formatters::HtmlFormatter
- RSpec::Core::Formatters::HtmlPrinter
- RSpec::Core::Formatters::JsonFormatter
- RSpec::Core::Formatters::ProgressFormatter
- RSpec::Core::Formatters::SnippetExtractor
- RSpec::Core::Formatters::SnippetExtractor::NullConverter
- RSpec::Core::Formatters::TextMateFormatter
- RSpec::Core::Hooks
- RSpec::Core::Hooks::AfterAllHook
- RSpec::Core::Hooks::AfterHook
- RSpec::Core::Hooks::AroundHook
- RSpec::Core::Hooks::AroundHookCollection
- RSpec::Core::Hooks::BeforeHook
- RSpec::Core::Hooks::GroupHookCollection
- RSpec::Core::Hooks::Hook
- RSpec::Core::Hooks::HookCollection
- RSpec::Core::Hooks::HookCollectionAliases
- RSpec::Core::Hooks::RegistersGlobals
- RSpec::Core::MemoizedHelpers
- RSpec::Core::MemoizedHelpers::BeforeAllMemoizedHash
- RSpec::Core::MemoizedHelpers::ClassMethods
- RSpec::Core::Metadata
- RSpec::Core::Metadata::ExampleMetadataHash
- RSpec::Core::Metadata::GroupMetadataHash
- RSpec::Core::Metadata::MetadataHash
- RSpec::Core::MetadataHashBuilder
- RSpec::Core::MetadataHashBuilder::Common
- RSpec::Core::MetadataHashBuilder::WithConfigWarning
- RSpec::Core::MetadataHashBuilder::WithDeprecationWarning
- RSpec::Core::MockFrameworkAdapter
- RSpec::Core::Parser
- RSpec::Core::Pending
- RSpec::Core::Pending::PendingDeclaredInExample
- RSpec::Core::Pending::PendingExampleFixedError
- RSpec::Core::ProjectInitializer
- RSpec::Core::RakeTask
- RSpec::Core::Reporter
- RSpec::Core::RubyProject
- RSpec::Core::Runner
- RSpec::Core::SharedContext
- RSpec::Core::SharedExampleGroup
- RSpec::Core::SharedExampleGroup::Collection
- RSpec::Core::SharedExampleGroup::Registry
- RSpec::Core::SharedExampleGroup::TopLevelDSL
- RSpec::Core::Time
- RSpec::Core::Version
- RSpec::Core::World
- RSpec::Rake
- RSpec::Runner
- Autotest
- Autotest::Rspec2
- Kernel

No matching classes.

# RSpec::Core::World

### Attributes

example_groups[R]
filtered_examples[R]
wants_to_quit[RW]

### Public Class Methods

new(configuration=RSpec.configuration) click to toggle source

    # File lib/rspec/core/world.rb, line 10
    def initialize(configuration=RSpec.configuration)
      @configuration = configuration
      @example_groups = [].extend(Extensions::Ordered::ExampleGroups)
      @filtered_examples = Hash.new { |hash,group|
        hash[group] = begin
          examples = group.examples.dup
          examples = filter_manager.prune(examples)
          examples.uniq
          examples.extend(Extensions::Ordered::Examples)
        end
      }
    end

### Public Instance Methods

announce_exclusion_filter(announcements) click to toggle source

    # File lib/rspec/core/world.rb, line 111
    def announce_exclusion_filter(announcements)
      unless exclusion_filter.empty_without_conditional_filters?
        announcements << "exclude #{exclusion_filter.description}"
      end
    end

announce_filters() click to toggle source

    # File lib/rspec/core/world.rb, line 65
    def announce_filters
      filter_announcements = []

      announce_inclusion_filter filter_announcements
      announce_exclusion_filter filter_announcements

      unless filter_manager.empty?
        if filter_announcements.length == 1
          reporter.message("Run options: #{filter_announcements[0]}")
        else
          reporter.message("Run options:\n  #{filter_announcements.join("\n  ")}")
        end
      end

      if @configuration.run_all_when_everything_filtered? && example_count.zero?
        reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
        filtered_examples.clear
        inclusion_filter.clear
      end

      if example_count.zero?
        example_groups.clear
        if filter_manager.empty?
          reporter.message("No examples found.")
        elsif exclusion_filter.empty_without_conditional_filters?
          message = everything_filtered_message
          if @configuration.run_all_when_everything_filtered?
            message << "; ignoring #{inclusion_filter.description}"
          end
          reporter.message(message)
        elsif inclusion_filter.empty?
          reporter.message(everything_filtered_message)
        end
      end
    end

announce_inclusion_filter(announcements) click to toggle source

    # File lib/rspec/core/world.rb, line 105
    def announce_inclusion_filter(announcements)
      unless inclusion_filter.empty?
        announcements << "include #{inclusion_filter.description}"
      end
    end

configure_group(group) click to toggle source

    # File lib/rspec/core/world.rb, line 45
    def configure_group(group)
      @configuration.configure_group(group)
    end

everything_filtered_message() click to toggle source

    # File lib/rspec/core/world.rb, line 101
    def everything_filtered_message
      "\nAll examples were filtered out"
    end

example_count() click to toggle source

    # File lib/rspec/core/world.rb, line 49
    def example_count
      example_groups.collect {|g| g.descendants}.flatten.inject(0) do |sum, g|
        sum += g.filtered_examples.size
      end
    end

exclusion_filter() click to toggle source

    # File lib/rspec/core/world.rb, line 41
    def exclusion_filter
      @configuration.exclusion_filter
    end

filter_manager() click to toggle source

    # File lib/rspec/core/world.rb, line 28
    def filter_manager
      @configuration.filter_manager
    end

inclusion_filter() click to toggle source

    # File lib/rspec/core/world.rb, line 37
    def inclusion_filter
      @configuration.inclusion_filter
    end

preceding_declaration_line(filter_line) click to toggle source

    # File lib/rspec/core/world.rb, line 55
    def preceding_declaration_line(filter_line)
      declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
        line <= filter_line ? line : highest_prior_declaration_line
      end
    end

register(example_group) click to toggle source

    # File lib/rspec/core/world.rb, line 32
    def register(example_group)
      example_groups << example_group
      example_group
    end

reporter() click to toggle source

    # File lib/rspec/core/world.rb, line 61
    def reporter
      @configuration.reporter
    end

reset() click to toggle source

    # File lib/rspec/core/world.rb, line 23
    def reset
      example_groups.clear
      SharedExampleGroup.registry.clear
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.