ass_tests 1.2.0.alpha → 2.0.0.alpha

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5759b3b984cf4cc39328bc1000524c7219abbb17
4
- data.tar.gz: d1b60660362f009f702cc52b20e412b10430a8d7
3
+ metadata.gz: b78be6444481da3348e90016698fc3f76e83f003
4
+ data.tar.gz: ba2dc6b4fc10c6e434518753671e57cf106b540c
5
5
  SHA512:
6
- metadata.gz: 1dbc3df6a7bc7f6fb6380c63fe4a838fea03de32e799af5af3684f6a462ce428f2110cc28abc4490b251039c52f164cc0f9ddb5e7c067134bbe98a149c0990e1
7
- data.tar.gz: ff6c2770137227159bef588d836b84e42b144d30e3ca7c9f3942cd477ec6b712120de92c87bbb57b07a20cfd4d71a0247f94fe3ef6669504a9a6d23374364fcc
6
+ metadata.gz: 7b362b76b12415ab195d40a8ad2e06ef9ff60ebc41008faf11ae16867a985541dea38e0512de10990ed70dc5e5e2cc99e6c516c649eef0a8822bb9d6690f8a0c
7
+ data.tar.gz: c71472e4cbb111221ce1874cf300f88060f6f3f47e262ddb3a16e488aaf8d69bd0438ba7e1e008319b072e3065185cb5cdf767e76acd05facaa9e16527b2c7ff
@@ -12,100 +12,118 @@ module Minitest
12
12
  end
13
13
 
14
14
  module AssTests
15
- module Assertions
16
- UNKNOWN_XML_TYPE = 'UNKNOWN_XML_TYPE'
17
-
18
- GOOD_OLE_CONNECTORS = [
19
- AssLauncher::Enterprise::Ole::IbConnection,
20
- AssLauncher::Enterprise::Ole::ThickApplication
21
- ]
22
- def _assert_xml_type(exp, obj, mess = nil)
23
- act = xml_type_get(obj)
24
- mess = message(mess) do
25
- "Expected #{exp} xml type but #{act} given"
15
+ module Minitest
16
+ module Assertions
17
+ # @api private
18
+ module Comparable
19
+ UNKNOWN_XML_TYPE = 'UNKNOWN_XML_TYPE'
20
+ SRV_CONNECTORS = [AssLauncher::Enterprise::Ole::IbConnection,
21
+ AssLauncher::Enterprise::Ole::ThickApplication]
22
+
23
+ class ClientContext
24
+ attr_reader :obj, :ole_connector
25
+ def initialize(obj, ole_connector)
26
+ @obj = obj
27
+ @ole_connector = ole_connector
28
+ end
29
+
30
+ def string_internal
31
+ fail NotImplementedError,
32
+ "You should patch method #string_internal in class: #{self.class.name}"
33
+ end
34
+
35
+ def xml_type
36
+ fail NotImplementedError,
37
+ "You should patch method #xml_type in class: #{self.class.name}"
38
+ end
39
+
40
+ def as_string
41
+ ole_connector.sTring obj
42
+ end
43
+
44
+ def make
45
+ r = {}
46
+ r[:as_string] = as_string
47
+ r[:xml_type] = xml_type
48
+ r[:as_string_internal] = string_internal
49
+ r
50
+ end
51
+ end
52
+
53
+ class SrvContext < ClientContext
54
+ def string_internal
55
+ ole_connector.ValueToStringInternal obj
56
+ end
57
+
58
+ def xml_type
59
+ return UNKNOWN_XML_TYPE if ole_connector.xmlTypeOf(obj).nil?
60
+ ole_connector.xmlTypeOf(obj).typeName
61
+ end
62
+ end
63
+
64
+ def self.new(obj, ole_connector)
65
+ return SrvContext.new(obj, ole_connector) if\
66
+ SRV_CONNECTORS.include? ole_connector.class
67
+ ClientContext.new(obj, ole_connector)
68
+ end
26
69
  end
27
- assert exp == act, mess
28
- end
29
-
30
- def _assert_ref_empty(obj, mess = nil)
31
- mess = message(mess) {"Ref must be empty"}
32
- assert obj.ref.IsEmpty, mess
33
- end
34
-
35
- def _refute_ref_empty(obj, mess = nil)
36
- mess = message(mess) {"Ref must not be empty"}
37
- refute obj.ref.IsEmpty, mess
38
- end
39
-
40
- def _assert_equal(exp, act, mess = nil)
41
- fail_not_comparable(exp, act) if not_comparable?(exp, act)
42
- exp_ = to_comparable(exp)
43
- act_ = to_comparable(act)
44
- mess = message(mess, Minitest::Assertions::E){diff exp_, act_}
45
- assert exp_ == act_, mess
46
- end
47
70
 
48
- def to_comparable(obj)
49
- return obj unless obj.is_a? WIN32OLE
50
- return obj.__real_obj__ if obj.__ruby__?
51
- # TODO: make comparsation ruby object from internal Ass string
71
+ def _assert_xml_type(exp, obj, mess = nil)
72
+ act = Comparable.new(obj, ole_connector).xml_type
73
+ mess = message(mess) do
74
+ "Expected #{exp} xml type but #{act} given"
75
+ end
76
+ assert exp == act, mess
77
+ end
52
78
 
