1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
Feature: Create example aliases
Use `config.alias_example_to` to create new example group methods that define
examples with the configured metadata. You can also specify metadata using
only symbols.
Scenario: Use `alias_example_to` to define a custom example name
Given a file named "alias_example_to_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.alias_example_to :task
end
RSpec.describe "a task example group" do
task "does something" do
expect(5).to eq(5)
end
end
"""
When I run `rspec alias_example_to_spec.rb --format doc`
Then the output should contain "does something"
And the examples should all pass
Scenario: Use `alias_example_to` to define a pending example
Given a file named "alias_example_to_pending_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.alias_example_to :pit, :pending => "Pit alias used"
end
RSpec.describe "an example group" do
pit "does something later on" do
fail "not implemented yet"
end
end
"""
When I run `rspec alias_example_to_pending_spec.rb --format doc`
Then the output should contain "does something later on (PENDING: Pit alias used)"
And the output should contain "0 failures"
Scenario: Use symbols as metadata
Given a file named "use_symbols_as_metadata_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.alias_example_to :pit, :pending
end
RSpec.describe "an example group" do
pit "does something later on" do
fail "not implemented yet"
end
end
"""
When I run `rspec use_symbols_as_metadata_spec.rb --format doc`
Then the output should contain "does something later on (PENDING: No reason given)"
And the output should contain "0 failures"
|