dde 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,34 +1,34 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/app_shared')
3
-
4
- module DDETest
5
-
6
- describe DDE::Monitor, " in general" do
7
- it_should_behave_like "DDE App"
8
- end
9
-
10
- describe DDE::Monitor do
11
- before(:each){ }
12
- after(:each){ @monitor.stop_dde if @monitor.dde_active? }
13
- # SEEMS LIKE IT DOESN'T stop system from sending :XTYP_MONITOR transactions to already dead callback :(
14
-
15
-
16
- it 'starts without constructor parameters' do
17
- @monitor = DDE::Monitor.new
18
-
19
- @monitor.id.should be_an Integer
20
- @monitor.id.should_not == 0
21
- @monitor.dde_active?.should == true
22
-
23
- @monitor.init_flags.should == APPCLASS_MONITOR | # this is monitor
24
- MF_CALLBACKS | # monitor callback functions
25
- MF_CONV | # monitor conversation data
26
- MF_ERRORS | # monitor DDEML errors
27
- MF_HSZ_INFO | # monitor data handle activity
28
- MF_LINKS | # monitor advise loops
29
- MF_POSTMSGS | # monitor posted DDE messages
30
- MF_SENDMSGS # monitor sent DDE messages
31
- end
32
-
33
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/app_shared')
3
+
4
+ module DdeTest
5
+
6
+ describe Dde::Monitor, " in general" do
7
+ it_should_behave_like "DDE App"
8
+ end
9
+
10
+ describe Dde::Monitor do
11
+ before(:each){ }
12
+ after(:each){ @monitor.stop_dde if @monitor.dde_active? }
13
+ # SEEMS LIKE IT DOESN'T stop system from sending :XTYP_MONITOR transactions to already dead callback :(
14
+
15
+
16
+ it 'starts without constructor parameters' do
17
+ @monitor = Dde::Monitor.new
18
+
19
+ @monitor.id.should be_an Integer
20
+ @monitor.id.should_not == 0
21
+ @monitor.dde_active?.should == true
22
+
23
+ @monitor.init_flags.should == APPCLASS_MONITOR | # this is monitor
24
+ MF_CALLBACKS | # monitor callback functions
25
+ MF_CONV | # monitor conversation data
26
+ MF_ERRORS | # monitor DDEML errors
27
+ MF_HSZ_INFO | # monitor data handle activity
28
+ MF_LINKS | # monitor advise loops
29
+ MF_POSTMSGS | # monitor posted DDE messages
30
+ MF_SENDMSGS # monitor sent DDE messages
31
+ end
32
+
33
+ end
34
34
  end
