rubypitaya 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubypitaya/app-template/Gemfile +2 -1
- data/lib/rubypitaya/app-template/Gemfile.lock +18 -3
- data/lib/rubypitaya/app-template/Makefile +13 -5
- data/lib/rubypitaya/app-template/bin/console +2 -1
- data/lib/rubypitaya/app-template/features/hello_world.feature +8 -0
- data/lib/rubypitaya/app-template/features/player.feature +21 -0
- data/lib/rubypitaya/app-template/features/step_definitions/application_steps.rb +12 -0
- data/lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb +36 -0
- data/lib/rubypitaya/app-template/features/support/env.rb +0 -0
- data/lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb +1 -1
- data/lib/rubypitaya/app-template/spec/player_handler_spec.rb +2 -2
- data/lib/rubypitaya/app-template/spec/spec_helper.rb +102 -0
- data/lib/rubypitaya/core/handler_router.rb +2 -0
- data/lib/rubypitaya/core/helpers/setup_helper.rb +37 -0
- data/lib/rubypitaya/core/spec-helpers/config_spec_helper.rb +19 -2
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb +8 -0
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper_class.rb +8 -0
- data/lib/rubypitaya/core/spec-helpers/rubypitaya_spec_helper.rb +2 -37
- data/lib/rubypitaya/core/spec-helpers/setup_spec_helper.rb +18 -1
- data/lib/rubypitaya/version.rb +1 -1
- metadata +23 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b321da34730806680b92f8bb44ceff0c79f8210d57b5965b37f1628a75c909d9
|
4
|
+
data.tar.gz: 19972a31be303fc21fedd839d5183a12c31cee79b49504ebaad9c19fa8376b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2f1bcaadf6baa4f3fa268641adc59482ee80bcd6d68d47b0ee1d0f09fdcb5c14c03ca1b8e49fe7da937d9e351a9a74b7fac7783c7b3451555eff8f61508c659
|
7
|
+
data.tar.gz: ea75de7b7e2ac13c15d46f62d7663f68a0748b447333cea3ac5d8c1af673697cf819de046fff117e40c3437ed1a8a0252cf665bccc600a8c02317c11f5db6afc
|
@@ -12,20 +12,33 @@ GEM
|
|
12
12
|
minitest (~> 5.1)
|
13
13
|
tzinfo (~> 1.1)
|
14
14
|
zeitwerk (~> 2.2)
|
15
|
+
builder (3.2.4)
|
15
16
|
coderay (1.1.3)
|
16
17
|
concurrent-ruby (1.1.7)
|
18
|
+
cucumber (2.4.0)
|
19
|
+
builder (>= 2.1.2)
|
20
|
+
cucumber-core (~> 1.5.0)
|
21
|
+
cucumber-wire (~> 0.0.1)
|
22
|
+
diff-lcs (>= 1.1.3)
|
23
|
+
gherkin (~> 4.0)
|
24
|
+
multi_json (>= 1.7.5, < 2.0)
|
25
|
+
multi_test (>= 0.1.2)
|
26
|
+
cucumber-core (1.5.0)
|
27
|
+
gherkin (~> 4.0)
|
28
|
+
cucumber-wire (0.0.1)
|
17
29
|
diff-lcs (1.4.4)
|
18
30
|
etcdv3 (0.10.2)
|
19
31
|
grpc (~> 1.17)
|
20
32
|
eventmachine (1.2.7)
|
21
33
|
ffi (1.14.2)
|
34
|
+
gherkin (4.1.3)
|
22
35
|
google-protobuf (3.14.0)
|
23
36
|
googleapis-common-protos-types (1.0.5)
|
24
37
|
google-protobuf (~> 3.11)
|
25
38
|
grpc (1.34.0)
|
26
39
|
google-protobuf (~> 3.13)
|
27
40
|
googleapis-common-protos-types (~> 1.0)
|
28
|
-
i18n (1.8.
|
41
|
+
i18n (1.8.6)
|
29
42
|
concurrent-ruby (~> 1.0)
|
30
43
|
listen (3.2.1)
|
31
44
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
@@ -34,6 +47,7 @@ GEM
|
|
34
47
|
middleware (0.1.0)
|
35
48
|
minitest (5.14.2)
|
36
49
|
multi_json (1.15.0)
|
50
|
+
multi_test (0.1.2)
|
37
51
|
mustermann (1.1.1)
|
38
52
|
ruby2_keywords (~> 0.0.1)
|
39
53
|
nats (0.11.0)
|
@@ -70,7 +84,7 @@ GEM
|
|
70
84
|
rspec-support (~> 3.8.0)
|
71
85
|
rspec-support (3.8.3)
|
72
86
|
ruby2_keywords (0.0.2)
|
73
|
-
rubypitaya (2.
|
87
|
+
rubypitaya (2.11.0)
|
74
88
|
activerecord (= 6.0.2)
|
75
89
|
etcdv3 (= 0.10.2)
|
76
90
|
eventmachine (= 1.2.7)
|
@@ -105,10 +119,11 @@ PLATFORMS
|
|
105
119
|
|
106
120
|
DEPENDENCIES
|
107
121
|
bundler (= 1.17.2)
|
122
|
+
cucumber (= 2.4.0)
|
108
123
|
listen (= 3.2.1)
|
109
124
|
pry (= 0.12.2)
|
110
125
|
rspec (= 3.8.0)
|
111
|
-
rubypitaya (= 2.
|
126
|
+
rubypitaya (= 2.11.0)
|
112
127
|
|
113
128
|
BUNDLED WITH
|
114
129
|
1.17.2
|
@@ -21,15 +21,23 @@ console:
|
|
21
21
|
## Run bash on container
|
22
22
|
bash:
|
23
23
|
@docker-compose run --service-ports --rm rubypitaya bash
|
24
|
-
|
25
|
-
## Run tests
|
26
|
-
test:
|
27
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rspec
|
28
|
-
|
29
24
|
## Kill all containers
|
30
25
|
kill:
|
31
26
|
@docker rm -f $$(docker-compose ps -aq)
|
32
27
|
|
28
|
+
## + Test Commands
|
29
|
+
|
30
|
+
## Run all tests
|
31
|
+
test: test-rspec test-cucumber
|
32
|
+
|
33
|
+
## Run rspec tests. FILE=spec.rb:10
|
34
|
+
test-rspec:
|
35
|
+
@docker-compose run --service-ports --rm rubypitaya bundle exec rspec $(FILE)
|
36
|
+
|
37
|
+
## Run cucumber tests. FILE=something.feature
|
38
|
+
test-cucumber:
|
39
|
+
@docker-compose run --service-ports --rm rubypitaya bundle exec cucumber $(FILE)
|
40
|
+
|
33
41
|
## Update gems dependencies on Gemfile.lock
|
34
42
|
update-dependencies:
|
35
43
|
@rm -f Gemfile.lock
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Hello World
|
2
|
+
|
3
|
+
As a developer I want to see the hello world messages
|
4
|
+
|
5
|
+
Scenario: Hello World message
|
6
|
+
Given client call route 'rubypitaya.helloWorldHandler.sayHello'
|
7
|
+
Then server should response 'code' as 'RP-200'
|
8
|
+
And server should response 'data.message' as 'Hello!'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Player
|
2
|
+
|
3
|
+
As a game player I want to have a player on database
|
4
|
+
|
5
|
+
Scenario: Create new player
|
6
|
+
Given setup key 'initial_player.wallet.gold' is '10'
|
7
|
+
And config key 'initial_player.name' is 'Guest'
|
8
|
+
When client call route 'rubypitaya.playerHandler.authenticate'
|
9
|
+
Then server should response 'code' as 'RP-200'
|
10
|
+
And server should response 'data.name' as 'Guest'
|
11
|
+
And server should response 'data.gold' as '10'
|
12
|
+
|
13
|
+
Scenario: Get player info
|
14
|
+
Given the following player:
|
15
|
+
| name | gold |
|
16
|
+
| Someone | 15 |
|
17
|
+
And the player 'Someone' is authenticated
|
18
|
+
When client call route 'rubypitaya.playerHandler.getInfo'
|
19
|
+
Then server should response 'code' as 'RP-200'
|
20
|
+
And server should response 'data.name' as 'Someone'
|
21
|
+
And server should response 'data.gold' as '15'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Given(/^[Tt]he [Pp]layer ["'](.+)["'] is authenticated$/) do |player_name|
|
2
|
+
player = MyApp::Player.find_by_name(player_name)
|
3
|
+
@handler_helper.authenticate(player.user_id)
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^[Tt]he following [Pp]layer[s]*[:]*$/) do |table|
|
7
|
+
player_hashes = table.hashes
|
8
|
+
player_hashes.each do |player_hash|
|
9
|
+
player_hash[:user] = User.new
|
10
|
+
MyApp::Player.create(player_hash)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
ENV['RUBYPITAYA_ENV'] = 'test'
|
4
|
+
|
5
|
+
require 'rubypitaya/core/helpers/setup_helper'
|
6
|
+
require 'rubypitaya/core/spec-helpers/handler_spec_helper_class'
|
7
|
+
|
8
|
+
Given(/^[Cc]lient call route ["'](.+)["']$/) do |route|
|
9
|
+
@handler_helper.request(route)
|
10
|
+
end
|
11
|
+
|
12
|
+
Given(/^[Ss]erver should response ["'](.+)["'] as ["'](.+)["']$/) do |response_key, expected_value|
|
13
|
+
response_value = @handler_helper.response.dig(*response_key.split('.').map(&:to_sym))
|
14
|
+
|
15
|
+
expect(response_value.to_s).to eq(expected_value)
|
16
|
+
end
|
17
|
+
|
18
|
+
Given(/^[Ss]etup key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
|
19
|
+
@handler_helper.add_setup(key, value)
|
20
|
+
end
|
21
|
+
|
22
|
+
Given(/^[Cc]onfig key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
|
23
|
+
@handler_helper.add_config(key, value)
|
24
|
+
end
|
25
|
+
|
26
|
+
Given(/^[Pp]rint server response$/) do
|
27
|
+
puts "response: #{@handler_helper.response}"
|
28
|
+
end
|
29
|
+
|
30
|
+
Before do
|
31
|
+
ActiveRecord::Base.descendants.each { |c| c.delete_all unless c == ActiveRecord::SchemaMigration }
|
32
|
+
@handler_helper = RubyPitaya::HandlerSpecHelperClass.new('cucumber')
|
33
|
+
end
|
34
|
+
|
35
|
+
# After do
|
36
|
+
# end
|
File without changes
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
module MyApp
|
4
4
|
|
5
5
|
RSpec.describe 'PlayerHandler', type: :request do
|
6
6
|
context 'authenticate' do
|
7
7
|
it 'create_new_user' do
|
8
|
-
setup = {'initial_player
|
8
|
+
setup = {'initial_player' => {'wallet' => {'gold' => 10}}}
|
9
9
|
config = {'initial_player' => {'name' => 'Guest'}}
|
10
10
|
|
11
11
|
set_setup(setup)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubypitaya/core/spec-helpers/rubypitaya_spec_helper'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
43
|
+
# have no way to turn it off -- the option exists only for backwards
|
44
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
45
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
46
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
47
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
=begin
|
52
|
+
# This allows you to limit a spec run to individual examples or groups
|
53
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
54
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
55
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
56
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
57
|
+
config.filter_run_when_matching :focus
|
58
|
+
|
59
|
+
# Allows RSpec to persist some state between runs in order to support
|
60
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
61
|
+
# you configure your source control system to ignore this file.
|
62
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
63
|
+
|
64
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
65
|
+
# recommended. For more details, see:
|
66
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
67
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
68
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
69
|
+
config.disable_monkey_patching!
|
70
|
+
|
71
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
72
|
+
# be too noisy due to issues in dependencies.
|
73
|
+
config.warnings = true
|
74
|
+
|
75
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
76
|
+
# file, and it's useful to allow more verbose output when running an
|
77
|
+
# individual spec file.
|
78
|
+
if config.files_to_run.one?
|
79
|
+
# Use the documentation formatter for detailed output,
|
80
|
+
# unless a formatter has already been configured
|
81
|
+
# (e.g. via a command-line flag).
|
82
|
+
config.default_formatter = "doc"
|
83
|
+
end
|
84
|
+
|
85
|
+
# Print the 10 slowest examples and example groups at the
|
86
|
+
# end of the spec run, to help surface which specs are running
|
87
|
+
# particularly slow.
|
88
|
+
config.profile_examples = 10
|
89
|
+
|
90
|
+
# Run specs in random order to surface order dependencies. If you find an
|
91
|
+
# order dependency and want to debug it, you can fix the order by providing
|
92
|
+
# the seed, which is printed after each run.
|
93
|
+
# --seed 1234
|
94
|
+
config.order = :random
|
95
|
+
|
96
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
97
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
98
|
+
# test failures related to randomization by passing the same `--seed` value
|
99
|
+
# as the one that triggered the failure.
|
100
|
+
Kernel.srand config.seed
|
101
|
+
=end
|
102
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
require 'rubypitaya/core/database_config'
|
4
|
+
|
5
|
+
# Database connection
|
6
|
+
environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
|
7
|
+
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
|
8
|
+
ActiveRecord::Base.establish_connection(database_config.connection_data)
|
9
|
+
# ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
|
10
|
+
# ActiveSupport::LogSubscriber.colorize_logging = true
|
11
|
+
|
12
|
+
connection_data = database_config.connection_data
|
13
|
+
migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
|
14
|
+
migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
|
15
|
+
migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
|
16
|
+
ActiveRecord::Migrator.migrations_paths = migrations_paths
|
17
|
+
ActiveRecord::Migration.maintain_test_schema!
|
18
|
+
|
19
|
+
# Loading core files
|
20
|
+
Gem.find_files('rubypitaya/**/*.rb').each do |path|
|
21
|
+
require path unless path.end_with?('spec.rb') ||
|
22
|
+
path.include?('db/migration') ||
|
23
|
+
path.include?('core/templates') ||
|
24
|
+
path.include?('core/spec-helpers') ||
|
25
|
+
path.include?('app-template')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Loading application files
|
29
|
+
app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
|
30
|
+
app_folder_paths.each do |app_folder_path|
|
31
|
+
app_files_path = File.join(app_folder_path, '**/*.rb')
|
32
|
+
|
33
|
+
Dir[app_files_path].each do |path|
|
34
|
+
require path unless path.end_with?('spec.rb') ||
|
35
|
+
path.include?('db/migration')
|
36
|
+
end
|
37
|
+
end
|
@@ -7,7 +7,8 @@ module RubyPitaya
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](key)
|
10
|
-
|
10
|
+
split_key = key.split('.')
|
11
|
+
@config_mock.dig(*split_key)
|
11
12
|
end
|
12
13
|
|
13
14
|
def auto_reload
|
@@ -18,7 +19,23 @@ module RubyPitaya
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def config_core_override=(value)
|
21
|
-
config_mock = value
|
22
|
+
@config_mock = value
|
23
|
+
end
|
24
|
+
|
25
|
+
def add(key, value)
|
26
|
+
keys = key.split('.')
|
27
|
+
add_hash = undig(*keys, value)
|
28
|
+
@config_mock = merge_recursively(@config_mock, add_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def undig(*keys, value)
|
34
|
+
keys.empty? ? value : { keys.first=>undig(*keys.drop(1), value) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def merge_recursively(a, b)
|
38
|
+
a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
|
22
39
|
end
|
23
40
|
end
|
24
41
|
end
|
@@ -1,44 +1,9 @@
|
|
1
1
|
require 'rspec'
|
2
|
-
require 'active_record'
|
3
|
-
|
4
|
-
require 'rubypitaya/core/database_config'
|
5
|
-
require 'rubypitaya/core/spec-helpers/handler_spec_helper'
|
6
2
|
|
7
3
|
ENV['RUBYPITAYA_ENV'] = 'test'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
|
12
|
-
ActiveRecord::Base.establish_connection(database_config.connection_data)
|
13
|
-
# ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
|
14
|
-
# ActiveSupport::LogSubscriber.colorize_logging = true
|
15
|
-
|
16
|
-
connection_data = database_config.connection_data
|
17
|
-
migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
|
18
|
-
migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
|
19
|
-
migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
|
20
|
-
ActiveRecord::Migrator.migrations_paths = migrations_paths
|
21
|
-
ActiveRecord::Migration.maintain_test_schema!
|
22
|
-
|
23
|
-
# Loading core files
|
24
|
-
Gem.find_files('rubypitaya/**/*.rb').each do |path|
|
25
|
-
require path unless path.end_with?('spec.rb') ||
|
26
|
-
path.include?('db/migration') ||
|
27
|
-
path.include?('core/templates') ||
|
28
|
-
path.include?('core/spec-helpers') ||
|
29
|
-
path.include?('app-template')
|
30
|
-
end
|
31
|
-
|
32
|
-
# Loading application files
|
33
|
-
app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
|
34
|
-
app_folder_paths.each do |app_folder_path|
|
35
|
-
app_files_path = File.join(app_folder_path, '**/*.rb')
|
36
|
-
|
37
|
-
Dir[app_files_path].each do |path|
|
38
|
-
require path unless path.end_with?('spec.rb') ||
|
39
|
-
path.include?('db/migration')
|
40
|
-
end
|
41
|
-
end
|
5
|
+
require 'rubypitaya/core/helpers/setup_helper'
|
6
|
+
require 'rubypitaya/core/spec-helpers/handler_spec_helper'
|
42
7
|
|
43
8
|
RSpec.configure do |config|
|
44
9
|
config.include RubyPitaya::HandlerSpecHelper
|
@@ -7,7 +7,8 @@ module RubyPitaya
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](key)
|
10
|
-
|
10
|
+
split_key = key.split('.')
|
11
|
+
@setup_mock.dig(*split_key)
|
11
12
|
end
|
12
13
|
|
13
14
|
def auto_reload
|
@@ -16,5 +17,21 @@ module RubyPitaya
|
|
16
17
|
def setup_mock=(value)
|
17
18
|
@setup_mock = value
|
18
19
|
end
|
20
|
+
|
21
|
+
def add(key, value)
|
22
|
+
keys = key.split('.')
|
23
|
+
add_hash = undig(*keys, value)
|
24
|
+
@setup_mock = merge_recursively(@setup_mock, add_hash)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def undig(*keys, value)
|
30
|
+
keys.empty? ? value : { keys.first=>undig(*keys.drop(1), value) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def merge_recursively(a, b)
|
34
|
+
a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
|
35
|
+
end
|
19
36
|
end
|
20
37
|
end
|
data/lib/rubypitaya/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypitaya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luciano Prestes Cavalcanti
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - '='
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 3.2.1
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: cucumber
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - '='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 2.4.0
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - '='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 2.4.0
|
223
237
|
description: RubyPitaya is an application to create servers using the pitaya protocol.
|
224
238
|
email:
|
225
239
|
- lucianopcbr@gmail.com
|
@@ -254,6 +268,11 @@ files:
|
|
254
268
|
- "./lib/rubypitaya/app-template/docker/dev/Dockerfile"
|
255
269
|
- "./lib/rubypitaya/app-template/docker/entrypoint.sh"
|
256
270
|
- "./lib/rubypitaya/app-template/docker/prod/Dockerfile"
|
271
|
+
- "./lib/rubypitaya/app-template/features/hello_world.feature"
|
272
|
+
- "./lib/rubypitaya/app-template/features/player.feature"
|
273
|
+
- "./lib/rubypitaya/app-template/features/step_definitions/application_steps.rb"
|
274
|
+
- "./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb"
|
275
|
+
- "./lib/rubypitaya/app-template/features/support/env.rb"
|
257
276
|
- "./lib/rubypitaya/app-template/kubernetes/README.md"
|
258
277
|
- "./lib/rubypitaya/app-template/kubernetes/deployment-connector.yaml"
|
259
278
|
- "./lib/rubypitaya/app-template/kubernetes/deployment-rubypitaya.yaml"
|
@@ -276,6 +295,7 @@ files:
|
|
276
295
|
- "./lib/rubypitaya/app-template/kubernetes/statefulset-redis.yaml"
|
277
296
|
- "./lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb"
|
278
297
|
- "./lib/rubypitaya/app-template/spec/player_handler_spec.rb"
|
298
|
+
- "./lib/rubypitaya/app-template/spec/spec_helper.rb"
|
279
299
|
- "./lib/rubypitaya/core/app/models/user.rb"
|
280
300
|
- "./lib/rubypitaya/core/application_files_importer.rb"
|
281
301
|
- "./lib/rubypitaya/core/config.rb"
|
@@ -286,6 +306,7 @@ files:
|
|
286
306
|
- "./lib/rubypitaya/core/etcd_connector.rb"
|
287
307
|
- "./lib/rubypitaya/core/handler_base.rb"
|
288
308
|
- "./lib/rubypitaya/core/handler_router.rb"
|
309
|
+
- "./lib/rubypitaya/core/helpers/setup_helper.rb"
|
289
310
|
- "./lib/rubypitaya/core/http_routes.rb"
|
290
311
|
- "./lib/rubypitaya/core/initializer_base.rb"
|
291
312
|
- "./lib/rubypitaya/core/initializer_broadcast.rb"
|
@@ -302,6 +323,7 @@ files:
|
|
302
323
|
- "./lib/rubypitaya/core/setup.rb"
|
303
324
|
- "./lib/rubypitaya/core/spec-helpers/config_spec_helper.rb"
|
304
325
|
- "./lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb"
|
326
|
+
- "./lib/rubypitaya/core/spec-helpers/handler_spec_helper_class.rb"
|
305
327
|
- "./lib/rubypitaya/core/spec-helpers/postman_spec_helper.rb"
|
306
328
|
- "./lib/rubypitaya/core/spec-helpers/rubypitaya_spec_helper.rb"
|
307
329
|
- "./lib/rubypitaya/core/spec-helpers/setup_spec_helper.rb"
|