Sha256: 60a88b1d365e1d5859b66b39d9d1e97d7dbaa3f1be374fe3b0dbf96563bb8f40

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

Feature: --require option

  Use the `--require` (or `-r`) option to specify a file to require
  before running specs.

  Scenario: using the --require option
    Given a file named "logging_formatter.rb" with:
      """ruby
      require "rspec/core/formatters/base_text_formatter"
      require 'delegate'

      class LoggingFormatter < RSpec::Core::Formatters::BaseTextFormatter
        def initialize(output)
          super LoggingIO.new(output)
        end

        class LoggingIO < SimpleDelegator
          def initialize(output)
            @file = File.new('rspec.log', 'w')
            super
          end

          def puts(*args)
            [@file, __getobj__].each { |out| out.puts(*args) }
          end

          def close
            @file.close
          end
        end
      end
      """
    And a file named "spec/example_spec.rb" with:
      """ruby
      describe "an embarassing situation" do
        it "happens to everyone" do
        end
      end
      """
    When I run `rspec --require ./logging_formatter.rb --format LoggingFormatter`
    Then the output should contain "1 example, 0 failures"
    And  the file "rspec.log" should contain "1 example, 0 failures"
    And  the exit status should be 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-core-3.0.0.beta2 features/command_line/require_option.feature
rspec-core-3.0.0.beta1 features/command_line/require_option.feature