Sha256: f2a81271658b67cffdf71e1e6474d9fc1737e2b45fb4c182e760c175440f7158

Contents?: true

Size: 1.88 KB

Versions: 32

Compression:

Stored size: 1.88 KB

Contents

Feature: deprecation_stream

  Define a custom output stream for warning about deprecations (default `$stderr`).

    RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }

  or

    RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }

  Background:
    Given a file named "lib/foo.rb" with:
      """ruby
      class Foo
        def bar
          RSpec.deprecate "Foo#bar"
        end
      end
      """

  Scenario: default - print deprecations to $stderr
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require "foo"
      describe "calling a deprecated method" do
        example { Foo.new.bar }
      end
      """
    When I run `rspec spec/example_spec.rb`
    Then the output should contain "DEPRECATION: Foo#bar is deprecated"

  Scenario: configure using the path to a file
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require "foo"
      RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }
      describe "calling a deprecated method" do
        example { Foo.new.bar }
      end
      """
    When I run `rspec spec/example_spec.rb`
    Then the output should not contain "DEPRECATION"
    But the output should contain "1 deprecation logged to deprecations.txt"
    And the file "deprecations.txt" should contain "Foo#bar is deprecated"

  Scenario: configure using a File object
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require "foo"
      RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }
      describe "calling a deprecated method" do
        example { Foo.new.bar }
      end
      """
    When I run `rspec spec/example_spec.rb`
    Then the output should not contain "DEPRECATION"
    But the output should contain "1 deprecation logged to deprecations.txt"
    And the file "deprecations.txt" should contain "Foo#bar is deprecated"

Version data entries

32 entries across 32 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-core-2.14.8/features/configuration/deprecation_stream.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
rspec-core-2.14.8 features/configuration/deprecation_stream.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
dxruby_rp5-0.0.2 spec/vendor/rspec-core-2.14.7/features/configuration/deprecation_stream.feature
dxruby_rp5-0.0.1 spec/vendor/rspec-core-2.14.7/features/configuration/deprecation_stream.feature