Sha256: 18adaf5fac56e650442f7052086df6a872354e20fe6848f77b46546335fd2291

Contents?: true

Size: 1.21 KB

Versions: 38

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(message)
            [@file, __getobj__].each { |out| out.puts message }
          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

38 entries across 38 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/command_line/require_option.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-core-2.14.8/features/command_line/require_option.feature
rspec-core-2.99.2 features/command_line/require_option.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-core-2.14.7/features/command_line/require_option.feature
rspec-core-2.99.1 features/command_line/require_option.feature
rspec-core-2.99.0 features/command_line/require_option.feature
rspec-core-2.99.0.rc1 features/command_line/require_option.feature
rspec-core-2.14.8 features/command_line/require_option.feature
rspec-core-2.99.0.beta2 features/command_line/require_option.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-core-2.14.7/features/command_line/require_option.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-core-2.14.7/features/command_line/require_option.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-core-2.14.7/features/command_line/require_option.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/command_line/require_option.feature