sleipnir-api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/Manifest.txt +7 -0
- data/README.txt +10 -4
- data/TODO.txt +21 -4
- data/bin/grepnir +91 -0
- data/examples/close_dup.rb +17 -0
- data/lib/sleipnir_api/cli/base.rb +77 -0
- data/lib/sleipnir_api/cli/grepnir.rb +188 -0
- data/lib/sleipnir_api/output.rb +2 -2
- data/lib/sleipnir_api/tab.rb +69 -9
- data/lib/sleipnir_api/util.rb +4 -0
- data/lib/sleipnir_api/version.rb +1 -1
- data/spec/dsl/behaviour_eval.rb +5 -0
- data/spec/matchers/exit_with.rb +35 -0
- data/spec/matchers/path_eql.rb +24 -26
- data/spec/sleipnir_api/cli/grepnir_spec.rb +341 -0
- data/spec/sleipnir_api/dialog_mock_spec.rb +1 -1
- data/spec/sleipnir_api/key_state_mock_spec.rb +1 -1
- data/spec/sleipnir_api/security_mock_spec.rb +1 -1
- data/spec/sleipnir_api/security_spec.rb +1 -1
- data/spec/sleipnir_api/sleipnir_spec.rb +20 -20
- data/spec/sleipnir_api/tab_mock_spec.rb +20 -2
- data/spec/sleipnir_api/tab_spec.rb +16 -3
- data/spec/spec_helper.rb +17 -0
- metadata +11 -4
@@ -12,8 +12,8 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
after(:all) do
|
15
|
-
@test.close
|
16
|
-
@xxxx.close
|
15
|
+
@test.close(true)
|
16
|
+
@xxxx.close(true)
|
17
17
|
end
|
18
18
|
|
19
19
|
|
@@ -113,7 +113,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
113
113
|
t.location.href.should eql("about:blank")
|
114
114
|
t.should be_active
|
115
115
|
ensure
|
116
|
-
t.close
|
116
|
+
t.close(true)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -123,7 +123,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
123
123
|
t.location.href.should eql("about:new_tab1")
|
124
124
|
t.should be_active
|
125
125
|
ensure
|
126
|
-
t.close
|
126
|
+
t.close(true)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -133,7 +133,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
133
133
|
begin
|
134
134
|
t.should_not be_active
|
135
135
|
ensure
|
136
|
-
t.close
|
136
|
+
t.close(true)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -144,7 +144,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
144
144
|
t.location.href.should eql("about:open1")
|
145
145
|
t.should be_active
|
146
146
|
ensure
|
147
|
-
t.close
|
147
|
+
t.close(true)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -155,7 +155,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
155
155
|
begin
|
156
156
|
t.should_not be_active
|
157
157
|
ensure
|
158
|
-
t.close
|
158
|
+
t.close(true)
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -165,7 +165,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
165
165
|
begin
|
166
166
|
@pnir.count.should == (now + 1)
|
167
167
|
ensure
|
168
|
-
new.close
|
168
|
+
new.close(true)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
@@ -254,7 +254,7 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
254
254
|
t2.should be_active
|
255
255
|
@test.should_not be_active
|
256
256
|
ensure
|
257
|
-
t.close
|
257
|
+
t.close(true)
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
@@ -265,13 +265,13 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
265
265
|
t.should be_active
|
266
266
|
@test.should_not be_active
|
267
267
|
|
268
|
-
|
269
|
-
|
268
|
+
test2 = @pnir.switch_to_tab("about:test")
|
269
|
+
test2.should == @test
|
270
270
|
|
271
|
-
|
272
|
-
|
271
|
+
t.should_not be_active
|
272
|
+
@test.should be_active
|
273
273
|
ensure
|
274
|
-
t.close
|
274
|
+
t.close(true)
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
@@ -282,13 +282,13 @@ describe SleipnirAPI::Sleipnir, "(with blank page)" do
|
|
282
282
|
t.should be_active
|
283
283
|
@test.should_not be_active
|
284
284
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
285
|
+
test2 = @pnir.switch_to_tab(@test)
|
286
|
+
test2.should == @test
|
287
|
+
|
288
|
+
t.should_not be_active
|
289
|
+
@test.should be_active
|
290
290
|
ensure
|
291
|
-
t.close
|
291
|
+
t.close(true)
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
@@ -10,7 +10,7 @@ describe SleipnirAPI::Tab, "(with mock)" do
|
|
10
10
|
|
11
11
|
after(:all) do
|
12
12
|
@pnir.instance_variable_set(:@api, @api)
|
13
|
-
@blank.close
|
13
|
+
@blank.close(true)
|
14
14
|
end
|
15
15
|
|
16
16
|
before do
|
@@ -45,6 +45,19 @@ describe SleipnirAPI::Tab, "(with mock)" do
|
|
45
45
|
@blank.close
|
46
46
|
end
|
47
47
|
|
48
|
+
it "#close(true) should send SetNavigateLock and Close if locked" do
|
49
|
+
@mock.should_receive(:IsNavigateLock).with(@blank.id).and_return(true)
|
50
|
+
@mock.should_receive(:SetNavigateLock).with(@blank.id, false)
|
51
|
+
@mock.should_receive(:Close).with(@blank.id)
|
52
|
+
@blank.close(true)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "#close(true) should send Close unless locked" do
|
56
|
+
@mock.should_receive(:IsNavigateLock).with(@blank.id).and_return(false)
|
57
|
+
@mock.should_receive(:Close).with(@blank.id)
|
58
|
+
@blank.close(true)
|
59
|
+
end
|
60
|
+
|
48
61
|
it "#navigate should send Navigate" do
|
49
62
|
@mock.should_receive(:Navigate).with(@blank.id, "about:foobar")
|
50
63
|
@blank.navigate("about:foobar")
|
@@ -56,10 +69,15 @@ describe SleipnirAPI::Tab, "(with mock)" do
|
|
56
69
|
end
|
57
70
|
|
58
71
|
it "#hilight should send Hilight" do
|
59
|
-
@mock.should_receive(:Hilight).with(@blank.id, "keyword")
|
72
|
+
@mock.should_receive(:Hilight).with(@blank.id, %Q,"keyword",)
|
60
73
|
@blank.hilight("keyword")
|
61
74
|
end
|
62
75
|
|
76
|
+
it "#hilight should join multiple keyword" do
|
77
|
+
@mock.should_receive(:Hilight).with(@blank.id, %Q,"keyword" "sleipnir ruby",)
|
78
|
+
@blank.hilight("keyword", "sleipnir ruby")
|
79
|
+
end
|
80
|
+
|
63
81
|
it "#busy? should send IsBusy" do
|
64
82
|
@mock.should_receive(:IsBusy).with(@blank.id)
|
65
83
|
@blank.busy?
|
@@ -10,8 +10,8 @@ describe SleipnirAPI::Tab do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
after(:all) do
|
13
|
-
@test.close
|
14
|
-
@xxxx.close
|
13
|
+
@test.close(true)
|
14
|
+
@xxxx.close(true)
|
15
15
|
end
|
16
16
|
|
17
17
|
|
@@ -53,7 +53,20 @@ describe SleipnirAPI::Tab do
|
|
53
53
|
@test.index.should_not == @pnir.active_index
|
54
54
|
@test.should_not be_active
|
55
55
|
ensure
|
56
|
+
t.close(true)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it "#close(true) should close locked tab." do
|
61
|
+
t = @pnir.new_tab
|
62
|
+
begin
|
63
|
+
t.navigate_lock = true
|
56
64
|
t.close
|
65
|
+
t.index.should_not == -1
|
66
|
+
t.close(true)
|
67
|
+
t.index.should == -1
|
68
|
+
ensure
|
69
|
+
t.close(true)
|
57
70
|
end
|
58
71
|
end
|
59
72
|
|
@@ -65,7 +78,7 @@ describe SleipnirAPI::Tab do
|
|
65
78
|
sleep(0.1) while t.busy?
|
66
79
|
t.location.href.should eql("about:foobar")
|
67
80
|
ensure
|
68
|
-
t.close
|
81
|
+
t.close(true)
|
69
82
|
end
|
70
83
|
end
|
71
84
|
|
data/spec/spec_helper.rb
CHANGED
@@ -6,3 +6,20 @@ require "spec"
|
|
6
6
|
|
7
7
|
$LOAD_PATH << File.join(File.dirname(__FILE__))
|
8
8
|
require "matchers/path_eql"
|
9
|
+
require "matchers/exit_with"
|
10
|
+
require "dsl/behaviour_eval"
|
11
|
+
|
12
|
+
|
13
|
+
require "optparse"
|
14
|
+
module OptionParserSpecHelper
|
15
|
+
def args(arr)
|
16
|
+
case arr
|
17
|
+
when Array
|
18
|
+
arr.extend(OptionParser::Arguable)
|
19
|
+
when String
|
20
|
+
args(arr.split(/\s+/))
|
21
|
+
else
|
22
|
+
args(arr.to_a)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sleipnir-api
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-07-
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2007-07-29 00:00:00 +09:00
|
8
8
|
summary: Ruby interface to the Sleipnir.API WIN32OLE object.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -35,12 +35,16 @@ files:
|
|
35
35
|
- README.txt
|
36
36
|
- Rakefile
|
37
37
|
- TODO.txt
|
38
|
+
- bin/grepnir
|
39
|
+
- examples/close_dup.rb
|
38
40
|
- examples/reload.rb
|
39
41
|
- helper/helper.rb
|
40
42
|
- helper/rake.rb
|
41
43
|
- helper/rake_sh_filter.rb
|
42
44
|
- helper/util.rb
|
43
45
|
- lib/sleipnir_api.rb
|
46
|
+
- lib/sleipnir_api/cli/base.rb
|
47
|
+
- lib/sleipnir_api/cli/grepnir.rb
|
44
48
|
- lib/sleipnir_api/dialog.rb
|
45
49
|
- lib/sleipnir_api/key_state.rb
|
46
50
|
- lib/sleipnir_api/output.rb
|
@@ -55,7 +59,10 @@ files:
|
|
55
59
|
- lib/sleipnir_api/win32api.rb
|
56
60
|
- scripts/rdoc_filter.rb
|
57
61
|
- setup.rb
|
62
|
+
- spec/dsl/behaviour_eval.rb
|
63
|
+
- spec/matchers/exit_with.rb
|
58
64
|
- spec/matchers/path_eql.rb
|
65
|
+
- spec/sleipnir_api/cli/grepnir_spec.rb
|
59
66
|
- spec/sleipnir_api/dialog_mock_spec.rb
|
60
67
|
- spec/sleipnir_api/key_state_mock_spec.rb
|
61
68
|
- spec/sleipnir_api/output_spec.rb
|
@@ -81,8 +88,8 @@ extra_rdoc_files:
|
|
81
88
|
- Manifest.txt
|
82
89
|
- README.txt
|
83
90
|
- TODO.txt
|
84
|
-
executables:
|
85
|
-
|
91
|
+
executables:
|
92
|
+
- grepnir
|
86
93
|
extensions: []
|
87
94
|
|
88
95
|
requirements: []
|