Sha256: b48fbfecb574e2a50033fe69ef9b61180caba5dd48783b21586126c19c9171b9

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require "spec"

describe WatirSplash::Util do

  it "loads ui-test-common" do
    class WatirSplash::Util
      @@ui_test_common_dir = "ui-test-common-for-test"
    end

    begin
      ui_test_common_dir = "../ui-test-common-for-test"
      FileUtils.mkdir(ui_test_common_dir)
      File.open(File.join(ui_test_common_dir, "environment.rb"), "w") do |f|
        f.puts "
module GlobalApplication
  LOADED = true
end"
      end

      lambda {WatirSplash::Util.load_common}.should_not raise_exception
      GlobalApplication::LOADED.should be_true
    ensure
      FileUtils.rm_rf(ui_test_common_dir)
    end
  end

  it "raises exception if ui-test-common is not found" do
    class WatirSplash::Util
      @@ui_test_common_dir = "nonexisting_ui_test_common_dir"
    end

    lambda {WatirSplash::Util.load_common}.
            should raise_exception(RuntimeError,
                                   "nonexisting_ui_test_common_dir directory was not found! It has to exist somewhere higher in directory tree than your project's directory and it has to have environment.rb file in it!")
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watirsplash-0.2.2 spec/util_spec.rb
watirsplash-0.2.1 spec/util_spec.rb
watirsplash-0.2.0 spec/util_spec.rb