Sha256: 5a58f4fdd17104220547a6b36b96cd1a3cc313c27116c52a39b2d29fc709d1e2

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")

module JsSpec
  module Resources
    describe Suite do
    attr_reader :stdout
    before do
      @stdout = StringIO.new
      Suite.const_set(:STDOUT, stdout)
    end

    after do
      Suite.__send__(:remove_const, :STDOUT)
    end

    describe ".locate" do
      it "when passed an identifier, returns an instance of Suite with the identifier" do
        instance = Suite.locate('foobar')
        instance.class.should == Suite
        instance.id.should == 'foobar'
      end
    end

    describe "#locate" do
      attr_reader :suite
      before do
        @suite = Suite.new('foobar')
      end

      it "when passed 'finish', returns a SuiteFinish that has access to the suite" do
        suite_finish = suite.locate('finish')
        suite_finish.class.should == SuiteFinish
        suite_finish.suite.should == suite
      end

      it "when not passed 'finish', raises ArgumentError" do
        lambda do
          suite.locate('invalid')
        end.should raise_error(ArgumentError, "Invalid path: invalid")
      end
    end
  end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
js_spec-0.2.0 spec/unit/js_spec/resources/suite_spec.rb
js_spec-0.2.1 spec/unit/js_spec/resources/suite_spec.rb