53
- return to_comparable_srv_context(obj) if\
54
- GOOD_OLE_CONNECTORS.include? ole_connector.class
55
- to_comparable_client_context(obj)
56
- end
57
- private :to_comparable
79
+ def _assert_ref_empty(obj, mess = nil)
80
+ mess = message(mess) {"Ref must be empty"}
81
+ assert obj.ref.IsEmpty, mess
82
+ end
58
83
 
59
- def to_comparable_client_context(obj)
60
- fail 'You should define own method #to_comparable_client_context'\
61
- ' and returns #new_comparable Hash'
62
- end
63
- private :to_comparable_client_context
84
+ def _refute_ref_empty(obj, mess = nil)
85
+ mess = message(mess) {"Ref must not be empty"}
86
+ refute obj.ref.IsEmpty, mess
87
+ end
64
88
 
65
- def to_comparable_srv_context(obj)
66
- new_comparable ole_connector.sTring(obj),
67
- xml_type_get(obj),
68
- ole_connector.ValueToStringInternal(obj)
69
- end
70
- private :to_comparable_srv_context
71
-
72
- def new_comparable(as_string, xml_type, as_string_internal)
73
- r = {}
74
- r[:as_string] = as_string
75
- r[:xml_type] = xml_type
76
- r[:as_string_internal] = as_string_internal
77
- r
78
- end
79
- private :new_comparable
89
+ def _assert_equal(exp, act, mess = nil)
90
+ fail_not_comparable(exp, act) if not_comparable?(exp, act)
91
+ exp_ = to_comparable(exp)
92
+ act_ = to_comparable(act)
93
+ mess = message(mess, ::Minitest::Assertions::E){diff exp_, act_}
94
+ assert exp_ == act_, mess
95
+ end
80
96
 
81
- def xml_type_get(obj)
82
- return UNKNOWN_XML_TYPE if ole_connector.xmlTypeOf(obj).nil?
83
- ole_connector.xmlTypeOf(obj).typeName
84
- end
85
- private :xml_type_get
97
+ def to_comparable(obj)
98
+ return obj unless obj.is_a? WIN32OLE
99
+ return obj.__real_obj__ if obj.__ruby__?
100
+ Comparable.new(obj, ole_connector).make
101
+ end
102
+ private :to_comparable
86
103
 
87
- def not_comparable?(exp, act)
88
- is_ruby?(exp) ^ is_ruby?(act)
89
- end
90
- private :not_comparable?
104
+ def not_comparable?(exp, act)
105
+ ruby?(exp) ^ ruby?(act)
106
+ end
107
+ private :not_comparable?
91
108
 
92
- def is_ruby?(obj)
93
- !obj.is_a? WIN32OLE or obj.__ruby__?
94
- end
95
- private :is_ruby?
109
+ def ruby?(obj)
110
+ !obj.is_a? WIN32OLE or obj.__ruby__?
111
+ end
112
+ private :ruby?
96
113
 
97
- def fail_not_comparable(exp, act)
98
- fail ArgumentError,
99
- "Not comparable types `#{not_comparable_class exp}'"\
100
- " and `#{not_comparable_class act}'"
101
- end
102
- private :fail_not_comparable
114
+ def fail_not_comparable(exp, act)
115
+ fail ArgumentError,
116
+ "Not comparable types `#{not_comparable_class exp}'"\
117
+ " and `#{not_comparable_class act}'"
118
+ end
119
+ private :fail_not_comparable
103
120
 
104
- def not_comparable_class(obj)
105
- return obj.__real_obj__.class if obj.respond_to? :__real_obj__
106
- obj.class
121
+ def not_comparable_class(obj)
122
+ return obj.__real_obj__.class if obj.respond_to? :__real_obj__
123
+ obj.class
124
+ end
125
+ private :not_comparable_class
107
126
  end
108
- private :not_comparable_class
109
127
  end
110
128
  end
111
129
 
@@ -1,3 +1,3 @@
1
1
  module AssTests
2
- VERSION = "1.2.0.alpha"
2
+ VERSION = "2.0.0.alpha"
3
3
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ass_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.alpha
4
+ version: 2.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Vlasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-21 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ass_ole
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ass_maintainer-info_base
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">"
45
+ - - '>'
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">"
52
+ - - '>'
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest-hooks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.10'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.10'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mocha
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: It make possible to write tests for 1C:Enterprise on Ruby easy. Access
@@ -144,9 +144,9 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
- - ".gitignore"
148
- - ".simplecov"
149
- - ".travis.yml"
147
+ - .gitignore
148
+ - .simplecov
149
+ - .travis.yml
150
150
  - Gemfile
151
151
  - README.md
152
152
  - Rakefile
@@ -178,17 +178,17 @@ require_paths:
178
178
  - lib
179
179
  required_ruby_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ">="
181
+ - - '>='
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - ">"
186
+ - - '>'
187
187
  - !ruby/object:Gem::Version
188
188
  version: 1.3.1
189
189
  requirements: []
190
190
  rubyforge_project:
191
- rubygems_version: 2.4.7
191
+ rubygems_version: 2.0.14
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Framework for unit testing code written on 1C:Enterprise embedded programming