Sha256: 4b6dd8b3ef11eddf2a4b1c0339e1a978ffc83c111d4e60891f89b10de82780de
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' module Rspec::Core describe Subject do describe "implicit subject" do describe "with a class" do it "returns an instance of the class" do ExampleGroup.create(Array).subject.call.should == [] end end describe "with a Module" do it "returns the Module" do ExampleGroup.create(Enumerable).subject.call.should == Enumerable end end describe "with a string" do it "return the string" do ExampleGroup.create("Foo").subject.call.should == 'Foo' end end describe "with a number" do it "returns the number" do ExampleGroup.create(15).subject.call.should == 15 end end end describe "explicit subject" do describe "defined in a top level group" do it "replaces the implicit subject in that group" do group = ExampleGroup.create(Array) group.subject { [1,2,3] } group.subject.call.should == [1,2,3] end end describe "defined in a top level group" do let(:group) do ExampleGroup.create do subject{ [4,5,6] } end end it "is available in a nested group (subclass)" do nested_group = group.describe("I'm nested!") { } nested_group.subject.call.should == [4,5,6] end it "is available in a doubly nested group (subclass)" do nested_group = group.describe("Nesting level 1") { } doubly_nested_group = nested_group.describe("Nesting level 2") { } doubly_nested_group.subject.call.should == [4,5,6] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-core-2.0.0.beta.7 | spec/rspec/core/subject_spec.rb |
rspec-core-2.0.0.beta.6 | spec/rspec/core/subject_spec.rb |