Sha256: b954e7ec773fd309713d11ad56971809bfd7755e5446d28499ef9d02eba3d321

Contents?: true

Size: 991 Bytes

Versions: 5

Compression:

Stored size: 991 Bytes

Contents

Feature: explicit subject

  You can override the implicit subject using the subject() method.
  
  Scenario: subject in top level group
    Given a file named "top_level_subject_spec.rb" with:
      """
      require 'rspec/expectations'

      describe Array, "with some elements" do
        subject { [1,2,3] }
        it "should have the prescribed elements" do
          subject.should == [1,2,3]
        end
      end
      """
    When I run "rspec top_level_subject_spec.rb"
    Then I should see "1 example, 0 failures"

  Scenario: subject in a nested group
    Given a file named "nested_subject_spec.rb" with:
      """
      require 'rspec/expectations'

      describe Array do
        subject { [1,2,3] }
        describe "with some elements" do
          it "should have the prescribed elements" do
            subject.should == [1,2,3]
          end
        end
      end
      """
    When I run "rspec nested_subject_spec.rb"
    Then I should see "1 example, 0 failures"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-core-2.0.0.beta.4 features/subject/explicit_subject.feature
rspec-core-2.0.0.beta.3 features/subject/explicit_subject.feature
rspec-core-2.0.0.beta.2 features/subject/explicit_subject.feature
rspec-core-2.0.0.beta.1 features/subject/explicit_subject.feature
rspec-core-2.0.0.a10 features/subject/explicit_subject.feature