@@ -1,92 +1,92 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/app_shared')
2
-
3
- module DDETest
4
- shared_examples_for "DDE Server" do
5
-
6
- it_should_behave_like "DDE App"
7
-
8
- context 'specific to Servers:' do
9
- before(:each ){ @server = described_class.new {|*args|}}
10
- after(:each ){ @server.stop_dde if @server.dde_active?}
11
-
12
- it 'new with attached callback block creates Server and activates DDEML, but does not start service' do
13
- @server = described_class.new {|*args|}
14
- @server.id.should be_an Integer
15
- @server.id.should_not == 0
16
- @server.dde_active?.should == true
17
- @server.service.should == nil
18
- @server.service_active?.should == false
19
- end
20
-
21
- describe '#start_service' do
22
-
23
- context 'with inactive (uninitialized) DDE:' do
24
- it 'with attached block, initializes DDE and starts new service' do
25
- @server.start_service('myservice') {|*args|}.should be_true
26
-
27
- @server.service.should be_a DDE::DdeString
28
- @server.service.should == 'myservice'
29
- @server.service.name.should == 'myservice'
30
- @server.service.handle.should be_an Integer
31
- @server.service.handle.should_not == 0
32
- @server.service_active?.should == true
33
- end
34
-
35
- it 'returns self if success (allows method chain)' do
36
- res = @server.start_service('myservice') {|*args|}
37
- res.should == @server
38
- end
39
- end # context 'with inactive (uninitialized) DDE:'
40
-
41
- context 'with active (initialized) DDE:' do
42
-
43
- it 'starts new service with given name' do
44
- res = @server.start_service 'myservice'
45
- res.should be_true
46
-
47
- @server.service.should be_a DDE::DdeString
48
- @server.service.should == 'myservice'
49
- @server.service.name.should == 'myservice'
50
- @server.service.handle.should be_an Integer
51
- @server.service.handle.should_not == 0
52
- end
53
-
54
- it 'fails to starts new service if name is not a String' do
55
- lambda{@server.start_service(11)}.should raise_error DDE::Errors::ServiceError
56
- @server.service_active?.should == false
57
- end
58
- end # context 'with active (initialized) DDE:'
59
- end # describe '#start_service'
60
-
61
- describe '#stop_service' do
62
- context 'with inactive (uninitialized) DDE:' do
63
- it 'fails to stop service' do
64
- lambda{@server.stop_service}.should raise_error DDE::Errors::ServiceError
65
- end
66
- end
67
-
68
- context 'with active (initialized) DDE: and already registered DDE service: "myservice"' do
69
- before(:each){ @server = described_class.new {|*args|}; @server.start_service('myservice')}
70
- after(:each){ @server.stop_service if @server.service_active?}
71
-
72
- it 'stops previously registered service' do
73
- @server.stop_service.should be_true
74
-
75
- @server.service.should == nil
76
- @server.service_active?.should == false
77
- end
78
-
79
- it 'does not stop DDE instance' do
80
- @server.stop_service
81
- @server.id.should_not == nil
82
- @server.dde_active?.should == true
83
- end
84
-
85
- it 'returns self if success (allows method chain)' do
86
- @server.stop_service.should == @server
87
- end
88
- end # context 'with active (initialized) DDE: and already registered DDE service: "myservice"'
89
- end # describe '#stop_service'
90
- end # context 'specific to Servers:'
91
- end # shared_examples_for "DDE Server"
1
+ require File.expand_path(File.dirname(__FILE__) + '/app_shared')
2
+
3
+ module DdeTest
4
+ shared_examples_for "DDE Server" do
5
+
6
+ it_should_behave_like "DDE App"
7
+
8
+ context 'specific to Servers:' do
9
+ before(:each ){ @server = described_class.new {|*args|}}
10
+ after(:each ){ @server.stop_dde if @server.dde_active?}
11
+
12
+ it 'new with attached callback block creates Server and activates DDEML, but does not start service' do
13
+ @server = described_class.new {|*args|}
14
+ @server.id.should be_an Integer
15
+ @server.id.should_not == 0
16
+ @server.dde_active?.should == true
17
+ @server.service.should == nil
18
+ @server.service_active?.should == false
19
+ end
20
+
21
+ describe '#start_service' do
22
+
23
+ context 'with inactive (uninitialized) DDE:' do
24
+ it 'with attached block, initializes DDE and starts new service' do
25
+ @server.start_service('myservice') {|*args|}.should be_true
26
+
27
+ @server.service.should be_a Dde::DdeString
28
+ @server.service.should == 'myservice'
29
+ @server.service.name.should == 'myservice'
30
+ @server.service.handle.should be_an Integer
31
+ @server.service.handle.should_not == 0
32
+ @server.service_active?.should == true
33
+ end
34
+
35
+ it 'returns self if success (allows method chain)' do
36
+ res = @server.start_service('myservice') {|*args|}
37
+ res.should == @server
38
+ end
39
+ end # context 'with inactive (uninitialized) DDE:'
40
+
41
+ context 'with active (initialized) DDE:' do
42
+
43
+ it 'starts new service with given name' do
44
+ res = @server.start_service 'myservice'
45
+ res.should be_true
46
+
47
+ @server.service.should be_a Dde::DdeString
48
+ @server.service.should == 'myservice'
49
+ @server.service.name.should == 'myservice'
50
+ @server.service.handle.should be_an Integer
51
+ @server.service.handle.should_not == 0
52
+ end
53
+
54
+ it 'fails to starts new service if name is not a String' do
55
+ lambda{@server.start_service(11)}.should raise_error Dde::Errors::ServiceError
56
+ @server.service_active?.should == false
57
+ end
58
+ end # context 'with active (initialized) DDE:'
59
+ end # describe '#start_service'
60
+
61
+ describe '#stop_service' do
62
+ context 'with inactive (uninitialized) DDE:' do
63
+ it 'fails to stop service' do
64
+ lambda{@server.stop_service}.should raise_error Dde::Errors::ServiceError
65
+ end
66
+ end
67
+
68
+ context 'with active (initialized) DDE: and already registered DDE service: "myservice"' do
69
+ before(:each){ @server = described_class.new {|*args|}; @server.start_service('myservice')}
70
+ after(:each){ @server.stop_service if @server.service_active?}
71
+
72
+ it 'stops previously registered service' do
73
+ @server.stop_service.should be_true
74
+
75
+ @server.service.should == nil
76
+ @server.service_active?.should == false
77
+ end
78
+
79
+ it 'does not stop DDE instance' do
80
+ @server.stop_service
81
+ @server.id.should_not == nil
82
+ @server.dde_active?.should == true
83
+ end
84
+
85
+ it 'returns self if success (allows method chain)' do
86
+ @server.stop_service.should == @server
87
+ end
88
+ end # context 'with active (initialized) DDE: and already registered DDE service: "myservice"'
89
+ end # describe '#stop_service'
90
+ end # context 'specific to Servers:'
91
+ end # shared_examples_for "DDE Server"
92
92
  end
