Sha256: 2c67a2ccb16a3f6837e94d5967aec337c100e0660607a732a019299d4c29d98a

Contents?: true

Size: 1.62 KB

Versions: 13

Compression:

Stored size: 1.62 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
    describe "something" do
      it "does something" do
      end
    end
    """
    When I run `rspec sample_spec.rb -fn`
    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
    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

13 entries across 13 versions & 6 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-core-2.13.0/features/example_groups/basic_structure.feature
sshp-0.0.2 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/example_groups/basic_structure.feature
sshp-0.0.1 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/example_groups/basic_structure.feature
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/example_groups/basic_structure.feature
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/example_groups/basic_structure.feature
vagrant-actionio-0.0.9 vendor/bundle/gems/rspec-core-2.13.0/features/example_groups/basic_structure.feature
rspec-core-2.13.1 features/example_groups/basic_structure.feature
rspec-core-2.13.0 features/example_groups/basic_structure.feature
remq-0.0.4 vendor/bundle/gems/rspec-core-2.12.2/features/example_groups/basic_structure.feature
remq-0.0.3 vendor/bundle/gems/rspec-core-2.12.2/features/example_groups/basic_structure.feature
rspec-core-2.12.2 features/example_groups/basic_structure.feature
rspec-core-2.12.1 features/example_groups/basic_structure.feature
rspec-core-2.12.0 features/example_groups/basic_structure.feature