sleipnir-api 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +41 -0
  4. data/README.txt +56 -0
  5. data/Rakefile +201 -0
  6. data/TODO.txt +11 -0
  7. data/examples/reload.rb +18 -0
  8. data/helper/helper.rb +3 -0
  9. data/helper/rake.rb +58 -0
  10. data/helper/rake_sh_filter.rb +23 -0
  11. data/helper/util.rb +19 -0
  12. data/lib/sleipnir_api.rb +177 -0
  13. data/lib/sleipnir_api/dialog.rb +155 -0
  14. data/lib/sleipnir_api/key_state.rb +49 -0
  15. data/lib/sleipnir_api/output.rb +319 -0
  16. data/lib/sleipnir_api/process.rb +69 -0
  17. data/lib/sleipnir_api/profile.rb +332 -0
  18. data/lib/sleipnir_api/registry.rb +30 -0
  19. data/lib/sleipnir_api/security.rb +263 -0
  20. data/lib/sleipnir_api/sleipnir.rb +489 -0
  21. data/lib/sleipnir_api/tab.rb +359 -0
  22. data/lib/sleipnir_api/util.rb +16 -0
  23. data/lib/sleipnir_api/version.rb +9 -0
  24. data/lib/sleipnir_api/win32api.rb +17 -0
  25. data/scripts/rdoc_filter.rb +74 -0
  26. data/setup.rb +1585 -0
  27. data/spec/matchers/path_eql.rb +41 -0
  28. data/spec/sleipnir_api/dialog_mock_spec.rb +99 -0
  29. data/spec/sleipnir_api/key_state_mock_spec.rb +72 -0
  30. data/spec/sleipnir_api/output_spec.rb +242 -0
  31. data/spec/sleipnir_api/profile_mock_spec.rb +128 -0
  32. data/spec/sleipnir_api/registry_spec.rb +13 -0
  33. data/spec/sleipnir_api/security_mock_spec.rb +82 -0
  34. data/spec/sleipnir_api/security_spec.rb +129 -0
  35. data/spec/sleipnir_api/sleipnir_mock_spec.rb +70 -0
  36. data/spec/sleipnir_api/sleipnir_spec.rb +295 -0
  37. data/spec/sleipnir_api/tab_mock_spec.rb +98 -0
  38. data/spec/sleipnir_api/tab_spec.rb +105 -0
  39. data/spec/sleipnir_api_spec.rb +17 -0
  40. data/spec/spec.opts +0 -0
  41. data/spec/spec_helper.rb +8 -0
  42. metadata +91 -0
