Class Index [+]

Quicksearch

RSpec

Constants

SharedContext

Public Class Methods

clear_remaining_example_groups() click to toggle source

@private Used internally to clear remaining groups when fail_fast is set

     # File lib/rspec/core.rb, line 99
 99:   def self.clear_remaining_example_groups
100:     world.example_groups.clear
101:   end
configuration() click to toggle source

Returns the global [Configuration](RSpec/Core/Configuration) object. While you can use this method to access the configuration, the more common convention is to use [RSpec.configure](RSpec#configure-class_method).

@example

    RSpec.configuration.drb_port = 1234

@see RSpec.configure @see Core::Configuration

    # File lib/rspec/core.rb, line 81
81:   def self.configuration
82:     @configuration ||= RSpec::Core::Configuration.new
83:   end
configure() click to toggle source

Yields the global configuration to a block. @yield [Configuration] global configuration

@example

    RSpec.configure do |config|
      config.add_formatter 'documentation'
    end

@see Core::Configuration

    # File lib/rspec/core.rb, line 93
93:   def self.configure
94:     yield configuration if block_given?
95:   end
deprecate(method, alternate_method=nil, version=nil) click to toggle source

@private

Used internally to print deprecation warnings

    # File lib/rspec/core/deprecation.rb, line 6
 6:     def deprecate(method, alternate_method=nil, version=nil)
 7:       version_string = version ? "rspec-#{version}" : "a future version of RSpec"
 8: 
 9:       message = *****************************************************************DEPRECATION WARNING: you are using deprecated behaviour that willbe removed from #{version_string}.#{caller(0)[2]}* #{method} is deprecated.
10:       if alternate_method
11:         message << * please use #{alternate_method} instead.
12:       end
13: 
14:       message << "*****************************************************************"
15:       warn_deprecation(message)
16:     end
reset() click to toggle source

@private Used internally to ensure examples get reloaded between multiple runs in the same process.

    # File lib/rspec/core.rb, line 68
68:   def self.reset
69:     @world = nil
70:     @configuration = nil
71:   end
wants_to_quit() click to toggle source

@private

    # File lib/rspec/core.rb, line 48
48:   def self.wants_to_quit
49:   # Used internally to determine what to do when a SIGINT is received
50:     world.wants_to_quit
51:   end
wants_to_quit=(maybe) click to toggle source

@private Used internally to determine what to do when a SIGINT is received

    # File lib/rspec/core.rb, line 55
55:   def self.wants_to_quit=(maybe)
56:     world.wants_to_quit=(maybe)
57:   end
warn_deprecation(message) click to toggle source

@private

Used internally to print deprecation warnings

    # File lib/rspec/core/deprecation.rb, line 32
32:     def warn_deprecation(message)
33:       send :warn, message
34:     end
world() click to toggle source

@private Internal container for global non-configuration data

    # File lib/rspec/core.rb, line 61
61:   def self.world
62:     @world ||= RSpec::Core::World.new
63:   end

Public Instance Methods

configure_expectation_framework() click to toggle source

@private

     # File lib/rspec/core/configuration.rb, line 738
738:       def configure_expectation_framework
739:         expectation_frameworks.each do |framework|
740:           RSpec::Core::ExampleGroup.send(:include, framework)
741:         end
742:       end
configure_mock_framework() click to toggle source

@private

     # File lib/rspec/core/configuration.rb, line 733
733:       def configure_mock_framework
734:         RSpec::Core::ExampleGroup.send(:include, mock_framework)
735:       end
load_spec_files() click to toggle source

@private

     # File lib/rspec/core/configuration.rb, line 745
745:       def load_spec_files
746:         files_to_run.uniq.map {|f| load File.expand_path(f) }
747:         raise_if_rspec_1_is_loaded
748:       end
order=(type) click to toggle source

@api

Sets the order and, if order is `’rand:’`, also sets the seed.

     # File lib/rspec/core/configuration.rb, line 760
760:       def order=(type)
761:         order_and_seed_from_order(type)
762:       end
randomize?() click to toggle source
     # File lib/rspec/core/configuration.rb, line 764
764:       def randomize?
765:         order.to_s.match(/rand/)
766:       end
seed=(seed) click to toggle source

@api

Sets the seed value and sets `order=’rand’`

     # File lib/rspec/core/configuration.rb, line 753
753:       def seed=(seed)
754:         order_and_seed_from_seed(seed)
755:       end

Private Instance Methods

assert_no_example_groups_defined(config_option) click to toggle source
     # File lib/rspec/core/configuration.rb, line 799
799:       def assert_no_example_groups_defined(config_option)
800:         if RSpec.world.example_groups.any?
801:           raise MustBeConfiguredBeforeExampleGroupsError.new(
802:             "RSpec's #{config_option} configuration option must be configured before " +
803:             "any example groups are defined, but you have already defined a group."
804:           )
805:         end
806:       end
built_in_formatter(key) click to toggle source
     # File lib/rspec/core/configuration.rb, line 832
832:       def built_in_formatter(key)
833:         case key.to_s
834:         when 'd', 'doc', 'documentation', 's', 'n', 'spec', 'nested'
835:           require 'rspec/core/formatters/documentation_formatter'
836:           RSpec::Core::Formatters::DocumentationFormatter
837:         when 'h', 'html'
838:           require 'rspec/core/formatters/html_formatter'
839:           RSpec::Core::Formatters::HtmlFormatter
840:         when 't', 'textmate'
841:           require 'rspec/core/formatters/text_mate_formatter'
842:           RSpec::Core::Formatters::TextMateFormatter
843:         when 'p', 'progress'
844:           require 'rspec/core/formatters/progress_formatter'
845:           RSpec::Core::Formatters::ProgressFormatter
846:         end
847:       end
command() click to toggle source
     # File lib/rspec/core/configuration.rb, line 791
791:       def command
792:         $0.split(File::SEPARATOR).last
793:       end
custom_formatter(formatter_ref) click to toggle source
     # File lib/rspec/core/configuration.rb, line 849
849:       def custom_formatter(formatter_ref)
850:         if Class === formatter_ref
851:           formatter_ref
852:         elsif string_const?(formatter_ref)
853:           begin
854:             eval(formatter_ref)
855:           rescue NameError
856:             require path_for(formatter_ref)
857:             eval(formatter_ref)
858:           end
859:         end
860:       end
extract_location(path) click to toggle source
     # File lib/rspec/core/configuration.rb, line 783
783:       def extract_location(path)
784:         if path =~ /^(.*?)((?:\:\d+)+)$/
785:           path, lines = $1, $2[1..1].split(":").map{|n| n.to_i}
786:           filter_manager.add_location path, lines
787:         end
788:         path
789:       end
file_at(path) click to toggle source
     # File lib/rspec/core/configuration.rb, line 885
885:       def file_at(path)
886:         FileUtils.mkdir_p(File.dirname(path))
887:         File.new(path, 'w')
888:       end
gather_directories(path, patterns) click to toggle source
     # File lib/rspec/core/configuration.rb, line 777
777:       def gather_directories(path, patterns)
778:         patterns.map do |pattern|
779:           pattern =~ /^#{path}/ ? Dir[pattern.strip] : Dir["#{path}/{#{pattern.strip}}"]
780:         end
781:       end
get_files_to_run(paths) click to toggle source
     # File lib/rspec/core/configuration.rb, line 770
770:       def get_files_to_run(paths)
771:         patterns = pattern.split(",")
772:         paths.map do |path|
773:           File.directory?(path) ? gather_directories(path, patterns) : extract_location(path)
774:         end.flatten
775:       end
order_and_seed_from_order(type) click to toggle source
     # File lib/rspec/core/configuration.rb, line 899
899:       def order_and_seed_from_order(type)
900:         order, seed = type.to_s.split(':')
901:         @order = order
902:         @seed  = seed = seed.to_i if seed
903:         @order, @seed = nil, nil if order == 'default'
904:         return order, seed
905:       end
order_and_seed_from_seed(value) click to toggle source
     # File lib/rspec/core/configuration.rb, line 890
890:       def order_and_seed_from_seed(value)
891:         @order, @seed = 'rand', value.to_i
892:       end
output_to_tty?() click to toggle source
     # File lib/rspec/core/configuration.rb, line 824
824:       def output_to_tty?
825:         begin
826:           output_stream.tty? || tty?
827:         rescue NoMethodError
828:           false
829:         end
830:       end
path_for(const_ref) click to toggle source
     # File lib/rspec/core/configuration.rb, line 866
866:       def path_for(const_ref)
867:         underscore_with_fix_for_non_standard_rspec_naming(const_ref)
868:       end
raise_if_rspec_1_is_loaded() click to toggle source
     # File lib/rspec/core/configuration.rb, line 808
808:       def raise_if_rspec_1_is_loaded
809:         if defined?(Spec) && defined?(Spec::VERSION::MAJOR) && Spec::VERSION::MAJOR == 1
810:           raise #{'*'*80}  You are running rspec-2, but it seems as though rspec-1 has been loaded as  well.  This is likely due to a statement like this somewhere in the specs:      require 'spec'  Please locate that statement, remove it, and try again.#{'*'*80}
811:         end
812:       end
set_order_and_seed(hash) click to toggle source
     # File lib/rspec/core/configuration.rb, line 894
894:       def set_order_and_seed(hash)
895:         hash[:order], seed = order_and_seed_from_order(hash[:order])
896:         hash[:seed] = seed if seed
897:       end
string_const?(str) click to toggle source
     # File lib/rspec/core/configuration.rb, line 862
862:       def string_const?(str)
863:         str.is_a?(String) && /\A[A-Z][a-zA-Z0-9_:]*\z/ =~ str
864:       end
underscore(camel_cased_word) click to toggle source

activesupport/lib/active_support/inflector/methods.rb, line 48

     # File lib/rspec/core/configuration.rb, line 875
875:       def underscore(camel_cased_word)
876:         word = camel_cased_word.to_s.dup
877:         word.gsub!(/::/, '/')
878:         word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
879:         word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
880:         word.tr!("-", "_")
881:         word.downcase!
882:         word
883:       end
underscore_with_fix_for_non_standard_rspec_naming(string) click to toggle source
     # File lib/rspec/core/configuration.rb, line 870
870:       def underscore_with_fix_for_non_standard_rspec_naming(string)
871:         underscore(string).sub(%{(^|/)r_spec($|/)}, '\1rspec\2')
872:       end
value_for(key, default=nil) click to toggle source
     # File lib/rspec/core/configuration.rb, line 795
795:       def value_for(key, default=nil)
796:         @preferred_options.has_key?(key) ? @preferred_options[key] : default
797:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.