summaryrefslogtreecommitdiff
path: root/spec/ruby/library/win32ole/win32ole/const_load_spec.rb
blob: 2099c4aa66d4e6a75b9354595e7c6373c626a585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require_relative "../../../spec_helper"
platform_is :windows do
  require_relative '../fixtures/classes'

  describe "WIN32OLE.const_load when passed Shell.Application OLE object" do
    before :each do
      @win32ole = WIN32OLESpecs.new_ole 'Shell.Application'
    end

    it "loads constant SsfWINDOWS into WIN32OLE namespace" do
      WIN32OLE.const_defined?(:SsfWINDOWS).should be_false
      WIN32OLE.const_load @win32ole
      WIN32OLE.const_defined?(:SsfWINDOWS).should be_true
    end
  end

  describe "WIN32OLE.const_load when namespace is specified" do
    before :each do
      module WIN32OLE_RUBYSPEC; end
      @win32ole = WIN32OLESpecs.new_ole 'Shell.Application'
    end

    it "loads constants into given namespace" do
      module WIN32OLE_RUBYSPEC; end

      WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should be_false
      WIN32OLE.const_load @win32ole, WIN32OLE_RUBYSPEC
      WIN32OLE_RUBYSPEC.const_defined?(:SsfWINDOWS).should be_true

    end
  end

end