Sha256: 6732699d76256a6b4e163d907e4172f49d8bdf5bc720302033ebaf8e37aa6888

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 KB

Contents

require 'rubygems'
gem 'rspec', '=1.1.8'
require 'spec'

require File.dirname(__FILE__) + "/../lib/deep_test"
require File.dirname(__FILE__) + "/../test/fake_deadlock_error"
require File.dirname(__FILE__) + "/../test/simple_test_blackboard"
require File.dirname(__FILE__) + "/thread_worker"

describe "sandboxed rspec_options", :shared => true do
  attr_reader :options

  before(:each) do
    @original_rspec_options = ::Spec::Runner.options
    @options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
    @options.reporter = FakeReporter.new
    ::Spec::Runner.use @options
  end

  after(:each) do
    ::Spec::Runner.use @original_rspec_options
  end

  class FakeReporter
    attr_reader :number_of_examples, :examples_finished, :number_of_errors

    def initialize
      @examples_finished = []
      @number_of_errors = 0
    end

    def example_started(example) end
    def add_example_group(example_group) end

    def end
      @ended = true
    end

    def ended?
      @ended == true
    end

    def dump; end

    def start(number_of_examples) 
      @number_of_examples = number_of_examples
    end

    def example_finished(example, error)
      @examples_finished << example.description
      @number_of_errors += 1 if error
      @error = error
    end

    def passed?
      @error == nil
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
jperkins-deep_test-1.2.2 spec/spec_helper.rb
jstorimer-deep-test-1.4.0 spec/spec_helper.rb
jstorimer-deep-test-1.3.0 spec/spec_helper.rb
jstorimer-deep-test-1.2.0 spec/spec_helper.rb
jstorimer-deep-test-1.1.0 spec/spec_helper.rb
jstorimer-deep-test-1.0.0 spec/spec_helper.rb