simmer 1.0.0.pre.alpha.7 → 1.0.0.pre.alpha.8
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/lib/simmer/version.rb +1 -1
- data/simmer.gemspec +9 -2
- metadata +11 -80
- data/spec/config/simmer.yaml.ci +0 -22
- data/spec/db/database.sql +0 -1
- data/spec/db/tables.sql +0 -20
- data/spec/db_helper.rb +0 -26
- data/spec/fixtures/agent_fixtures.yaml +0 -14
- data/spec/fixtures/configuration.yaml +0 -11
- data/spec/fixtures/noc_list.csv +0 -3
- data/spec/fixtures/specifications/load_noc_list.yaml +0 -37
- data/spec/fixtures/yaml_reader/bar.yaml +0 -2
- data/spec/fixtures/yaml_reader/baz/baz.yaml +0 -2
- data/spec/fixtures/yaml_reader/foo.yaml +0 -2
- data/spec/mocks/aws_s3_client.rb +0 -56
- data/spec/mocks/load_noc_list/pan.sh +0 -10
- data/spec/mocks/load_noc_list_bad_output/pan.sh +0 -10
- data/spec/mocks/out.rb +0 -14
- data/spec/mocks/spoon/kitchen.sh +0 -14
- data/spec/mocks/spoon/pan.sh +0 -14
- data/spec/simmer/configuration_spec.rb +0 -46
- data/spec/simmer/core_ext/hash_spec.rb +0 -16
- data/spec/simmer/database/fixture_set_spec.rb +0 -75
- data/spec/simmer/database/fixture_spec.rb +0 -57
- data/spec/simmer/externals/aws_file_system_spec.rb +0 -58
- data/spec/simmer/externals/mysql_database_spec.rb +0 -89
- data/spec/simmer/externals/spoon_client_spec.rb +0 -47
- data/spec/simmer/specification/act/params_spec.rb +0 -38
- data/spec/simmer/specification/act_spec.rb +0 -37
- data/spec/simmer/specification/assert_spec.rb +0 -29
- data/spec/simmer/specification/stage_spec.rb +0 -32
- data/spec/simmer/specification_spec.rb +0 -28
- data/spec/simmer/util/evaluator_spec.rb +0 -82
- data/spec/simmer/util/record_set_spec.rb +0 -84
- data/spec/simmer/util/record_spec.rb +0 -218
- data/spec/simmer/util/yaml_reader_spec.rb +0 -49
- data/spec/simmer_spec/files/noc_list.csv +0 -3
- data/spec/simmer_spec/fixtures/agent_fixtures.yaml +0 -14
- data/spec/simmer_spec.rb +0 -104
- data/spec/spec_helper.rb +0 -43
- /data/{bin → exe}/simmer +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d2c8a97f020d8075b14da8b15908e5bc256e8bb946fc36dba254cad4cfec95d
|
4
|
+
data.tar.gz: e3868ab99540e0dfcf11c6e76fd785d94535ed96bd7b14bd1e831db5fe896bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76596e1d548b7fe09d4e8ef7baf102bdb41cee3cf60d745efc7cb938e5492a6d39212cdc32de376d62f68aa86d08861f1e8d093ad947d83c0ff37629c9286bed
|
7
|
+
data.tar.gz: '00980ec71fb9a07f693848736564dadfa9100949b14e65a5e514427c3bf8cb7c7bcb05ce9234a25f981b181294a4b7a303e2bf92056b6459e9fb0823883b54e1'
|
data/lib/simmer/version.rb
CHANGED
data/simmer.gemspec
CHANGED
@@ -13,11 +13,18 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.authors = ['Matthew Ruggio']
|
15
15
|
s.email = ['mruggio@bluemarblepayroll.com']
|
16
|
-
s.files = `git ls-files`.split("\
|
17
|
-
s.
|
16
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
s.bindir = 'exe'
|
18
18
|
s.executables = %w[simmer]
|
19
19
|
s.homepage = 'https://github.com/bluemarblepayroll/simmer'
|
20
20
|
s.license = 'MIT'
|
21
|
+
s.metadata = {
|
22
|
+
'bug_tracker_uri' => 'https://github.com/bluemarblepayroll/simmer/issues',
|
23
|
+
'changelog_uri' => 'https://github.com/bluemarblepayroll/simmer/blob/master/CHANGELOG.md',
|
24
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/simmer',
|
25
|
+
'homepage_uri' => s.homepage,
|
26
|
+
'source_code_uri' => s.homepage
|
27
|
+
}
|
21
28
|
|
22
29
|
s.required_ruby_version = '>= 2.5'
|
23
30
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.alpha.
|
4
|
+
version: 1.0.0.pre.alpha.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|
@@ -214,7 +214,7 @@ files:
|
|
214
214
|
- README.md
|
215
215
|
- Rakefile
|
216
216
|
- bin/console
|
217
|
-
-
|
217
|
+
- exe/simmer
|
218
218
|
- lib/simmer.rb
|
219
219
|
- lib/simmer/configuration.rb
|
220
220
|
- lib/simmer/core_ext/hash.rb
|
@@ -255,47 +255,15 @@ files:
|
|
255
255
|
- lib/simmer/util/yaml_reader.rb
|
256
256
|
- lib/simmer/version.rb
|
257
257
|
- simmer.gemspec
|
258
|
-
- spec/config/simmer.yaml.ci
|
259
|
-
- spec/db/database.sql
|
260
|
-
- spec/db/tables.sql
|
261
|
-
- spec/db_helper.rb
|
262
|
-
- spec/fixtures/agent_fixtures.yaml
|
263
|
-
- spec/fixtures/configuration.yaml
|
264
|
-
- spec/fixtures/noc_list.csv
|
265
|
-
- spec/fixtures/specifications/load_noc_list.yaml
|
266
|
-
- spec/fixtures/yaml_reader/bar.yaml
|
267
|
-
- spec/fixtures/yaml_reader/baz/baz.yaml
|
268
|
-
- spec/fixtures/yaml_reader/foo.yaml
|
269
|
-
- spec/mocks/aws_s3_client.rb
|
270
|
-
- spec/mocks/load_noc_list/pan.sh
|
271
|
-
- spec/mocks/load_noc_list_bad_output/pan.sh
|
272
|
-
- spec/mocks/out.rb
|
273
|
-
- spec/mocks/spoon/kitchen.sh
|
274
|
-
- spec/mocks/spoon/pan.sh
|
275
|
-
- spec/simmer/configuration_spec.rb
|
276
|
-
- spec/simmer/core_ext/hash_spec.rb
|
277
|
-
- spec/simmer/database/fixture_set_spec.rb
|
278
|
-
- spec/simmer/database/fixture_spec.rb
|
279
|
-
- spec/simmer/externals/aws_file_system_spec.rb
|
280
|
-
- spec/simmer/externals/mysql_database_spec.rb
|
281
|
-
- spec/simmer/externals/spoon_client_spec.rb
|
282
|
-
- spec/simmer/specification/act/params_spec.rb
|
283
|
-
- spec/simmer/specification/act_spec.rb
|
284
|
-
- spec/simmer/specification/assert_spec.rb
|
285
|
-
- spec/simmer/specification/stage_spec.rb
|
286
|
-
- spec/simmer/specification_spec.rb
|
287
|
-
- spec/simmer/util/evaluator_spec.rb
|
288
|
-
- spec/simmer/util/record_set_spec.rb
|
289
|
-
- spec/simmer/util/record_spec.rb
|
290
|
-
- spec/simmer/util/yaml_reader_spec.rb
|
291
|
-
- spec/simmer_spec.rb
|
292
|
-
- spec/simmer_spec/files/noc_list.csv
|
293
|
-
- spec/simmer_spec/fixtures/agent_fixtures.yaml
|
294
|
-
- spec/spec_helper.rb
|
295
258
|
homepage: https://github.com/bluemarblepayroll/simmer
|
296
259
|
licenses:
|
297
260
|
- MIT
|
298
|
-
metadata:
|
261
|
+
metadata:
|
262
|
+
bug_tracker_uri: https://github.com/bluemarblepayroll/simmer/issues
|
263
|
+
changelog_uri: https://github.com/bluemarblepayroll/simmer/blob/master/CHANGELOG.md
|
264
|
+
documentation_uri: https://www.rubydoc.info/gems/simmer
|
265
|
+
homepage_uri: https://github.com/bluemarblepayroll/simmer
|
266
|
+
source_code_uri: https://github.com/bluemarblepayroll/simmer
|
299
267
|
post_install_message:
|
300
268
|
rdoc_options: []
|
301
269
|
require_paths:
|
@@ -315,41 +283,4 @@ rubygems_version: 3.0.3
|
|
315
283
|
signing_key:
|
316
284
|
specification_version: 4
|
317
285
|
summary: Pentaho Data Integration Automated Test Suite
|
318
|
-
test_files:
|
319
|
-
- spec/config/simmer.yaml.ci
|
320
|
-
- spec/db/database.sql
|
321
|
-
- spec/db/tables.sql
|
322
|
-
- spec/db_helper.rb
|
323
|
-
- spec/fixtures/agent_fixtures.yaml
|
324
|
-
- spec/fixtures/configuration.yaml
|
325
|
-
- spec/fixtures/noc_list.csv
|
326
|
-
- spec/fixtures/specifications/load_noc_list.yaml
|
327
|
-
- spec/fixtures/yaml_reader/bar.yaml
|
328
|
-
- spec/fixtures/yaml_reader/baz/baz.yaml
|
329
|
-
- spec/fixtures/yaml_reader/foo.yaml
|
330
|
-
- spec/mocks/aws_s3_client.rb
|
331
|
-
- spec/mocks/load_noc_list/pan.sh
|
332
|
-
- spec/mocks/load_noc_list_bad_output/pan.sh
|
333
|
-
- spec/mocks/out.rb
|
334
|
-
- spec/mocks/spoon/kitchen.sh
|
335
|
-
- spec/mocks/spoon/pan.sh
|
336
|
-
- spec/simmer/configuration_spec.rb
|
337
|
-
- spec/simmer/core_ext/hash_spec.rb
|
338
|
-
- spec/simmer/database/fixture_set_spec.rb
|
339
|
-
- spec/simmer/database/fixture_spec.rb
|
340
|
-
- spec/simmer/externals/aws_file_system_spec.rb
|
341
|
-
- spec/simmer/externals/mysql_database_spec.rb
|
342
|
-
- spec/simmer/externals/spoon_client_spec.rb
|
343
|
-
- spec/simmer/specification/act/params_spec.rb
|
344
|
-
- spec/simmer/specification/act_spec.rb
|
345
|
-
- spec/simmer/specification/assert_spec.rb
|
346
|
-
- spec/simmer/specification/stage_spec.rb
|
347
|
-
- spec/simmer/specification_spec.rb
|
348
|
-
- spec/simmer/util/evaluator_spec.rb
|
349
|
-
- spec/simmer/util/record_set_spec.rb
|
350
|
-
- spec/simmer/util/record_spec.rb
|
351
|
-
- spec/simmer/util/yaml_reader_spec.rb
|
352
|
-
- spec/simmer_spec.rb
|
353
|
-
- spec/simmer_spec/files/noc_list.csv
|
354
|
-
- spec/simmer_spec/fixtures/agent_fixtures.yaml
|
355
|
-
- spec/spec_helper.rb
|
286
|
+
test_files: []
|
data/spec/config/simmer.yaml.ci
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
mysql_database:
|
2
|
-
init_command: "SET @@SESSION.sql_mode = 'TRADITIONAL,NO_AUTO_VALUE_ON_ZERO'"
|
3
|
-
database: simmer_test
|
4
|
-
username: root
|
5
|
-
host: 127.0.0.1
|
6
|
-
port: 3306
|
7
|
-
flags: MULTI_STATEMENTS
|
8
|
-
|
9
|
-
spoon_client:
|
10
|
-
dir: spec/mocks/spoon
|
11
|
-
args: 0
|
12
|
-
|
13
|
-
local_file_system:
|
14
|
-
dir: tmp/store_test
|
15
|
-
|
16
|
-
# aws_file_system:
|
17
|
-
# access_key_id:
|
18
|
-
# bucket:
|
19
|
-
# default_expires_in_seconds: 3600
|
20
|
-
# encryption: AES256
|
21
|
-
# region:
|
22
|
-
# secret_access_key:
|
data/spec/db/database.sql
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
CREATE DATABASE IF NOT EXISTS simmer_test;
|
data/spec/db/tables.sql
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
DROP TABLE IF EXISTS `simmer_test`.`notes`;
|
2
|
-
DROP TABLE IF EXISTS `simmer_test`.`agents`;
|
3
|
-
|
4
|
-
CREATE TABLE `simmer_test`.`agents` (
|
5
|
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
6
|
-
`call_sign` varchar(150) NOT NULL,
|
7
|
-
`first` varchar(255),
|
8
|
-
`last` varchar(255),
|
9
|
-
PRIMARY KEY (`id`),
|
10
|
-
UNIQUE INDEX (`call_sign`)
|
11
|
-
);
|
12
|
-
|
13
|
-
CREATE TABLE `simmer_test`.`notes` (
|
14
|
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
15
|
-
`agent_id` int(11) NOT NULL,
|
16
|
-
`note` varchar(255),
|
17
|
-
PRIMARY KEY (`id`),
|
18
|
-
INDEX (`agent_id`),
|
19
|
-
FOREIGN KEY (`agent_id`) REFERENCES `simmer_test`.`agents`(`id`)
|
20
|
-
);
|
data/spec/db_helper.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
CLEAN_SQL_STATEMENTS = [
|
11
|
-
'DELETE FROM `simmer_test`.`notes`',
|
12
|
-
'DELETE FROM `simmer_test`.`agents`'
|
13
|
-
].freeze
|
14
|
-
|
15
|
-
def db_helper_config
|
16
|
-
simmer_config['mysql_database']
|
17
|
-
end
|
18
|
-
|
19
|
-
def db_helper_client
|
20
|
-
@db_helper_client ||= Mysql2::Client.new(db_helper_config)
|
21
|
-
end
|
22
|
-
|
23
|
-
def db_helper_clean_schema
|
24
|
-
CLEAN_SQL_STATEMENTS.each { |sql| db_helper_client.query(sql) }
|
25
|
-
nil
|
26
|
-
end
|
data/spec/fixtures/noc_list.csv
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
name: Declassify Users
|
2
|
-
stage:
|
3
|
-
files:
|
4
|
-
src: noc_list.csv
|
5
|
-
dest: input/noc_list.csv
|
6
|
-
fixtures:
|
7
|
-
- iron_man
|
8
|
-
- hulk
|
9
|
-
act:
|
10
|
-
name: load_noc_list
|
11
|
-
repository: top_secret
|
12
|
-
type: transformation
|
13
|
-
params:
|
14
|
-
files:
|
15
|
-
input_file: noc_list.csv
|
16
|
-
keys:
|
17
|
-
code: 'The secret code is: {codes.the_secret_one}'
|
18
|
-
assert:
|
19
|
-
assertions:
|
20
|
-
- type: table
|
21
|
-
name: agents
|
22
|
-
records:
|
23
|
-
- call_sign: iron_man
|
24
|
-
first: tony
|
25
|
-
last: stark
|
26
|
-
- call_sign: hulk
|
27
|
-
first: bruce
|
28
|
-
last: banner
|
29
|
-
- type: table
|
30
|
-
name: agents
|
31
|
-
logic: includes
|
32
|
-
records:
|
33
|
-
- call_sign: iron_man
|
34
|
-
first: tony
|
35
|
-
last: stark
|
36
|
-
- type: output
|
37
|
-
value: output to stdout
|
data/spec/mocks/aws_s3_client.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
class AwsS3Client
|
11
|
-
extend Forwardable
|
12
|
-
|
13
|
-
def_delegators :client,
|
14
|
-
:list_objects,
|
15
|
-
:delete_objects,
|
16
|
-
:put_object
|
17
|
-
|
18
|
-
attr_reader :client, :store
|
19
|
-
|
20
|
-
def initialize(store = {})
|
21
|
-
@store = store
|
22
|
-
@client = make_client
|
23
|
-
|
24
|
-
freeze
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
# rubocop:disable Metrics/AbcSize
|
30
|
-
def make_client
|
31
|
-
Aws::S3::Client.new(stub_responses: true).tap do |client|
|
32
|
-
client.stub_responses(:get_object, lambda { |context|
|
33
|
-
obj = store[context.params[:key]]
|
34
|
-
obj || 'NoSuchKey'
|
35
|
-
})
|
36
|
-
|
37
|
-
client.stub_responses(:put_object, lambda { |context|
|
38
|
-
store[context.params[:key]] = { body: context.params[:body] }
|
39
|
-
{}
|
40
|
-
})
|
41
|
-
|
42
|
-
client.stub_responses(:list_objects, lambda { |_context|
|
43
|
-
contents = store.keys.map { |k| OpenStruct.new(key: k) }
|
44
|
-
|
45
|
-
OpenStruct.new(contents: contents)
|
46
|
-
})
|
47
|
-
|
48
|
-
client.stub_responses(:delete_objects, lambda { |context|
|
49
|
-
keys = context.params.dig(:delete, :objects).map { |k| k[:key] }
|
50
|
-
|
51
|
-
keys.each { |key| store.delete(key) }
|
52
|
-
})
|
53
|
-
end
|
54
|
-
end
|
55
|
-
# rubocop:enable Metrics/AbcSize
|
56
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require './spec/spec_helper'
|
5
|
-
require './spec/db_helper'
|
6
|
-
|
7
|
-
puts 'output to stdout'
|
8
|
-
|
9
|
-
db_helper_client.query("UPDATE agents SET first = 'bruce', last = 'banner' WHERE call_sign = 'hulk'")
|
10
|
-
db_helper_client.query("UPDATE agents SET first = 'tony', last = 'stark' WHERE call_sign = 'iron_man'")
|
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require './spec/spec_helper'
|
5
|
-
require './spec/db_helper'
|
6
|
-
|
7
|
-
puts 'bad output!'
|
8
|
-
|
9
|
-
db_helper_client.query("UPDATE agents SET first = 'bruce', last = 'banner' WHERE call_sign = 'hulk'")
|
10
|
-
db_helper_client.query("UPDATE agents SET first = 'tony', last = 'stark' WHERE call_sign = 'iron_man'")
|
data/spec/mocks/out.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
class Out
|
11
|
-
def puts(msg); end
|
12
|
-
|
13
|
-
def print(msg); end
|
14
|
-
end
|
data/spec/mocks/spoon/kitchen.sh
DELETED
data/spec/mocks/spoon/pan.sh
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
|
12
|
-
describe Simmer::Configuration do
|
13
|
-
let(:path) { File.join('configuration.yaml') }
|
14
|
-
let(:config) { yaml_fixture(path) }
|
15
|
-
let(:simmer_dir) { 'simmer' }
|
16
|
-
|
17
|
-
subject { described_class.new(config, simmer_dir) }
|
18
|
-
|
19
|
-
specify '#mysql_database_config resolves' do
|
20
|
-
expect(subject.mysql_database_config).to eq('mysql_database_key' => 'mysql_database_value')
|
21
|
-
end
|
22
|
-
|
23
|
-
specify '#aws_file_system_config resolves' do
|
24
|
-
expect(subject.aws_file_system_config).to eq('aws_file_system_key' => 'aws_file_system_value')
|
25
|
-
end
|
26
|
-
|
27
|
-
specify '#spoon_client_config resolves' do
|
28
|
-
expect(subject.spoon_client_config).to eq('spoon_client_key' => 'spoon_client_value')
|
29
|
-
end
|
30
|
-
|
31
|
-
specify '#tests_dir resolves' do
|
32
|
-
expect(subject.tests_dir).to eq(File.join(simmer_dir, 'specs'))
|
33
|
-
end
|
34
|
-
|
35
|
-
specify '#fixtures_dir resolves' do
|
36
|
-
expect(subject.fixtures_dir).to eq(File.join(simmer_dir, 'fixtures'))
|
37
|
-
end
|
38
|
-
|
39
|
-
specify '#files_dir resolves' do
|
40
|
-
expect(subject.files_dir).to eq(File.join(simmer_dir, 'files'))
|
41
|
-
end
|
42
|
-
|
43
|
-
specify '#results_dir resolves' do
|
44
|
-
expect(subject.results_dir).to eq(File.join(simmer_dir, 'results'))
|
45
|
-
end
|
46
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
|
12
|
-
describe Simmer::CoreExt::Hash do
|
13
|
-
specify 'Hash#symbolize_keys is implemented' do
|
14
|
-
expect({ 'a' => 'b' }.symbolize_keys).to eq(a: 'b')
|
15
|
-
end
|
16
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
|
12
|
-
describe Simmer::Database::FixtureSet do
|
13
|
-
let(:config) do
|
14
|
-
{
|
15
|
-
'Some Fixture' => {
|
16
|
-
fields: {
|
17
|
-
first: 'Frank',
|
18
|
-
last: 'Rizzo'
|
19
|
-
},
|
20
|
-
table: 'users'
|
21
|
-
},
|
22
|
-
bozo: {
|
23
|
-
fields: {
|
24
|
-
first: 'Bozo',
|
25
|
-
last: 'The Clown'
|
26
|
-
},
|
27
|
-
table: 'users'
|
28
|
-
}
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
subject { described_class.new(config) }
|
33
|
-
|
34
|
-
describe '#get!' do
|
35
|
-
context 'when name is a string' do
|
36
|
-
it 'returns Fixture if name exists' do
|
37
|
-
name = 'Some Fixture'
|
38
|
-
|
39
|
-
expected = Simmer::Database::Fixture.make(config[name.to_s].merge(name: name))
|
40
|
-
|
41
|
-
expect(subject.get!(name)).to eq(expected)
|
42
|
-
|
43
|
-
name = 'bozo'
|
44
|
-
|
45
|
-
expected = Simmer::Database::Fixture.make(config[name.to_sym].merge(name: name))
|
46
|
-
|
47
|
-
expect(subject.get!(name)).to eq(expected)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'raises ArgumentError if name does not exist' do
|
51
|
-
expect { subject.get!(:doesnt_exist) }.to raise_error(ArgumentError)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'when name is a symbol' do
|
56
|
-
it 'returns Fixture if name exists' do
|
57
|
-
name = :'Some Fixture'
|
58
|
-
|
59
|
-
expected = Simmer::Database::Fixture.make(config[name.to_s].merge(name: name))
|
60
|
-
|
61
|
-
expect(subject.get!(name)).to eq(expected)
|
62
|
-
|
63
|
-
name = :bozo
|
64
|
-
|
65
|
-
expected = Simmer::Database::Fixture.make(config[name.to_sym].merge(name: name))
|
66
|
-
|
67
|
-
expect(subject.get!(name)).to eq(expected)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'raises ArgumentError if name does not exist' do
|
71
|
-
expect { subject.get!(:doesnt_exist) }.to raise_error(ArgumentError)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
|
5
|
-
#
|
6
|
-
# This source code is licensed under the MIT license found in the
|
7
|
-
# LICENSE file in the root directory of this source tree.
|
8
|
-
#
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
|
12
|
-
describe Simmer::Database::Fixture do
|
13
|
-
let(:config) do
|
14
|
-
{
|
15
|
-
fields: {
|
16
|
-
first: 'Frank',
|
17
|
-
last: 'Rizzo'
|
18
|
-
},
|
19
|
-
name: 'Some Fixture',
|
20
|
-
table: 'users'
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'initialization' do
|
25
|
-
context 'when using acts_as_hashable' do
|
26
|
-
subject { described_class.make(config) }
|
27
|
-
|
28
|
-
it 'sets fields' do
|
29
|
-
expect(subject.fields).to eq(config[:fields])
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'sets name' do
|
33
|
-
expect(subject.name).to eq(config[:name])
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'sets table' do
|
37
|
-
expect(subject.table).to eq(config[:table])
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'equality' do
|
43
|
-
subject { described_class.new(config) }
|
44
|
-
|
45
|
-
specify '#== compares all attributes' do
|
46
|
-
subject2 = described_class.new(config)
|
47
|
-
|
48
|
-
expect(subject).to eq(subject2)
|
49
|
-
end
|
50
|
-
|
51
|
-
specify '#eql? compares all attributes' do
|
52
|
-
subject2 = described_class.new(config)
|
53
|
-
|
54
|
-
expect(subject).to eql(subject2)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|