Sha256: bab44df62e90029b15d694da33436e71c7f9066e3c47ee4de0daa9bcccfc2a9d
Contents?: true
Size: 1.08 KB
Versions: 72
Compression:
Stored size: 1.08 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper.rb' class Substance def initialize exists, description @exists = exists @description = description end def exist? @exists end def inspect @description end end class SubstanceTester include Spec::Matchers def initialize substance @substance = substance end def should_exist @substance.should exist end end describe "should exist," do before(:each) do @real = Substance.new true, 'something real' @imaginary = Substance.new false, 'something imaginary' end describe "within an example group" do it "should pass if target exists" do @real.should exist end it "should fail if target does not exist" do lambda { @imaginary.should exist }.should fail end it "should pass if target doesn't exist" do lambda { @real.should_not exist }.should fail end end describe "outside of an example group" do it "should pass if target exists" do real_tester = SubstanceTester.new @real real_tester.should_exist end end end
Version data entries
72 entries across 72 versions & 12 rubygems