filemaker 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/README.md +2 -1
- data/lib/filemaker.rb +5 -5
- data/lib/filemaker/{error.rb → errors.rb} +1 -1
- data/lib/filemaker/model/selectable.rb +4 -4
- data/lib/filemaker/railtie.rb +1 -1
- data/lib/filemaker/record.rb +2 -2
- data/lib/filemaker/resultset.rb +1 -1
- data/lib/filemaker/server.rb +7 -7
- data/lib/filemaker/version.rb +1 -1
- data/spec/filemaker/configuration_spec.rb +1 -1
- data/spec/filemaker/error_spec.rb +81 -81
- data/spec/filemaker/layout_spec.rb +2 -2
- data/spec/filemaker/model/criteria_spec.rb +3 -3
- data/spec/filemaker/server_spec.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0fc57ed0ca37fe2baa601b0e3de5c4f269a087
|
4
|
+
data.tar.gz: 4dcbee5913ba864cbdbb45744e678d7a22de9730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08a4d7aaccb0fa6e22091422e7df6c7499ba3072cc815750944791aab70a28de3ac680eab3f3a0fa99b865305955055969602110ff1106aea9c55a535dc7fc20
|
7
|
+
data.tar.gz: ff5323e65f4a4184dc8bd46909081c2f07cfe75112f2447097452140f9aa317b0cff72f62ad3c6bcdd6e86598fe9e3918049b562d8f71bf026f8fff9f6378d87
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -193,8 +193,9 @@ Note: It is vitally important that you get the order right for mixing in the use
|
|
193
193
|
- [x] Please test the above query with real data to ensure correctness!
|
194
194
|
- [x] Please test the comparison operators with keyword as well as applied to value.
|
195
195
|
- [x] Test serialization of BigDecimal and other types.
|
196
|
-
- [
|
196
|
+
- [x] Caching of relation models.
|
197
197
|
- [ ] Test the order for `in` and `not_in` found set accuracy.
|
198
|
+
- [ ] Dirty checking API for model.
|
198
199
|
|
199
200
|
## Pagination
|
200
201
|
|
data/lib/filemaker.rb
CHANGED
@@ -10,7 +10,7 @@ require 'filemaker/resultset'
|
|
10
10
|
require 'filemaker/record'
|
11
11
|
require 'filemaker/layout'
|
12
12
|
require 'filemaker/script'
|
13
|
-
require 'filemaker/
|
13
|
+
require 'filemaker/errors'
|
14
14
|
|
15
15
|
require 'active_support'
|
16
16
|
require 'active_support/core_ext'
|
@@ -29,20 +29,20 @@ module Filemaker
|
|
29
29
|
# defined at the `filemaker.yml` config file.
|
30
30
|
def load!(path, environment = nil)
|
31
31
|
sessions = YAML.load(ERB.new(File.new(path).read).result)[environment.to_s]
|
32
|
-
fail
|
32
|
+
fail Errors::ConfigurationError, 'Environment wrong?' if sessions.nil?
|
33
33
|
|
34
34
|
sessions.each_pair do |key, value|
|
35
35
|
registry[key] = Filemaker::Server.new do |config|
|
36
36
|
config.host = value.fetch('host') do
|
37
|
-
fail
|
37
|
+
fail Errors::ConfigurationError, 'Missing config.host'
|
38
38
|
end
|
39
39
|
|
40
40
|
config.account_name = value.fetch('account_name') do
|
41
|
-
fail
|
41
|
+
fail Errors::ConfigurationError, 'Missing config.account_name'
|
42
42
|
end
|
43
43
|
|
44
44
|
config.password = value.fetch('password') do
|
45
|
-
fail
|
45
|
+
fail Errors::ConfigurationError, 'Missing config.password'
|
46
46
|
end
|
47
47
|
|
48
48
|
config.ssl = value['ssl'] if value['ssl']
|
@@ -7,7 +7,7 @@ module Filemaker
|
|
7
7
|
#
|
8
8
|
# @return [Filemaker::Model::Criteria]
|
9
9
|
def where(criterion)
|
10
|
-
fail Filemaker::
|
10
|
+
fail Filemaker::Errors::MixedClauseError,
|
11
11
|
"Can't mix 'where' with 'in'." if chains.include?(:in)
|
12
12
|
chains.push(:where)
|
13
13
|
|
@@ -54,7 +54,7 @@ module Filemaker
|
|
54
54
|
|
55
55
|
%w(eq cn bw ew gt gte lt lte neq).each do |operator|
|
56
56
|
define_method(operator) do |criterion, &block|
|
57
|
-
fail Filemaker::
|
57
|
+
fail Filemaker::Errors::MixedClauseError,
|
58
58
|
"Can't mix 'where' with 'in'." if chains.include?(:in)
|
59
59
|
chains.push(operator.to_sym)
|
60
60
|
chains.push(:where) unless chains.include?(:where) # Just one time
|
@@ -97,7 +97,7 @@ module Filemaker
|
|
97
97
|
#
|
98
98
|
# @return [Filemaker::Model::Criteria]
|
99
99
|
def in(criterion, negating = false)
|
100
|
-
fail Filemaker::
|
100
|
+
fail Filemaker::Errors::MixedClauseError,
|
101
101
|
"Can't mix 'in' with 'where'." if chains.include?(:where)
|
102
102
|
chains.push(:in)
|
103
103
|
@selector ||= []
|
@@ -127,7 +127,7 @@ module Filemaker
|
|
127
127
|
#
|
128
128
|
# @return [Filemaker::Model::Criteria]
|
129
129
|
def or(criterion)
|
130
|
-
fail Filemaker::
|
130
|
+
fail Filemaker::Errors::MixedClauseError,
|
131
131
|
"Can't mix 'or' with 'in'." if chains.include?(:in)
|
132
132
|
@selector ||= {}
|
133
133
|
selector.merge!(klass.with_model_fields(criterion))
|
data/lib/filemaker/railtie.rb
CHANGED
data/lib/filemaker/record.rb
CHANGED
@@ -45,14 +45,14 @@ module Filemaker
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def [](key)
|
48
|
-
fail(Filemaker::
|
48
|
+
fail(Filemaker::Errors::InvalidFieldError, "Invalid field: #{key}") \
|
49
49
|
unless key?(key)
|
50
50
|
super
|
51
51
|
end
|
52
52
|
|
53
53
|
def []=(key, value)
|
54
54
|
return super unless @ready
|
55
|
-
fail(Filemaker::
|
55
|
+
fail(Filemaker::Errors::InvalidFieldError, "Invalid field: #{key}") \
|
56
56
|
unless key?(key)
|
57
57
|
@dirty[key] = value
|
58
58
|
end
|
data/lib/filemaker/resultset.rb
CHANGED
@@ -89,7 +89,7 @@ module Filemaker
|
|
89
89
|
def raise_potential_error!(error_code)
|
90
90
|
return if error_code.zero? || error_code == 401 || error_code == 101
|
91
91
|
|
92
|
-
Filemaker::
|
92
|
+
Filemaker::Errors.raise_error_by_code(error_code)
|
93
93
|
end
|
94
94
|
|
95
95
|
def build_metadata(metadata)
|
data/lib/filemaker/server.rb
CHANGED
@@ -49,13 +49,13 @@ module Filemaker
|
|
49
49
|
|
50
50
|
case response.status
|
51
51
|
when 200 then [response, params]
|
52
|
-
when 401 then fail
|
53
|
-
when 0 then fail
|
54
|
-
when 404 then fail
|
55
|
-
when 302 then fail
|
52
|
+
when 401 then fail Errors::AuthenticationError, 'Auth failed.'
|
53
|
+
when 0 then fail Errors::CommunicationError, 'Empty response.'
|
54
|
+
when 404 then fail Errors::CommunicationError, 'HTTP 404 Not Found'
|
55
|
+
when 302 then fail Errors::CommunicationError, 'Redirect not supported'
|
56
56
|
else
|
57
57
|
msg = "Unknown response status = #{response.status}"
|
58
|
-
fail
|
58
|
+
fail Errors::CommunicationError, msg
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -105,7 +105,7 @@ module Filemaker
|
|
105
105
|
when :sortfield
|
106
106
|
if value.is_a? Array
|
107
107
|
msg = 'Too many sortfield, limit=9'
|
108
|
-
fail(Filemaker::
|
108
|
+
fail(Filemaker::Errors::ParameterError, msg) if value.size > 9
|
109
109
|
value.each_index do |index|
|
110
110
|
expanded["-sortfield.#{index + 1}"] = value[index]
|
111
111
|
end
|
@@ -116,7 +116,7 @@ module Filemaker
|
|
116
116
|
if value.is_a? Array
|
117
117
|
# Use :sortfield as single source of truth for array size
|
118
118
|
msg = 'Too many sortorder, limit=9'
|
119
|
-
fail(Filemaker::
|
119
|
+
fail(Filemaker::Errors::ParameterError, msg) if value.size > 9
|
120
120
|
options[:sortfield].each_index do |index|
|
121
121
|
expanded["-sortorder.#{index + 1}"] = value[index] || 'ascend'
|
122
122
|
end
|
data/lib/filemaker/version.rb
CHANGED
@@ -16,7 +16,7 @@ describe 'Configuration' do
|
|
16
16
|
path = File.expand_path('../../support/filemaker.yml', __FILE__)
|
17
17
|
expect do
|
18
18
|
Filemaker.load!(path, 'unknown')
|
19
|
-
end.to raise_error Filemaker::
|
19
|
+
end.to raise_error Filemaker::Errors::ConfigurationError
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -1,256 +1,256 @@
|
|
1
|
-
describe Filemaker::
|
1
|
+
describe Filemaker::Errors do
|
2
2
|
|
3
3
|
context '-1 to 100 errors' do
|
4
4
|
it 'raises UnknownError for -1' do
|
5
5
|
expect do
|
6
|
-
Filemaker::
|
7
|
-
end.to raise_error Filemaker::
|
6
|
+
Filemaker::Errors.raise_error_by_code(-1)
|
7
|
+
end.to raise_error Filemaker::Errors::UnknownError
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'raises UserCancelledError for 1' do
|
11
11
|
expect do
|
12
|
-
Filemaker::
|
13
|
-
end.to raise_error Filemaker::
|
12
|
+
Filemaker::Errors.raise_error_by_code(1)
|
13
|
+
end.to raise_error Filemaker::Errors::UserCancelledError
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'raises MemoryError for 2' do
|
17
17
|
expect do
|
18
|
-
Filemaker::
|
19
|
-
end.to raise_error Filemaker::
|
18
|
+
Filemaker::Errors.raise_error_by_code(2)
|
19
|
+
end.to raise_error Filemaker::Errors::MemoryError
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'raises CommandNotAvailableError for 3' do
|
23
23
|
expect do
|
24
|
-
Filemaker::
|
25
|
-
end.to raise_error Filemaker::
|
24
|
+
Filemaker::Errors.raise_error_by_code(3)
|
25
|
+
end.to raise_error Filemaker::Errors::CommandNotAvailableError
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'raises CommandUnknownError for 4' do
|
29
29
|
expect do
|
30
|
-
Filemaker::
|
31
|
-
end.to raise_error Filemaker::
|
30
|
+
Filemaker::Errors.raise_error_by_code(4)
|
31
|
+
end.to raise_error Filemaker::Errors::CommandUnknownError
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'raises CommandInvalidError for 5' do
|
35
35
|
expect do
|
36
|
-
Filemaker::
|
37
|
-
end.to raise_error Filemaker::
|
36
|
+
Filemaker::Errors.raise_error_by_code(5)
|
37
|
+
end.to raise_error Filemaker::Errors::CommandInvalidError
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'raises FileReadOnlyError for 6' do
|
41
41
|
expect do
|
42
|
-
Filemaker::
|
43
|
-
end.to raise_error Filemaker::
|
42
|
+
Filemaker::Errors.raise_error_by_code(6)
|
43
|
+
end.to raise_error Filemaker::Errors::FileReadOnlyError
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'raises OutOfMemoryError for 7' do
|
47
47
|
expect do
|
48
|
-
Filemaker::
|
49
|
-
end.to raise_error Filemaker::
|
48
|
+
Filemaker::Errors.raise_error_by_code(7)
|
49
|
+
end.to raise_error Filemaker::Errors::OutOfMemoryError
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'raises EmptyResultError for 8' do
|
53
53
|
expect do
|
54
|
-
Filemaker::
|
55
|
-
end.to raise_error Filemaker::
|
54
|
+
Filemaker::Errors.raise_error_by_code(8)
|
55
|
+
end.to raise_error Filemaker::Errors::EmptyResultError
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'raises InsufficientPrivilegesError for 9' do
|
59
59
|
expect do
|
60
|
-
Filemaker::
|
61
|
-
end.to raise_error Filemaker::
|
60
|
+
Filemaker::Errors.raise_error_by_code(9)
|
61
|
+
end.to raise_error Filemaker::Errors::InsufficientPrivilegesError
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'raises RequestedDataMissingError for 10' do
|
65
65
|
expect do
|
66
|
-
Filemaker::
|
67
|
-
end.to raise_error Filemaker::
|
66
|
+
Filemaker::Errors.raise_error_by_code(10)
|
67
|
+
end.to raise_error Filemaker::Errors::RequestedDataMissingError
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context '100 to 199 errors' do
|
72
72
|
it 'raises FileMissingError for 100' do
|
73
73
|
expect do
|
74
|
-
Filemaker::
|
75
|
-
end.to raise_error Filemaker::
|
74
|
+
Filemaker::Errors.raise_error_by_code(100)
|
75
|
+
end.to raise_error Filemaker::Errors::FileMissingError
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'raises RecordMissingError for 101' do
|
79
79
|
expect do
|
80
|
-
Filemaker::
|
81
|
-
end.to raise_error Filemaker::
|
80
|
+
Filemaker::Errors.raise_error_by_code(101)
|
81
|
+
end.to raise_error Filemaker::Errors::RecordMissingError
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'raises FieldMissingError for 102' do
|
85
85
|
expect do
|
86
|
-
Filemaker::
|
87
|
-
end.to raise_error Filemaker::
|
86
|
+
Filemaker::Errors.raise_error_by_code(102)
|
87
|
+
end.to raise_error Filemaker::Errors::FieldMissingError
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'raises ScriptMissingError for 104' do
|
91
91
|
expect do
|
92
|
-
Filemaker::
|
93
|
-
end.to raise_error Filemaker::
|
92
|
+
Filemaker::Errors.raise_error_by_code(104)
|
93
|
+
end.to raise_error Filemaker::Errors::ScriptMissingError
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'raises LayoutMissingError for 105' do
|
97
97
|
expect do
|
98
|
-
Filemaker::
|
99
|
-
end.to raise_error Filemaker::
|
98
|
+
Filemaker::Errors.raise_error_by_code(105)
|
99
|
+
end.to raise_error Filemaker::Errors::LayoutMissingError
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'raises TableMissingError for 106' do
|
103
103
|
expect do
|
104
|
-
Filemaker::
|
105
|
-
end.to raise_error Filemaker::
|
104
|
+
Filemaker::Errors.raise_error_by_code(106)
|
105
|
+
end.to raise_error Filemaker::Errors::TableMissingError
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'raises MissingError for 116' do
|
109
109
|
expect do
|
110
|
-
Filemaker::
|
111
|
-
end.to raise_error Filemaker::
|
110
|
+
Filemaker::Errors.raise_error_by_code(106)
|
111
|
+
end.to raise_error Filemaker::Errors::MissingError
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
context '200 to 299 errors' do
|
116
116
|
it 'raises RecordAccessDeniedError for 200' do
|
117
117
|
expect do
|
118
|
-
Filemaker::
|
119
|
-
end.to raise_error Filemaker::
|
118
|
+
Filemaker::Errors.raise_error_by_code(200)
|
119
|
+
end.to raise_error Filemaker::Errors::RecordAccessDeniedError
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'raises FieldCannotBeModifiedError for 201' do
|
123
123
|
expect do
|
124
|
-
Filemaker::
|
125
|
-
end.to raise_error Filemaker::
|
124
|
+
Filemaker::Errors.raise_error_by_code(201)
|
125
|
+
end.to raise_error Filemaker::Errors::FieldCannotBeModifiedError
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'raises FieldAccessDeniedError for 202' do
|
129
129
|
expect do
|
130
|
-
Filemaker::
|
131
|
-
end.to raise_error Filemaker::
|
130
|
+
Filemaker::Errors.raise_error_by_code(202)
|
131
|
+
end.to raise_error Filemaker::Errors::FieldAccessDeniedError
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
context '300 to 399 errors' do
|
136
136
|
it 'raises FileLockedError for 300' do
|
137
137
|
expect do
|
138
|
-
Filemaker::
|
139
|
-
end.to raise_error Filemaker::
|
138
|
+
Filemaker::Errors.raise_error_by_code(300)
|
139
|
+
end.to raise_error Filemaker::Errors::FileLockedError
|
140
140
|
end
|
141
141
|
|
142
142
|
it 'raises FileLockedError for 301' do
|
143
143
|
expect do
|
144
|
-
Filemaker::
|
145
|
-
end.to raise_error Filemaker::
|
144
|
+
Filemaker::Errors.raise_error_by_code(301)
|
145
|
+
end.to raise_error Filemaker::Errors::RecordInUseError
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'raises TableInUseError for 302' do
|
149
149
|
expect do
|
150
|
-
Filemaker::
|
151
|
-
end.to raise_error Filemaker::
|
150
|
+
Filemaker::Errors.raise_error_by_code(302)
|
151
|
+
end.to raise_error Filemaker::Errors::TableInUseError
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'raises RecordModificationIdMismatchError for 306' do
|
155
155
|
expect do
|
156
|
-
Filemaker::
|
157
|
-
end.to raise_error Filemaker::
|
156
|
+
Filemaker::Errors.raise_error_by_code(306)
|
157
|
+
end.to raise_error Filemaker::Errors::RecordModificationIdMismatchError
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
161
|
context '400 to 499 errors' do
|
162
162
|
it 'raises FindCriteriaEmptyError for 400' do
|
163
163
|
expect do
|
164
|
-
Filemaker::
|
165
|
-
end.to raise_error Filemaker::
|
164
|
+
Filemaker::Errors.raise_error_by_code(400)
|
165
|
+
end.to raise_error Filemaker::Errors::FindCriteriaEmptyError
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'raises NoRecordsFoundError for 401' do
|
169
169
|
expect do
|
170
|
-
Filemaker::
|
171
|
-
end.to raise_error Filemaker::
|
170
|
+
Filemaker::Errors.raise_error_by_code(401)
|
171
|
+
end.to raise_error Filemaker::Errors::NoRecordsFoundError
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
175
|
context '500 to 599 errors' do
|
176
176
|
it 'raises DateValidationError for 500' do
|
177
177
|
expect do
|
178
|
-
Filemaker::
|
179
|
-
end.to raise_error Filemaker::
|
178
|
+
Filemaker::Errors.raise_error_by_code(500)
|
179
|
+
end.to raise_error Filemaker::Errors::DateValidationError
|
180
180
|
end
|
181
181
|
|
182
182
|
it 'raises TimeValidationError for 501' do
|
183
183
|
expect do
|
184
|
-
Filemaker::
|
185
|
-
end.to raise_error Filemaker::
|
184
|
+
Filemaker::Errors.raise_error_by_code(501)
|
185
|
+
end.to raise_error Filemaker::Errors::TimeValidationError
|
186
186
|
end
|
187
187
|
|
188
188
|
it 'raises NumberValidationError for 502' do
|
189
189
|
expect do
|
190
|
-
Filemaker::
|
191
|
-
end.to raise_error Filemaker::
|
190
|
+
Filemaker::Errors.raise_error_by_code(502)
|
191
|
+
end.to raise_error Filemaker::Errors::NumberValidationError
|
192
192
|
end
|
193
193
|
|
194
194
|
it 'raises RangeValidationError for 503' do
|
195
195
|
expect do
|
196
|
-
Filemaker::
|
197
|
-
end.to raise_error Filemaker::
|
196
|
+
Filemaker::Errors.raise_error_by_code(503)
|
197
|
+
end.to raise_error Filemaker::Errors::RangeValidationError
|
198
198
|
end
|
199
199
|
|
200
200
|
it 'raises UniquenessValidationError for 504' do
|
201
201
|
expect do
|
202
|
-
Filemaker::
|
203
|
-
end.to raise_error Filemaker::
|
202
|
+
Filemaker::Errors.raise_error_by_code(504)
|
203
|
+
end.to raise_error Filemaker::Errors::UniquenessValidationError
|
204
204
|
end
|
205
205
|
|
206
206
|
it 'raises ExistingValidationError for 505' do
|
207
207
|
expect do
|
208
|
-
Filemaker::
|
209
|
-
end.to raise_error Filemaker::
|
208
|
+
Filemaker::Errors.raise_error_by_code(505)
|
209
|
+
end.to raise_error Filemaker::Errors::ExistingValidationError
|
210
210
|
end
|
211
211
|
|
212
212
|
it 'raises ValueListValidationError for 506' do
|
213
213
|
expect do
|
214
|
-
Filemaker::
|
215
|
-
end.to raise_error Filemaker::
|
214
|
+
Filemaker::Errors.raise_error_by_code(506)
|
215
|
+
end.to raise_error Filemaker::Errors::ValueListValidationError
|
216
216
|
end
|
217
217
|
|
218
218
|
it 'raises CalculationValidationError for 507' do
|
219
219
|
expect do
|
220
|
-
Filemaker::
|
221
|
-
end.to raise_error Filemaker::
|
220
|
+
Filemaker::Errors.raise_error_by_code(507)
|
221
|
+
end.to raise_error Filemaker::Errors::CalculationValidationError
|
222
222
|
end
|
223
223
|
|
224
224
|
it 'raises InvalidFindModeValueValidationError for 508' do
|
225
225
|
expect do
|
226
|
-
Filemaker::
|
227
|
-
end.to raise_error Filemaker::
|
226
|
+
Filemaker::Errors.raise_error_by_code(508)
|
227
|
+
end.to raise_error Filemaker::Errors::InvalidFindModeValueValidationError
|
228
228
|
end
|
229
229
|
|
230
230
|
it 'raises MaximumCharactersValidationError for 511' do
|
231
231
|
expect do
|
232
|
-
Filemaker::
|
233
|
-
end.to raise_error Filemaker::
|
232
|
+
Filemaker::Errors.raise_error_by_code(511)
|
233
|
+
end.to raise_error Filemaker::Errors::MaximumCharactersValidationError
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
237
|
context '800 to 899 errors' do
|
238
238
|
it 'raises UnableToCreateFileError for 800' do
|
239
239
|
expect do
|
240
|
-
Filemaker::
|
241
|
-
end.to raise_error Filemaker::
|
240
|
+
Filemaker::Errors.raise_error_by_code(800)
|
241
|
+
end.to raise_error Filemaker::Errors::UnableToCreateFileError
|
242
242
|
end
|
243
243
|
|
244
244
|
it 'raises UnableToCreateTempFileError for 801' do
|
245
245
|
expect do
|
246
|
-
Filemaker::
|
247
|
-
end.to raise_error Filemaker::
|
246
|
+
Filemaker::Errors.raise_error_by_code(801)
|
247
|
+
end.to raise_error Filemaker::Errors::UnableToCreateTempFileError
|
248
248
|
end
|
249
249
|
|
250
250
|
it 'raises UnableToOpenFileError for 802' do
|
251
251
|
expect do
|
252
|
-
Filemaker::
|
253
|
-
end.to raise_error Filemaker::
|
252
|
+
Filemaker::Errors.raise_error_by_code(802)
|
253
|
+
end.to raise_error Filemaker::Errors::UnableToOpenFileError
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
@@ -65,7 +65,7 @@ describe Filemaker::Layout do
|
|
65
65
|
sortfield: %w(f1 f2 f3 f4 f5 f6 f7 f8 f9 f10),
|
66
66
|
sortorder: %w(o1 o2 o3 o4 o5 o6 o7 o8 o9)
|
67
67
|
)
|
68
|
-
end.to raise_error Filemaker::
|
68
|
+
end.to raise_error Filemaker::Errors::ParameterError
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'will not accept more than 9 sortorders' do
|
@@ -74,7 +74,7 @@ describe Filemaker::Layout do
|
|
74
74
|
sortfield: %w(f1 f2 f3 f4 f5 f6 f7 f8 f9),
|
75
75
|
sortorder: %w(o1 o2 o3 o4 o5 o6 o7 o8 o9 o10)
|
76
76
|
)
|
77
|
-
end.to raise_error Filemaker::
|
77
|
+
end.to raise_error Filemaker::Errors::ParameterError
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -8,7 +8,7 @@ describe Filemaker::Model::Criteria do
|
|
8
8
|
it 'raises MixedClauseError if mixed with -findquery' do
|
9
9
|
expect do
|
10
10
|
criteria.in(status: %w(pending subscribed)).where(name: 'Bob')
|
11
|
-
end.to raise_error Filemaker::
|
11
|
+
end.to raise_error Filemaker::Errors::MixedClauseError
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'single hash criterion are recorded as is' do
|
@@ -78,7 +78,7 @@ describe Filemaker::Model::Criteria do
|
|
78
78
|
it 'only works on `where` query' do
|
79
79
|
expect do
|
80
80
|
criteria.in(status: %w(pending subscribed)).eq(name: 'Bob')
|
81
|
-
end.to raise_error Filemaker::
|
81
|
+
end.to raise_error Filemaker::Errors::MixedClauseError
|
82
82
|
end
|
83
83
|
|
84
84
|
describe 'not' do
|
@@ -114,7 +114,7 @@ describe Filemaker::Model::Criteria do
|
|
114
114
|
it 'raises MixedClauseError if mixed with -find' do
|
115
115
|
expect do
|
116
116
|
criteria.where(name: 'Bob').in(status: %w(pending subscribed))
|
117
|
-
end.to raise_error Filemaker::
|
117
|
+
end.to raise_error Filemaker::Errors::MixedClauseError
|
118
118
|
end
|
119
119
|
|
120
120
|
it '{a: [1, 2]} to (q0);(q1)' do
|
@@ -78,28 +78,28 @@ describe Filemaker::Server do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
it 'raises Filemaker::
|
81
|
+
it 'raises Filemaker::Errors::CommunicationError if status = 0' do
|
82
82
|
fake_error(@server, nil, 0)
|
83
83
|
|
84
84
|
expect do
|
85
85
|
@server.databases.all
|
86
|
-
end.to raise_error Filemaker::
|
86
|
+
end.to raise_error Filemaker::Errors::CommunicationError
|
87
87
|
end
|
88
88
|
|
89
|
-
it 'raises Filemaker::
|
89
|
+
it 'raises Filemaker::Errors::CommunicationError if status = 404' do
|
90
90
|
fake_error(@server, nil, 404)
|
91
91
|
|
92
92
|
expect do
|
93
93
|
@server.databases.all
|
94
|
-
end.to raise_error Filemaker::
|
94
|
+
end.to raise_error Filemaker::Errors::CommunicationError
|
95
95
|
end
|
96
96
|
|
97
|
-
it 'raises Filemaker::
|
97
|
+
it 'raises Filemaker::Errors::AuthenticationError if status = 401' do
|
98
98
|
fake_error(@server, nil, 401)
|
99
99
|
|
100
100
|
expect do
|
101
101
|
@server.databases.all
|
102
|
-
end.to raise_error Filemaker::
|
102
|
+
end.to raise_error Filemaker::Errors::AuthenticationError
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filemaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -167,7 +167,7 @@ files:
|
|
167
167
|
- lib/filemaker/configuration.rb
|
168
168
|
- lib/filemaker/core_ext/hash.rb
|
169
169
|
- lib/filemaker/database.rb
|
170
|
-
- lib/filemaker/
|
170
|
+
- lib/filemaker/errors.rb
|
171
171
|
- lib/filemaker/layout.rb
|
172
172
|
- lib/filemaker/metadata/field.rb
|
173
173
|
- lib/filemaker/model.rb
|