To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratordeprecation_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:
class Foo def bar RSpec.deprecate "Foo#bar" end end
- Scenarios
-
- default - print deprecations to $stderr
- configure using the path to a file
- configure using a File object
- default - print deprecations to $stderr
-
- Given
-
a file named "spec/example_spec.rb" with:
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"
- configure using the path to a file
-
- Given
-
a file named "spec/example_spec.rb" with:
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"
- configure using a File object
-
- Given
-
a file named "spec/example_spec.rb" with:
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"
Last published over 7 years ago by myronmarston.