Sha256: 6241f8f890b4b07101a2fba08cda98efd6d0300d4c61f2270887375311bd06eb

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

require "spec_helper"

describe "autotest/discover.rb" do
  before { File.stub(:exist?).and_call_original }

  context "with ./.rspec present" do
    before { File.stub(:exist?).with("./.rspec") { true } }

    context "when RSpec::Autotest is defined" do
      before { stub_const "RSpec::Autotest", Module.new }

      it "does not add 'rspec2' to the list of discoveries" do
        Autotest.should_not_receive(:add_discovery)
        load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
      end
    end

    context "when RSpec::Autotest is not defined" do
      before { hide_const "RSpec::Autotest" }

      it "adds 'rspec2' to the list of discoveries" do
        Autotest.should_receive(:add_discovery)
        load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
      end
    end
  end

  context "with ./.rspec absent" do
    before { File.stub(:exist?).with("./.rspec") { false } }

    context "when RSpec::Autotest is defined" do
      before { stub_const "RSpec::Autotest", Module.new }

      it "does not add 'rspec2' to the list of discoveries" do
        Autotest.should_not_receive(:add_discovery)
        load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
      end
    end

    context "when RSpec::Autotest is not defined" do
      before { hide_const "RSpec::Autotest" }

      it "does not add 'rspec2' to the list of discoveries" do
        Autotest.should_not_receive(:add_discovery)
        load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-core-2.99.2 spec/autotest/discover_spec.rb
rspec-core-2.99.1 spec/autotest/discover_spec.rb
rspec-core-2.99.0 spec/autotest/discover_spec.rb
rspec-core-2.99.0.rc1 spec/autotest/discover_spec.rb