fix_spec 0.4.0 → 0.4.1
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 +4 -4
- data/Gemfile.lock +5 -0
- data/VERSION +1 -1
- data/fix_spec.gemspec +3 -3
- data/lib/fix_spec/builder.rb +35 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cfe02ee9bf33cc01066722933e18613110b0fb8
|
4
|
+
data.tar.gz: eac8cb38a033e2c1cb94af52a4814f012549668b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22cf1c80179917aca80a29679305e94f317875c17c10431a1c6168d7e9ef32585bceeb061185ed7367946db95b0c0fe07104c97449a73ff9b5b26846bbd056a
|
7
|
+
data.tar.gz: 1d5c343f4fe83ab49698b58c37d6510b64520e415008113dc399edfa8e8afb94fd5ef47105bbd47aba4f356b47d3f2f3266268d160dff184b585ffe9d2a497cd
|
data/Gemfile.lock
CHANGED
@@ -14,6 +14,8 @@ GEM
|
|
14
14
|
diff-lcs (1.2.4)
|
15
15
|
faraday (0.8.8)
|
16
16
|
multipart-post (~> 1.2.0)
|
17
|
+
gherkin (2.12.2)
|
18
|
+
multi_json (~> 1.3)
|
17
19
|
gherkin (2.12.2-java)
|
18
20
|
multi_json (~> 1.3)
|
19
21
|
git (1.2.6)
|
@@ -36,6 +38,7 @@ GEM
|
|
36
38
|
nokogiri (= 1.5.10)
|
37
39
|
rake
|
38
40
|
rdoc
|
41
|
+
json (1.8.1)
|
39
42
|
json (1.8.1-java)
|
40
43
|
json_spec (1.1.1)
|
41
44
|
multi_json (~> 1.0)
|
@@ -46,6 +49,7 @@ GEM
|
|
46
49
|
multi_test (0.0.2)
|
47
50
|
multi_xml (0.5.5)
|
48
51
|
multipart-post (1.2.0)
|
52
|
+
nokogiri (1.5.10)
|
49
53
|
nokogiri (1.5.10-java)
|
50
54
|
oauth2 (0.9.2)
|
51
55
|
faraday (~> 0.8)
|
@@ -70,6 +74,7 @@ GEM
|
|
70
74
|
|
71
75
|
PLATFORMS
|
72
76
|
java
|
77
|
+
ruby
|
73
78
|
|
74
79
|
DEPENDENCIES
|
75
80
|
cucumber (~> 1.3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/fix_spec.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: fix_spec 0.4.
|
5
|
+
# stub: fix_spec 0.4.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "fix_spec"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Chris Busbey"]
|
13
|
-
s.date = "2015-04-
|
13
|
+
s.date = "2015-04-22"
|
14
14
|
s.description = "Build and Inspect FIX Messages with RSpec and Cucumber steps"
|
15
15
|
s.email = "info@connamara.com"
|
16
16
|
s.extra_rdoc_files = [
|
data/lib/fix_spec/builder.rb
CHANGED
@@ -38,28 +38,11 @@ Given /^the following( unvalidated)? fix message:$/ do |unvalidated,fix_str|
|
|
38
38
|
end
|
39
39
|
|
40
40
|
Given /^I create a (?:fix|FIX|(FIXT?\.\d+\.\d+)) message(?: of type "(.*)")?$/ do |begin_string, msg_type|
|
41
|
-
FIXSpec::Builder.message =
|
42
|
-
|
43
|
-
unless begin_string.nil?
|
44
|
-
steps %{And I set the FIX message at "BeginString" to "#{begin_string}"}
|
45
|
-
end
|
46
|
-
|
47
|
-
unless msg_type.nil?
|
48
|
-
steps %{And I set the FIX message at "MsgType" to "#{msg_type}"}
|
49
|
-
end
|
41
|
+
FIXSpec::Builder.message = new_message(msg_type, begin_string)
|
50
42
|
end
|
51
43
|
|
52
44
|
Given /^I create the following (?:fix|FIX|(FIXT?\.\d+\.\d+)) message(?: of type "(.*)")?:$/ do |begin_string, msg_type, table|
|
53
|
-
FIXSpec::Builder.message =
|
54
|
-
|
55
|
-
unless begin_string.nil?
|
56
|
-
steps %{And I set the FIX message at "BeginString" to "#{begin_string}"}
|
57
|
-
end
|
58
|
-
|
59
|
-
unless msg_type.nil?
|
60
|
-
steps %{And I set the FIX message at "MsgType" to "#{msg_type}"}
|
61
|
-
end
|
62
|
-
|
45
|
+
FIXSpec::Builder.message = new_message(msg_type, begin_string)
|
63
46
|
table.raw.each do |tag, value|
|
64
47
|
steps %{And I set the FIX message at "#{tag}" to #{value}}
|
65
48
|
end
|
@@ -113,7 +96,7 @@ def add_array_field msgPart, fieldArray, fieldValue
|
|
113
96
|
if msgPart.hasGroup(arrayPos+1, tag)
|
114
97
|
set_fields msgPart.getGroup(arrayPos+1, tag), fieldArray, fieldValue
|
115
98
|
else
|
116
|
-
group =
|
99
|
+
group = new_group(msgPart, fieldName)
|
117
100
|
set_fields group, fieldArray, fieldValue
|
118
101
|
msgPart.addGroup group
|
119
102
|
end
|
@@ -123,7 +106,6 @@ def add_array_field msgPart, fieldArray, fieldValue
|
|
123
106
|
end
|
124
107
|
|
125
108
|
def add_field msgPart, fieldName, fieldValue
|
126
|
-
|
127
109
|
#kill quotes
|
128
110
|
if fieldValue.match(/\"(.*)\"/)
|
129
111
|
fieldValue=$1
|
@@ -155,5 +137,37 @@ def add_field msgPart, fieldName, fieldValue
|
|
155
137
|
tag = fieldName.to_i
|
156
138
|
msgPart.setString(tag, fieldValue)
|
157
139
|
end
|
140
|
+
end
|
141
|
+
|
158
142
|
|
143
|
+
# Tries to create a typed Message using a DefaultMessageFactory based on the given +msg_type+.
|
144
|
+
#
|
145
|
+
# This ensures that any repeating groups that are added to the Message will also be typed, and
|
146
|
+
# therefore have the correct delimiter and field order.
|
147
|
+
# Falls back to creating a base Message if +msg_type+ is nil.
|
148
|
+
def new_message msg_type=nil, begin_string=nil
|
149
|
+
if msg_type.nil?
|
150
|
+
msg = quickfix.Message.new
|
151
|
+
msg.get_header.setString(8, begin_string) unless begin_string.nil?
|
152
|
+
msg
|
153
|
+
else
|
154
|
+
quickfix.DefaultMessageFactory.new.create(FIXSpec::session_data_dictionary.get_version, FIXSpec::data_dictionary.get_reverse_value_name(35, msg_type))
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Tries to create a typed Group based on the name of the parent Message.
|
159
|
+
#
|
160
|
+
# This ensures that the correct delimiter and field order is used when serializing/deserializing the Group.
|
161
|
+
# Falls back to creating a base Group if typed Group creation fails.
|
162
|
+
#
|
163
|
+
# Example:
|
164
|
+
# If +msgPart+ is an instance of +Java::quickfix.fix50.MarketDataRequest+
|
165
|
+
# And +fieldName+ is 'NoMDEntryTypes'
|
166
|
+
# Then an instance of +Java::quickfix.fix50.MarketDataRequest::NoMDEntryTypes+ will be returned.
|
167
|
+
def new_group msgPart, fieldName
|
168
|
+
group_class = java_import("#{msgPart.getClass.getName}\$#{fieldName}").first
|
169
|
+
group_class.new
|
170
|
+
rescue
|
171
|
+
quickfix.Group.new FIXSpec::data_dictionary.getFieldTag(fieldName), -1
|
159
172
|
end
|
173
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fix_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Busbey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|