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 collaboratorarbitrary helper methods
You can define methods in any example group using Ruby's def
keyword or
define_method
method. These helper methods are exposed to examples in the
group in which they are defined and groups nested within that group, but not
parent or sibling groups.
- Scenarios
-
- Use a method defined in the same group
-
- Given
-
a file named "example_spec.rb" with:
RSpec.describe "an example" do def help :available end it "has access to methods defined in its group" do expect(help).to be(:available) end end
- When
-
I run
rspec example_spec.rb
- Then
- the examples should all pass
- Use a method defined in a parent group
-
- Given
-
a file named "example_spec.rb" with:
RSpec.describe "an example" do def help :available end describe "in a nested group" do it "has access to methods defined in its parent group" do expect(help).to be(:available) end end end
- When
-
I run
rspec example_spec.rb
- Then
- the examples should all pass
Last published over 2 years ago by Jon Rowe.