Sha256: 5a641bf748e00f95a38adb5d93cc87ef4a9b3c83e3f09ef1ddbc6aaaf0675be5

Contents?: true

Size: 1.13 KB

Versions: 158

Compression:

Stored size: 1.13 KB

Contents

Feature: arbitrary 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.

  Scenario: use a method defined in the same group
    Given a file named "example_spec.rb" with:
      """
      describe "an example" do
        def help
          :available
        end

        it "has access to methods defined in its group" do
          help.should be(:available)
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: use a method defined in a parent group
    Given a file named "example_spec.rb" with:
      """
      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
            help.should be(:available)
          end
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

Version data entries

158 entries across 103 versions & 14 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.5 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-core-2.11.1/features/helper_methods/arbitrary_methods.feature
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-core-2.11.1/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-core-2.10.1/features/helper_methods/arbitrary_methods.feature
classiccms-0.6.9 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.6.9 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.6.8 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.6.8 vendor/bundle/gems/rspec-core-2.9.0/features/helper_methods/arbitrary_methods.feature
classiccms-0.6.7 vendor/bundle/gems/rspec-core-2.10.0/features/helper_methods/arbitrary_methods.feature