-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds dbconsole method to be used when invoking bin/rails dbconsole. Co-authored-by: Paarth Madan <paarth.madan@shopify.com>
- Loading branch information
1 parent
3ec3919
commit 74cfe19
Showing
2 changed files
with
49 additions
and
6 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
27 changes: 27 additions & 0 deletions
27
spec/active_record/connection_adapters/oracle_enhanced/dbconsole_spec.rb
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
describe "Oracle Enhanced adapter dbconsole" do | ||
subject { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter } | ||
|
||
it "uses sqlplus to connect to database" do | ||
expect(subject).to receive(:find_cmd_and_exec).with("sqlplus", "user@db") | ||
|
||
config = make_db_config(adapter: "oracle", database: "db", username: "user", password: "secret") | ||
|
||
subject.dbconsole(config) | ||
end | ||
|
||
it "uses sqlplus with password when specified" do | ||
expect(subject).to receive(:find_cmd_and_exec).with("sqlplus", "user/secret@db") | ||
|
||
config = make_db_config(adapter: "oracle", database: "db", username: "user", password: "secret") | ||
|
||
subject.dbconsole(config, include_password: true) | ||
end | ||
|
||
private | ||
|
||
def make_db_config(config) | ||
ActiveRecord::DatabaseConfigurations::HashConfig.new("test", "primary", config) | ||
end | ||
end |