diff --git a/lib/dip/cli/console.rb b/lib/dip/cli/console.rb index fa22490..53429eb 100644 --- a/lib/dip/cli/console.rb +++ b/lib/dip/cli/console.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "thor" -require_relative "./base" +require_relative "base" require_relative "../commands/console" module Dip diff --git a/lib/dip/cli/dns.rb b/lib/dip/cli/dns.rb index 6964970..b67667a 100644 --- a/lib/dip/cli/dns.rb +++ b/lib/dip/cli/dns.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "thor" -require_relative "./base" +require_relative "base" require_relative "../commands/dns" module Dip diff --git a/lib/dip/cli/nginx.rb b/lib/dip/cli/nginx.rb index b7e8ca9..1876206 100644 --- a/lib/dip/cli/nginx.rb +++ b/lib/dip/cli/nginx.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "thor" -require_relative "./base" +require_relative "base" require_relative "../commands/nginx" module Dip diff --git a/lib/dip/cli/ssh.rb b/lib/dip/cli/ssh.rb index 263fe33..1c47ecc 100644 --- a/lib/dip/cli/ssh.rb +++ b/lib/dip/cli/ssh.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "thor" -require_relative "./base" +require_relative "base" require_relative "../commands/ssh" module Dip diff --git a/spec/lib/dip/commands/compose_spec.rb b/spec/lib/dip/commands/compose_spec.rb index a574da1..344219c 100644 --- a/spec/lib/dip/commands/compose_spec.rb +++ b/spec/lib/dip/commands/compose_spec.rb @@ -19,7 +19,7 @@ it { expected_exec("docker-compose", ["run", "--rm", "bash"]) } end - context "when config contains project_name", config: true do + context "when config contains project_name", :config do let(:config) { {compose: {project_name: "rocket"}} } before { cli.start "compose run".shellsplit } @@ -27,7 +27,7 @@ it { expected_exec("docker-compose", ["--project-name", "rocket", "run"]) } end - context "when config contains project_name with env vars", config: true, env: true do + context "when config contains project_name with env vars", :config, :env do let(:config) { {compose: {project_name: "rocket-$RAILS_ENV"}} } let(:env) { {"RAILS_ENV" => "test"} } @@ -36,7 +36,7 @@ it { expected_exec("docker-compose", ["--project-name", "rocket-test", "run"]) } end - context "when config contains project_directory", config: true do + context "when config contains project_directory", :config do let(:config) { {compose: {project_directory: "/foo/bar"}} } before { cli.start "compose run".shellsplit } @@ -44,7 +44,7 @@ it { expected_exec("docker-compose", ["--project-directory", "/foo/bar", "run"]) } end - context "when config contains project_directory with env vars", config: true, env: true do + context "when config contains project_directory with env vars", :config, :env do let(:config) { {compose: {project_directory: "/foo-$RAILS_ENV"}} } let(:env) { {"RAILS_ENV" => "test"} } @@ -53,7 +53,7 @@ it { expected_exec("docker-compose", ["--project-directory", "/foo-test", "run"]) } end - context "when compose's config path contains spaces", config: true do + context "when compose's config path contains spaces", :config do let(:config) { {compose: {files: ["file name.yml"]}} } let(:file) { fixture_path("empty", "file name.yml") } @@ -73,7 +73,7 @@ it { expected_exec("docker-compose", ["--file", Shellwords.escape(file), "run"]) } end - context "when config contains multiple docker-compose files", config: true do + context "when config contains multiple docker-compose files", :config do context "and some files are not exist" do let(:config) { {compose: {files: %w[file1.yml file2.yml file3.yml]}} } let(:global_file) { fixture_path("empty", "file1.yml") } @@ -98,7 +98,7 @@ it { expected_exec("docker-compose", ["--file", global_file, "--file", override_file, "run"]) } end - context "and a file name contains env var", env: true do + context "and a file name contains env var", :env do let(:config) { {compose: {files: %w[file1-${DIP_OS}.yml]}} } let(:file) { fixture_path("empty", "file1-darwin.yml") } let(:env) { {"DIP_OS" => "darwin"} } @@ -120,7 +120,7 @@ end end - context "when compose command specified in config", config: true do + context "when compose command specified in config", :config do context "when compose command contains spaces" do let(:config) { {compose: {command: "foo compose"}} } @@ -138,7 +138,7 @@ end end - context "when DIP_COMPOSE_COMMAND is specified in environment", env: true do + context "when DIP_COMPOSE_COMMAND is specified in environment", :env do context "when DIP_COMPOSE_COMMAND contains spaces" do let(:env) { {"DIP_COMPOSE_COMMAND" => "foo compose"} } @@ -155,7 +155,7 @@ it { expected_exec("foo-compose", "run") } end - context "when compose command specified in config", config: true do + context "when compose command specified in config", :config do let(:config) { {compose: {command: "foo compose"}} } let(:env) { {"DIP_COMPOSE_COMMAND" => "bar-compose"} } diff --git a/spec/lib/dip/commands/console_spec.rb b/spec/lib/dip/commands/console_spec.rb index 9b07d6a..ce447de 100644 --- a/spec/lib/dip/commands/console_spec.rb +++ b/spec/lib/dip/commands/console_spec.rb @@ -37,7 +37,7 @@ it { expect { subject }.to output(/unset -f provision/).to_stdout } end - context "when has provision command", config: true do + context "when has provision command", :config do let(:config) { {interaction: commands} } let(:commands) { {bash: {service: "app"}, rails: {service: "app", command: "rails"}} } diff --git a/spec/lib/dip/commands/kubectl_spec.rb b/spec/lib/dip/commands/kubectl_spec.rb index 738cabe..79fc957 100644 --- a/spec/lib/dip/commands/kubectl_spec.rb +++ b/spec/lib/dip/commands/kubectl_spec.rb @@ -19,7 +19,7 @@ it { expected_exec("kubectl", ["exec", "app", "--", "ls", "-l"]) } end - context "when config contains namespace", config: true do + context "when config contains namespace", :config do let(:config) { {kubectl: {namespace: "rocket"}} } before { cli.start "ktl get pods".shellsplit } @@ -27,7 +27,7 @@ it { expected_exec("kubectl", ["--namespace", "rocket", "get", "pods"]) } end - context "when config contains namespace with env vars", config: true, env: true do + context "when config contains namespace with env vars", :config, :env do let(:config) { {kubectl: {namespace: "rocket-${STAGE}"}} } let(:env) { {"STAGE" => "test"} } @@ -36,7 +36,7 @@ it { expected_exec("kubectl", ["--namespace", "rocket-test", "get", "pods"]) } end - context "when config contains namespace with empty env vars", config: true, env: true do + context "when config contains namespace with empty env vars", :config, :env do let(:config) { {kubectl: {namespace: "rocket-${STAGE}"}} } let(:env) { {"STAGE" => ""} } diff --git a/spec/lib/dip/commands/list_spec.rb b/spec/lib/dip/commands/list_spec.rb index 49e77a0..36ea49b 100644 --- a/spec/lib/dip/commands/list_spec.rb +++ b/spec/lib/dip/commands/list_spec.rb @@ -4,7 +4,7 @@ require "dip/cli" require "dip/commands/list" -describe Dip::Commands::List, config: true do +describe Dip::Commands::List, :config do let(:config) { {interaction: commands} } let(:commands) do { diff --git a/spec/lib/dip/commands/provision_spec.rb b/spec/lib/dip/commands/provision_spec.rb index 0f3b31d..0d65107 100644 --- a/spec/lib/dip/commands/provision_spec.rb +++ b/spec/lib/dip/commands/provision_spec.rb @@ -3,7 +3,7 @@ require "dip/cli" require "dip/commands/provision" -describe Dip::Commands::Provision, config: true do +describe Dip::Commands::Provision, :config do let(:config) { {provision: commands} } let(:cli) { Dip::CLI } diff --git a/spec/lib/dip/commands/runners/docker_compose_runner_spec.rb b/spec/lib/dip/commands/runners/docker_compose_runner_spec.rb index a5803b7..e2f22b3 100644 --- a/spec/lib/dip/commands/runners/docker_compose_runner_spec.rb +++ b/spec/lib/dip/commands/runners/docker_compose_runner_spec.rb @@ -4,7 +4,7 @@ require "dip/cli" require "dip/commands/run" -describe Dip::Commands::Runners::DockerComposeRunner, config: true do +describe Dip::Commands::Runners::DockerComposeRunner, :config do let(:config) { {interaction: commands} } let(:commands) do { diff --git a/spec/lib/dip/commands/runners/kubectl_runner_spec.rb b/spec/lib/dip/commands/runners/kubectl_runner_spec.rb index 58147f8..b716629 100644 --- a/spec/lib/dip/commands/runners/kubectl_runner_spec.rb +++ b/spec/lib/dip/commands/runners/kubectl_runner_spec.rb @@ -4,7 +4,7 @@ require "dip/cli" require "dip/commands/run" -describe Dip::Commands::Runners::KubectlRunner, config: true do +describe Dip::Commands::Runners::KubectlRunner, :config do let(:config) { {interaction: commands} } let(:commands) do { diff --git a/spec/lib/dip/commands/runners/local_runner_spec.rb b/spec/lib/dip/commands/runners/local_runner_spec.rb index 0de9045..a02ee01 100644 --- a/spec/lib/dip/commands/runners/local_runner_spec.rb +++ b/spec/lib/dip/commands/runners/local_runner_spec.rb @@ -4,7 +4,7 @@ require "dip/cli" require "dip/commands/run" -describe Dip::Commands::Runners::LocalRunner, config: true do +describe Dip::Commands::Runners::LocalRunner, :config do let(:config) { {interaction: commands} } let(:commands) do { diff --git a/spec/lib/dip/commands/ssh_spec.rb b/spec/lib/dip/commands/ssh_spec.rb index 1cb12a5..ba525a4 100644 --- a/spec/lib/dip/commands/ssh_spec.rb +++ b/spec/lib/dip/commands/ssh_spec.rb @@ -8,7 +8,7 @@ let(:cli) { Dip::CLI::SSH } describe Dip::Commands::SSH::Up do - context "when without arguments", env: true do + context "when without arguments", :env do let(:env) { {"HOME" => "/user"} } before { cli.start "up".shellsplit } diff --git a/spec/lib/dip/config_spec.rb b/spec/lib/dip/config_spec.rb index 70518ed..dd02235 100644 --- a/spec/lib/dip/config_spec.rb +++ b/spec/lib/dip/config_spec.rb @@ -8,7 +8,7 @@ it { is_expected.to be_exist } end - context "when file doesn't exist", env: true do + context "when file doesn't exist", :env do let(:env) { {"DIP_FILE" => "no.yml"} } it { is_expected.not_to be_exist } @@ -17,7 +17,7 @@ %i[environment compose interaction provision].each do |key| describe "##{key}" do - context "when config file doesn't exist", env: true do + context "when config file doesn't exist", :env do let(:env) { {"DIP_FILE" => "no.yml"} } it { expect { subject.public_send(key) }.to raise_error(Dip::Error) } @@ -35,7 +35,7 @@ end end - context "when config has override file", env: true do + context "when config has override file", :env do let(:env) { {"DIP_FILE" => fixture_path("overridden", "dip.yml")} } it "rewrites an array" do @@ -53,7 +53,7 @@ end end - context "when config located two levels higher and overridden at one level higher", env: true do + context "when config located two levels higher and overridden at one level higher", :env do subject { described_class.new(fixture_path("cascade", "sub_a", "sub_b")) } let(:env) { {"DIP_FILE" => nil} } diff --git a/spec/lib/dip/environment_spec.rb b/spec/lib/dip/environment_spec.rb index fd84942..60b5fcd 100644 --- a/spec/lib/dip/environment_spec.rb +++ b/spec/lib/dip/environment_spec.rb @@ -20,14 +20,14 @@ it { is_expected.to include("FOO" => "foo") } end - context "and its exist in ENV", env: true do + context "and its exist in ENV", :env do let(:vars) { {"FOO" => "foo"} } let(:env) { {"FOO" => "bar"} } it { is_expected.to include("FOO" => "bar") } end - context "and some vars were interpolated", env: true do + context "and some vars were interpolated", :env do let(:vars) { {"BAZ" => "baz", "FOO" => "foo-${BAR}-$BAZ"} } let(:env) { {"BAR" => "bar"} } diff --git a/spec/lib/dip_spec.rb b/spec/lib/dip_spec.rb index de8afd9..a23da9c 100644 --- a/spec/lib/dip_spec.rb +++ b/spec/lib/dip_spec.rb @@ -24,7 +24,7 @@ describe ".debug?" do it { expect(described_class.debug?).to be false } - context "when debug is running", env: true do + context "when debug is running", :env do let(:env) { {"DIP_ENV" => "debug"} } it { expect(described_class.debug?).to be true } diff --git a/spec/support/shared_contexts/config.rb b/spec/support/shared_contexts/config.rb index def5d37..c6ea251 100644 --- a/spec/support/shared_contexts/config.rb +++ b/spec/support/shared_contexts/config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_context "dip config", config: true do +shared_context "dip config", :config do before do Dip.config.to_h.merge!(config) end diff --git a/spec/support/shared_contexts/environment.rb b/spec/support/shared_contexts/environment.rb index 3b7ab48..23990b2 100644 --- a/spec/support/shared_contexts/environment.rb +++ b/spec/support/shared_contexts/environment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_context "replace environment vars", env: true do +shared_context "replace environment vars", :env do around do |ex| original = {} diff --git a/spec/support/shared_contexts/runner.rb b/spec/support/shared_contexts/runner.rb index 734f4b3..2476378 100644 --- a/spec/support/shared_contexts/runner.rb +++ b/spec/support/shared_contexts/runner.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_context "dip command", runner: true do +shared_context "dip command", :runner do let(:exec_program_runner) { spy("exec_program runner") } let(:exec_subprocess_runner) { spy("exec_subprocess runner") }