@@ -1,37 +1,37 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/server_shared')
3
-
4
- module DDETest
5
-
6
- describe DDE::Server, ' in general:' do
7
- it_should_behave_like "DDE Server"
8
- end
9
-
10
- describe DDE::Server do
11
- before(:each ){ @server = DDE::Server.new }
12
- after(:each) do
13
- @server.stop_service if @server.service_active?
14
- @server.stop_dde if @server.dde_active?
15
- end
16
-
17
- it 'new without parameters creates Server but does not activate DDEML or start service' do
18
- @server.id.should == nil
19
- @server.service.should == nil
20
- @server.dde_active?.should == false
21
- @server.service_active?.should == false
22
- end
23
-
24
- describe '#start_service' do
25
-
26
- it 'service name should be given explicitly' do
27
- expect{@server.start_dde{|*args|}.start_service}.to raise_error ArgumentError, /0 for 1/
28
- expect{@server.start_service {|*args|}}.to raise_error ArgumentError, /0 for 1/
29
- end
30
-
31
- it 'callback block should be given explicitly' do
32
- lambda{@server.start_service('myservice')}.should raise_error DDE::Errors::ServiceError
33
- @server.service_active?.should == false
34
- end
35
- end #describe '#start_service'
36
- end # describe DDE::Server do
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/server_shared')
3
+
4
+ module DdeTest
5
+
6
+ describe Dde::Server, ' in general:' do
7
+ it_should_behave_like "DDE Server"
8
+ end
9
+
10
+ describe Dde::Server do
11
+ before(:each ){ @server = Dde::Server.new }
12
+ after(:each) do
13
+ @server.stop_service if @server.service_active?
14
+ @server.stop_dde if @server.dde_active?
15
+ end
16
+
17
+ it 'new without parameters creates Server but does not activate DDEML or start service' do
18
+ @server.id.should == nil
19
+ @server.service.should == nil
20
+ @server.dde_active?.should == false
21
+ @server.service_active?.should == false
22
+ end
23
+
24
+ describe '#start_service' do
25
+
26
+ it 'service name should be given explicitly' do
27
+ expect{@server.start_dde{|*args|}.start_service}.to raise_error ArgumentError, /0 for 1/
28
+ expect{@server.start_service {|*args|}}.to raise_error ArgumentError, /0 for 1/
29
+ end
30
+
31
+ it 'callback block should be given explicitly' do
32
+ lambda{@server.start_service('myservice')}.should raise_error Dde::Errors::ServiceError
33
+ @server.service_active?.should == false
34
+ end
35
+ end #describe '#start_service'
36
+ end # describe Dde::Server do
37
37
  end
