Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Mar 13, 2011
1 parent d8cb628 commit 0dea1af
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions features/example_groups/basic_structure.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ Feature: basic structure (describe/it)
behave, organized in groups. It uses the words "describe" and "it" so we can
express concepts like a conversation:

"Describe an account when it is first opened."
"It has a balance of zero."
"Describe an account when it is first opened."
"It has a balance of zero."

The describe() method creates a subclass of RSpec::Core::ExampleGroup. The
block passed to describe() is evaluated in the context of that class, so any
class methods of ExampleGroup are at your disposal within that block.

Within a group, you can declare nested groups using the describe() or
context() methods. A nested group is actually a subclass of the outer group,
so it has access to same methods as the outer group, as well as any class
methods defined in the outer group.

The it() method accepts a block, which is later executed in the context of
an instance of the group in which it is declared.
The `describe` method creates an example group. Within the block passed to
`describe` you can declare nested groups using the `describe` or `context`
methods, or you can declare examples using the `it` or `specify` methods.

Under the hood, an example group is a class in which the block passed to
`describe` or `context` is evaluated. The blocks passed to `it` are evaluated
in the context of an _instance_ of that class.

Scenario: one group, one example
Given a file named "sample_spec.rb" with:
"""
Expand Down

0 comments on commit 0dea1af

Please sign in to comment.