@@ -0,0 +1,98 @@
1
+ require File.join(File.dirname(__FILE__), "../spec_helper.rb")
2
+
3
+ describe SleipnirAPI::Tab, "(with mock)" do
4
+
5
+ before(:all) do
6
+ @pnir = SleipnirAPI.connect
7
+ @blank = @pnir.new_tab
8
+ @api = @pnir.instance_variable_get(:@api)
9
+ end
10
+
11
+ after(:all) do
12
+ @pnir.instance_variable_set(:@api, @api)
13
+ @blank.close
14
+ end
15
+
16
+ before do
17
+ @mock = mock("Sleipnir.API")
18
+ @pnir.instance_variable_set(:@api, @mock)
19
+ end
20
+
21
+
22
+ it "#document should send GetDocumentObject" do
23
+ @mock.should_receive(:GetDocumentObject).with(@blank.id)
24
+ @blank.document
25
+ end
26
+
27
+ it "#window should send GetWindowObject" do
28
+ @mock.should_receive(:GetWindowObject).with(@blank.id)
29
+ @blank.window
30
+ end
31
+
32
+ it "#browser should send GetWebBrowserObject" do
33
+ @mock.should_receive(:GetWebBrowserObject).with(@blank.id).twice
34
+ @blank.browser
35
+ @blank.web_browser
36
+ end
37
+
38
+ it "#index should send GetIndex" do
39
+ @mock.should_receive(:GetIndex).with(@blank.id)
40
+ @blank.index
41
+ end
42
+
43
+ it "#close should send Close" do
44
+ @mock.should_receive(:Close).with(@blank.id)
45
+ @blank.close
46
+ end
47
+
48
+ it "#navigate should send Navigate" do
49
+ @mock.should_receive(:Navigate).with(@blank.id, "about:foobar")
50
+ @blank.navigate("about:foobar")
51
+ end
52
+
53
+ it "#search should send Search" do
54
+ @mock.should_receive(:Search).with(@blank.id, "keyword")
55
+ @blank.search("keyword")
56
+ end
57
+
58
+ it "#hilight should send Hilight" do
59
+ @mock.should_receive(:Hilight).with(@blank.id, "keyword")
60
+ @blank.hilight("keyword")
61
+ end
62
+
63
+ it "#busy? should send IsBusy" do
64
+ @mock.should_receive(:IsBusy).with(@blank.id)
65
+ @blank.busy?
66
+ end
67
+
68
+ it "#read? should send IsRead" do
69
+ @mock.should_receive(:IsRead).with(@blank.id)
70
+ @blank.read?
71
+ end
72
+
73
+ it "#navigate_lock? should send IsNavigateLock" do
74
+ @mock.should_receive(:IsNavigateLock).with(@blank.id)
75
+ @blank.navigate_lock?
76
+ end
77
+
78
+ it "#navigate_lock= should send SetNavigateLock" do
79
+ @mock.should_receive(:SetNavigateLock).with(@blank.id, true)
80
+ @blank.navigate_lock = true
81
+ end
82
+
83
+ it "#navigate_lock= should send SetNavigateLock" do
84
+ @mock.should_receive(:SetNavigateLock).with(@blank.id, false)
85
+ @blank.navigate_lock = false
86
+ end
87
+
88
+ it "#auto_refresh should send GetAutoRefresh" do
89
+ @mock.should_receive(:GetAutoRefresh).with(@blank.id)
90
+ @blank.auto_refresh
91
+ end
92
+
93
+ it "#auto_refresh= should send SetAutoRefresh" do
94
+ @mock.should_receive(:SetAutoRefresh).with(@blank.id, 123)
95
+ @blank.auto_refresh = 123
96
+ end
97
+
98
+ end
@@ -0,0 +1,105 @@
1
+ require File.join(File.dirname(__FILE__), "../spec_helper.rb")
2
+
3
+ describe SleipnirAPI::Tab do
4
+
5
+ before(:all) do
6
+ @pnir = SleipnirAPI.connect
7
+ @xxxx = @pnir.open("about:xxxx", true)
8
+ @test = @pnir.open("about:test", true)
9
+ sleep(0.1) while @test.busy?
10
+ end
11
+
12
+ after(:all) do
13
+ @test.close
14
+ @xxxx.close
15
+ end
16
+
17
+
18
+ it "#id should return document ID" do
19
+ @test.id.should == @pnir.api.GetDocumentId(@test.index)
20
+ end
21
+
22
+ it "#window should return DispHTMLWindow2" do
23
+ v = @test.window
24
+ v.should be_an_instance_of(WIN32OLE)
25
+ v.ole_obj_help.name.should eql("DispHTMLWindow2")
26
+ end
27
+
28
+ it "#document should return DispHTMLDocument" do
29
+ v = @test.document
30
+ v.should be_an_instance_of(WIN32OLE)
31
+ v.ole_obj_help.name.should eql("DispHTMLDocument")
32
+ end
33
+
34
+ it "#browser should return IWebBrowser2" do
35
+ v = @test.browser
36
+ v.should be_an_instance_of(WIN32OLE)
37
+ v.ole_obj_help.name.should eql("IWebBrowser2")
38
+ end
39
+
40
+ it "#location should return IHTMLLocation" do
41
+ v = @test.location
42
+ v.should be_an_instance_of(WIN32OLE)
43
+ v.ole_obj_help.name.should eql("IHTMLLocation")
44
+ end
45
+
46
+ it "#active? should return true if ActiveIndex == self.index" do
47
+ @test.index.should == @pnir.active_index
48
+ @test.should be_active
49
+
50
+ t = @pnir.new_tab("about:foobar", true)
51
+ begin
52
+ t.index.should == @pnir.active_index
53
+ @test.index.should_not == @pnir.active_index
54
+ @test.should_not be_active
55
+ ensure
56
+ t.close
57
+ end
58
+ end
59
+
60
+ it "#navigate should load new url" do
61
+ t = @pnir.new_tab
62
+ begin
63
+ t.location.href.should eql("about:blank")
64
+ t.navigate("about:foobar")
65
+ sleep(0.1) while t.busy?
66
+ t.location.href.should eql("about:foobar")
67
+ ensure
68
+ t.close
69
+ end
70
+ end
71
+
72
+ it "#navigate_lock[=?] should set/get navigate lock state" do
73
+ @test.navigate_lock?.should be_false
74
+ begin
75
+ @test.navigate_lock = true
76
+ @test.navigate_lock?.should be_true
77
+ ensure
78
+ @test.navigate_lock = false
79
+ end
80
+ end
81
+
82
+ it "#auto_refresh[=?] should set/get auto refresh time(sec)" do
83
+ saved = @test.auto_refresh
84
+ begin
85
+ @test.auto_refresh = 100
86
+ @test.auto_refresh.should == 100
87
+ ensure
88
+ @test.auto_refresh = saved
89
+ end
90
+ end
91
+
92
+ it "#== should return true if argument has same document ID" do
93
+ test = @pnir.get_url_tab("about:test")
94
+ test.id.should == @test.id
95
+
96
+ test.should == @test
97
+ test.should_not equal(@test)
98
+
99
+ test.should_not == nil
100
+ test.should_not == 1
101
+ test.should_not == "foobar"
102
+ test.should_not == @test.id
103
+ end
104
+
105
+ end
@@ -0,0 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), "spec_helper.rb")
2
+
3
+ describe SleipnirAPI do
4
+
5
+ it "#connect should return SleipnirAPI::Sleipnir" do
6
+ pnir = SleipnirAPI.connect
7
+ pnir.should be_an_instance_of(SleipnirAPI::Sleipnir)
8
+ end
9
+
10
+ it "#connect should take a block" do
11
+ pnir = nil
12
+ r = SleipnirAPI.connect {|arg| pnir = arg; "foobar" }
13
+ r.should == "foobar"
14
+ pnir.should be_an_instance_of(SleipnirAPI::Sleipnir)
15
+ end
16
+
17
+ end
File without changes
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "../lib")
2
+ require "sleipnir_api"
3
+
4
+ require "rubygems"
5
+ require "spec"
6
+
7
+ $LOAD_PATH << File.join(File.dirname(__FILE__))
8
+ require "matchers/path_eql"
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: sleipnir-api
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-07-22 00:00:00 +09:00
8
+ summary: Ruby interface to the Sleipnir.API WIN32OLE object.
9
+ require_paths:
10
+ - lib
11
+ email: miyamuko@gmail.com
12
+ homepage: http://sleipnir-api.rubyforge.org
13
+ rubyforge_project: sleipnir-api
14
+ description: Ruby interface to the Sleipnir.API WIN32OLE object.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - MIYAMUKO Katsuyuki
31
+ files:
32
+ - History.txt
33
+ - License.txt
34
+ - Manifest.txt
35
+ - README.txt
36
+ - Rakefile
37
+ - TODO.txt
38
+ - examples/reload.rb
39
+ - helper/helper.rb
40
+ - helper/rake.rb
41
+ - helper/rake_sh_filter.rb
42
+ - helper/util.rb
43
+ - lib/sleipnir_api.rb
44
+ - lib/sleipnir_api/dialog.rb
45
+ - lib/sleipnir_api/key_state.rb
46
+ - lib/sleipnir_api/output.rb
47
+ - lib/sleipnir_api/process.rb
48
+ - lib/sleipnir_api/profile.rb
49
+ - lib/sleipnir_api/registry.rb
50
+ - lib/sleipnir_api/security.rb
51
+ - lib/sleipnir_api/sleipnir.rb
52
+ - lib/sleipnir_api/tab.rb
53
+ - lib/sleipnir_api/util.rb
54
+ - lib/sleipnir_api/version.rb
55
+ - lib/sleipnir_api/win32api.rb
56
+ - scripts/rdoc_filter.rb
57
+ - setup.rb
58
+ - spec/matchers/path_eql.rb
59
+ - spec/sleipnir_api/dialog_mock_spec.rb
60
+ - spec/sleipnir_api/key_state_mock_spec.rb
61
+ - spec/sleipnir_api/output_spec.rb
62
+ - spec/sleipnir_api/profile_mock_spec.rb
63
+ - spec/sleipnir_api/registry_spec.rb
64
+ - spec/sleipnir_api/security_mock_spec.rb
65
+ - spec/sleipnir_api/security_spec.rb
66
+ - spec/sleipnir_api/sleipnir_mock_spec.rb
67
+ - spec/sleipnir_api/sleipnir_spec.rb
68
+ - spec/sleipnir_api/tab_mock_spec.rb
69
+ - spec/sleipnir_api/tab_spec.rb
70
+ - spec/sleipnir_api_spec.rb
71
+ - spec/spec.opts
72
+ - spec/spec_helper.rb
73
+ test_files: []
74
+
75
+ rdoc_options:
76
+ - --main
77
+ - README.txt
78
+ extra_rdoc_files:
79
+ - History.txt
80
+ - License.txt
81
+ - Manifest.txt
82
+ - README.txt
83
+ - TODO.txt
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ requirements: []
89
+
90
+ dependencies: []
91
+