Sha256: 78d2962a1681dc14f79faa8c3d0640e2f34012a129cc3f3cdcfb7dd7ceaef285
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
require 'stringio' dir = File.dirname(__FILE__) lib_path = File.expand_path("#{dir}/../lib") $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path) $_spec_spec = true # Prevents Kernel.exit in various places require 'spec' require 'spec/mocks' require 'spec/stories' spec_classes_path = File.expand_path("#{dir}/../spec/spec/spec_classes") require spec_classes_path unless $LOAD_PATH.include?(spec_classes_path) def jruby? ::RUBY_PLATFORM == 'java' end module Spec module Example class NonStandardError < Exception; end end module Matchers def fail raise_error(Spec::Expectations::ExpectationNotMetError) end def fail_with(message) raise_error(Spec::Expectations::ExpectationNotMetError, message) end def exception_from(&block) exception = nil begin yield rescue StandardError => e exception = e end exception end def run_with(options) ::Spec::Runner::CommandLine.run(options) end def with_ruby(version) yield if RUBY_PLATFORM =~ Regexp.compile("^#{version}") end end end def with_sandboxed_options attr_reader :options before(:each) do @original_rspec_options = ::Spec::Runner.options ::Spec::Runner.use(@options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)) end after(:each) do ::Spec::Runner.use(@original_rspec_options) end yield end def with_sandboxed_config attr_reader :config before(:each) do @config = ::Spec::Runner::Configuration.new @original_configuration = ::Spec::Runner.configuration spec_configuration = @config ::Spec::Runner.instance_eval {@configuration = spec_configuration} end after(:each) do original_configuration = @original_configuration ::Spec::Runner.instance_eval {@configuration = original_configuration} ::Spec::Example::ExampleGroupFactory.reset end yield end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
dchelimsky-rspec-stories-1.0.0 | spec/spec_helper.rb |
samstokes-rspec-stories-1.0.1 | spec/spec_helper.rb |
samstokes-rspec-stories-1.0.2 | spec/spec_helper.rb |