@@ -1,63 +1,63 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/server_shared')
3
-
4
- module DDETest
5
-
6
- describe DDE::XlServer, ' in general:' do
7
- it_should_behave_like "DDE Server"
8
- end
9
-
10
- describe DDE::XlServer do
11
- before(:each ){ @server = DDE::XlServer.new }
12
- after(:each) do
13
- @server.stop_service if @server.service_active?
14
- @server.stop_dde if @server.dde_active?
15
- end
16
-
17
- it 'new without parameters has empty data attribute' do
18
- @server.data.should be_an DDE::XlTable
19
- @server.data.should be_empty
20
- end
21
-
22
- it 'new with attached callback block has empty data attribute' do
23
- server = DDE::XlServer.new {|*args|}
24
- @server.data.should be_an DDE::XlTable
25
- @server.data.should be_empty
26
- end
27
-
28
- describe '#start_service' do
29
- context 'with inactive (uninitialized) DDE:' do
30
- it 'service name defaults to "excel" if not given explicitly' do
31
- @server.start_service {|*args|}.should be_true
32
-
33
- @server.service.should be_a DDE::DdeString
34
- @server.service.should == 'excel'
35
- @server.service.name.should == 'excel'
36
- @server.service.handle.should be_an Integer
37
- @server.service.handle.should_not == 0
38
- @server.service_active?.should == true
39
- end
40
-
41
- it 'starts new service with default callback block' do
42
- @server.start_service('myservice1')
43
- @server.service_active?.should == true
44
- @server.service.name.should == 'myservice1'
45
- end
46
- end
47
-
48
- context 'with active (initialized) DDE:' do
49
- before(:each ){ @server = DDE::XlServer.new {|*args|}}
50
-
51
- it 'service name defaults to "excel" if not given explicitly' do
52
- @server.start_service.should be_true
53
-
54
- @server.service.should be_a DDE::DdeString
55
- @server.service.should == 'excel'
56
- @server.service.name.should == 'excel'
57
- @server.service.handle.should be_an Integer
58
- @server.service.handle.should_not == 0
59
- end
60
- end # context 'with active (initialized) DDE:'
61
- end # describe '#start_service'
62
- end # describe DDE::XlServer
63
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/server_shared')
3
+
4
+ module DdeTest
5
+
6
+ describe Dde::XlServer, ' in general:' do
7
+ it_should_behave_like "DDE Server"
8
+ end
9
+
10
+ describe Dde::XlServer do
11
+ before(:each ){ @server = Dde::XlServer.new }
12
+ after(:each) do
13
+ @server.stop_service if @server.service_active?
14
+ @server.stop_dde if @server.dde_active?
15
+ end
16
+
17
+ it 'new without parameters has empty data attribute' do
18
+ @server.data.should be_an Dde::XlTable
19
+ @server.data.should be_empty
20
+ end
21
+
22
+ it 'new with attached callback block has empty data attribute' do
23
+ server = Dde::XlServer.new {|*args|}
24
+ @server.data.should be_an Dde::XlTable
25
+ @server.data.should be_empty
26
+ end
27
+
28
+ describe '#start_service' do
29
+ context 'with inactive (uninitialized) DDE:' do
30
+ it 'service name defaults to "excel" if not given explicitly' do
31
+ @server.start_service {|*args|}.should be_true
32
+
33
+ @server.service.should be_a Dde::DdeString
34
+ @server.service.should == 'excel'
35
+ @server.service.name.should == 'excel'
36
+ @server.service.handle.should be_an Integer
37
+ @server.service.handle.should_not == 0
38
+ @server.service_active?.should == true
39
+ end
40
+
41
+ it 'starts new service with default callback block' do
42
+ @server.start_service('myservice1')
43
+ @server.service_active?.should == true
44
+ @server.service.name.should == 'myservice1'
45
+ end
46
+ end
47
+
48
+ context 'with active (initialized) DDE:' do
49
+ before(:each ){ @server = Dde::XlServer.new {|*args|}}
50
+
51
+ it 'service name defaults to "excel" if not given explicitly' do
52
+ @server.start_service.should be_true
53
+
54
+ @server.service.should be_a Dde::DdeString
55
+ @server.service.should == 'excel'
56
+ @server.service.name.should == 'excel'
57
+ @server.service.handle.should be_an Integer
58
+ @server.service.handle.should_not == 0
59
+ end
60
+ end # context 'with active (initialized) DDE:'
61
+ end # describe '#start_service'
62
+ end # describe Dde::XlServer
63
+ end