-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AlexAvlonitis/allow-multiple-db-gateways
Add multiple gateways support
- Loading branch information
Showing
10 changed files
with
221 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gemspec | ||
|
||
group :test do | ||
gem "rspec" | ||
gem "pry" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
pico_api (0.0.1) | ||
erb (~> 2.2.3) | ||
jsonapi-serializer (~> 2.2.0) | ||
rackup (~> 0.2.2) | ||
rake (~> 13.0.6) | ||
roda (~> 3.61.0) | ||
rom (~> 5.2.6) | ||
rom-sql (~> 3.5.0) | ||
zeitwerk (~> 2.6.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activesupport (7.0.4) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 1.6, < 2) | ||
minitest (>= 5.1) | ||
tzinfo (~> 2.0) | ||
cgi (0.3.3) | ||
coderay (1.1.3) | ||
concurrent-ruby (1.1.10) | ||
diff-lcs (1.5.0) | ||
dry-container (0.11.0) | ||
concurrent-ruby (~> 1.0) | ||
dry-core (0.9.1) | ||
concurrent-ruby (~> 1.0) | ||
zeitwerk (~> 2.6) | ||
dry-equalizer (0.3.0) | ||
dry-inflector (0.3.0) | ||
dry-initializer (3.1.1) | ||
dry-logic (1.3.0) | ||
concurrent-ruby (~> 1.0) | ||
dry-core (~> 0.9, >= 0.9) | ||
zeitwerk (~> 2.6) | ||
dry-struct (1.5.2) | ||
dry-core (~> 0.9, >= 0.9) | ||
dry-types (~> 1.6) | ||
ice_nine (~> 0.11) | ||
zeitwerk (~> 2.6) | ||
dry-types (1.6.1) | ||
concurrent-ruby (~> 1.0) | ||
dry-container (~> 0.3) | ||
dry-core (~> 0.9, >= 0.9) | ||
dry-inflector (~> 0.1, >= 0.1.2) | ||
dry-logic (~> 1.3, >= 1.3) | ||
zeitwerk (~> 2.6) | ||
erb (2.2.3) | ||
cgi | ||
i18n (1.12.0) | ||
concurrent-ruby (~> 1.0) | ||
ice_nine (0.11.2) | ||
jsonapi-serializer (2.2.0) | ||
activesupport (>= 4.2) | ||
method_source (1.0.0) | ||
minitest (5.16.3) | ||
pry (0.14.1) | ||
coderay (~> 1.1) | ||
method_source (~> 1.0) | ||
rack (3.0.0) | ||
rackup (0.2.2) | ||
rack (>= 3.0.0.beta1) | ||
webrick | ||
rake (13.0.6) | ||
roda (3.61.0) | ||
rack | ||
rom (5.2.6) | ||
rom-changeset (~> 5.2, >= 5.2.3) | ||
rom-core (~> 5.2, >= 5.2.5) | ||
rom-repository (~> 5.2, >= 5.2.2) | ||
rom-changeset (5.2.3) | ||
dry-core (~> 0.4) | ||
rom-core (~> 5.2) | ||
transproc (~> 1.0, >= 1.1.0) | ||
rom-core (5.2.6) | ||
concurrent-ruby (~> 1.1) | ||
dry-container (~> 0.7) | ||
dry-core (~> 0.4) | ||
dry-equalizer (~> 0.2) | ||
dry-inflector (~> 0.1) | ||
dry-initializer (~> 3.0, >= 3.0.1) | ||
dry-struct (~> 1.0) | ||
dry-types (~> 1.0) | ||
transproc (~> 1.0, >= 1.1.0) | ||
rom-repository (5.2.2) | ||
dry-core (~> 0.4) | ||
dry-initializer (~> 3.0, >= 3.0.1) | ||
rom-core (~> 5.2, >= 5.2.2) | ||
rom-sql (3.5.0) | ||
dry-core (~> 0.5, >= 0.5) | ||
dry-types (~> 1.0) | ||
rom (~> 5.2, >= 5.2.1) | ||
sequel (>= 4.49) | ||
rspec (3.12.0) | ||
rspec-core (~> 3.12.0) | ||
rspec-expectations (~> 3.12.0) | ||
rspec-mocks (~> 3.12.0) | ||
rspec-core (3.12.0) | ||
rspec-support (~> 3.12.0) | ||
rspec-expectations (3.12.0) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.12.0) | ||
rspec-mocks (3.12.0) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.12.0) | ||
rspec-support (3.12.0) | ||
sequel (5.62.0) | ||
transproc (1.1.1) | ||
tzinfo (2.0.5) | ||
concurrent-ruby (~> 1.0) | ||
webrick (1.7.0) | ||
zeitwerk (2.6.4) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
pico_api! | ||
pry | ||
rspec (~> 3) | ||
|
||
BUNDLED WITH | ||
2.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module PicoApi | ||
VERSION = '0.0.1' | ||
VERSION = '0.0.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe PicoApi::Database do | ||
subject { described_class } | ||
|
||
let(:configuration) { double(:configuration, db_config: db_config) } | ||
let(:db_config) do | ||
{ | ||
default: { | ||
adapter: "memory", | ||
connection_string: "memory://test.db", | ||
options: { | ||
encoding: 'utf8' | ||
} | ||
}, | ||
legacy: { | ||
adapter: "memory", | ||
connection_string: "memory://legacy.db", | ||
options: { | ||
encoding: 'unicode' | ||
} | ||
} | ||
} | ||
end | ||
|
||
before do | ||
allow(PicoApi).to receive(:configuration) { configuration } | ||
subject.setup! | ||
end | ||
|
||
it "builds a correct configuration container" do | ||
expect(subject.container).to be_a(ROM::Container) | ||
end | ||
|
||
it "includes the default gateway" do | ||
expect(subject.container.gateways[:default]).to be_present | ||
end | ||
|
||
it "includes the legacy gateway" do | ||
expect(subject.container.gateways[:legacy]).to be_present | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require_relative "../lib/pico_api" | ||
require "pry" | ||
|
||
RSpec.configure do |config| | ||
config.expect_with :rspec do |expectations| | ||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true | ||
end | ||
|
||
config.mock_with :rspec do |mocks| | ||
mocks.verify_partial_doubles = true | ||
end | ||
|
||
config.shared_context_metadata_behavior = :apply_to_host_groups | ||
end |