Sha256: 00a865821eaad601c1857526c5145c0a641498dc6edba3974968b62024bd17f5

Contents?: true

Size: 1.64 KB

Versions: 7

Compression:

Stored size: 1.64 KB

Contents

Feature: basic structure (`describe`/`it`)

  RSpec is a DSL for creating executable examples of how code is expected to
  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."

  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:
    """ruby
    RSpec.describe "something" do
      it "does something" do
      end
    end
    """
    When I run `rspec sample_spec.rb -fdoc`
    Then the output should contain:
      """
      something
        does something
      """

  Scenario: Nested example groups (using `context`)
    Given a file named "nested_example_groups_spec.rb" with:
    """ruby
    RSpec.describe "something" do
      context "in one context" do
        it "does one thing" do
        end
      end
      context "in another context" do
        it "does another thing" do
        end
      end
    end
    """
    When I run `rspec nested_example_groups_spec.rb -fdoc`
    Then the output should contain:
      """
      something
        in one context
          does one thing
        in another context
          does another thing
      """

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-rspec-0.8.0 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.8.0.alpha3 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.8.0.alpha2 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.8.0.alpha1 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.7.1 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.7.0 rspec-core/upstream/features/example_groups/basic_structure.feature
opal-rspec-0.7.0.rc.2 rspec-core/upstream/features/example_groups/basic_structure.feature