diff --git a/lib/hanami/cli/commands/app/command.rb b/lib/hanami/cli/commands/app/command.rb index f59f144b..c56c28a7 100644 --- a/lib/hanami/cli/commands/app/command.rb +++ b/lib/hanami/cli/commands/app/command.rb @@ -44,6 +44,9 @@ def call(*args, **opts) Hanami::Env.load super + rescue FileAlreadyExistsError => error + err.puts(error.message) + exit(1) end end diff --git a/lib/hanami/cli/errors.rb b/lib/hanami/cli/errors.rb index 05b8718f..40be0bd9 100644 --- a/lib/hanami/cli/errors.rb +++ b/lib/hanami/cli/errors.rb @@ -46,8 +46,12 @@ def initialize(path) # @api public class FileAlreadyExistsError < Error - def initialize(path) - super("Cannot overwrite existing file: `#{path}`") + ERROR_MESSAGE = <<~ERROR.chomp + The file `%{file_path}` could not be generated because it already exists in your application. + ERROR + + def initialize(file_path) + super(ERROR_MESSAGE % {file_path:}) end end diff --git a/spec/unit/hanami/cli/commands/app/generate/action_spec.rb b/spec/unit/hanami/cli/commands/app/generate/action_spec.rb index f9561e97..3cbf192d 100644 --- a/spec/unit/hanami/cli/commands/app/generate/action_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/action_spec.rb @@ -4,9 +4,10 @@ require "ostruct" RSpec.describe Hanami::CLI::Commands::App::Generate::Action, :app do - subject { described_class.new(fs: fs, inflector: inflector, generator: generator) } + subject { described_class.new(fs: fs, inflector: inflector, generator: generator, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:generator) { Hanami::CLI::Generators::App::Action.new(fs: fs, inflector: inflector) } @@ -20,6 +21,8 @@ def output out.rewind && out.read.chomp end + def error_output = err.string.chomp + shared_context "with existing files" do context "with existing route file" do it "generates action without error" do @@ -35,50 +38,59 @@ def output end context "with existing action file" do + let(:file_path) { "app/actions/#{controller}/#{action}.rb" } + before do within_application_directory do - fs.write("app/actions/#{controller}/#{action}.rb", "") + fs.write(file_path, "") end end - it "raises error" do - expect { - within_application_directory do - generate_action - end - }.to raise_error(Hanami::CLI::FileAlreadyExistsError, "Cannot overwrite existing file: `app/actions/#{controller}/#{action}.rb`") + it "exits with error message" do + expect do + within_application_directory { generate_action } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end context "with existing view file" do + let(:file_path) { "app/views/#{controller}/#{action}.rb" } + before do within_application_directory do - fs.write("app/views/#{controller}/#{action}.rb", "") + fs.write(file_path, "") end end - it "raises error" do - expect { - within_application_directory do - generate_action - end - }.to raise_error(Hanami::CLI::FileAlreadyExistsError, "Cannot overwrite existing file: `app/views/#{controller}/#{action}.rb`") + it "exits with error message" do + expect do + within_application_directory { generate_action } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end context "with existing template file" do + let(:file_path) { "app/templates/#{controller}/#{action}.html.erb" } + before do within_application_directory do - fs.write("app/templates/#{controller}/#{action}.html.erb", "") + fs.write(file_path, "") end end - it "raises error" do - expect { - within_application_directory do - generate_action - end - }.to raise_error(Hanami::CLI::FileAlreadyExistsError, "Cannot overwrite existing file: `app/templates/#{controller}/#{action}.html.erb`") + it "exits with error message" do + expect do + within_application_directory { generate_action } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/component_spec.rb b/spec/unit/hanami/cli/commands/app/generate/component_spec.rb index 8f400e8d..310a7044 100644 --- a/spec/unit/hanami/cli/commands/app/generate/component_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/component_spec.rb @@ -4,9 +4,10 @@ require "ostruct" RSpec.describe Hanami::CLI::Commands::App::Generate::Component, :app do - subject { described_class.new(fs: fs, inflector: inflector, out: out) } + subject { described_class.new(fs: fs, inflector: inflector, out: out, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:app) { Hanami.app.namespace } @@ -18,6 +19,8 @@ def output out.rewind && out.read.chomp end + def error_output = err.string.chomp + context "generating for app" do context "shallowly nested" do it "generates the component" do @@ -39,14 +42,19 @@ class SendWelcomeEmail end context "with existing file" do + let(:file_path) { "app/operations/send_welcome_email.rb" } + before do - fs.write("app/operations/send_welcome_email.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "operations.send_welcome_email") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -75,14 +83,19 @@ class SendWelcomeEmail end context "with existing file" do + let(:file_path) { "app/operations/user/mailing/send_welcome_email.rb" } + before do - fs.write("app/operations/user/mailing/send_welcome_email.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "operations.user.mailing.send_welcome_email") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -110,14 +123,19 @@ class WelcomeEmail end context "with existing file" do + let(:file_path) { "slices/main/renderers/welcome_email.rb" } + before do - fs.write("slices/main/renderers/welcome_email.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "renderers.welcome_email", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -147,14 +165,19 @@ class WelcomeEmail end context "with existing file" do + let(:file_path) { "slices/main/renderers/user/mailing/welcome_email.rb" } + before do - fs.write("slices/main/renderers/user/mailing/welcome_email.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "renderers.user.mailing.welcome_email", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/migration_spec.rb b/spec/unit/hanami/cli/commands/app/generate/migration_spec.rb index 3707e076..3fd202ec 100644 --- a/spec/unit/hanami/cli/commands/app/generate/migration_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/migration_spec.rb @@ -3,17 +3,20 @@ require "hanami" RSpec.describe Hanami::CLI::Commands::App::Generate::Migration, :app do - subject { described_class.new(fs: fs, inflector: inflector) } + subject { described_class.new(fs: fs, inflector: inflector, err: err) } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:out) { StringIO.new } + let(:err) { StringIO.new } def output out.string.strip end + def error_output = err.string.chomp + let(:app) { Hanami.app.namespace } let(:migration_file_contents) { @@ -66,14 +69,19 @@ def output end context "with existing file" do + let(:file_path) { "config/db/migrate/20240713140600_create_posts.rb" } + before do - fs.write("config/db/migrate/20240713140600_create_posts.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "create_posts") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -90,15 +98,20 @@ def output end context "with existing file" do + let(:file_path) { "slices/main/config/db/migrate/20240713140600_create_posts.rb" } + context "with existing file" do before do - fs.write("slices/main/config/db/migrate/20240713140600_create_posts.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "create_posts", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/operation_spec.rb b/spec/unit/hanami/cli/commands/app/generate/operation_spec.rb index 46a1e992..065caae9 100644 --- a/spec/unit/hanami/cli/commands/app/generate/operation_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/operation_spec.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true RSpec.describe Hanami::CLI::Commands::App::Generate::Operation, :app do - subject { described_class.new(fs: fs, inflector: inflector, out: out) } + subject { described_class.new(fs: fs, inflector: inflector, out: out, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:app) { Hanami.app.namespace } @@ -12,6 +13,8 @@ def output out.string.chomp end + def error_output = err.string.chomp + context "generating for app" do it "generates an operation without a namespace, with a recommendation" do subject.call(name: "add_book") @@ -80,14 +83,19 @@ def call end context "with existing file" do + let(:file_path) { "app/admin/books/add.rb" } + before do - fs.write("app/admin/books/add.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "admin.books.add") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -140,15 +148,20 @@ def call end context "with existing file" do + let(:file_path) { "slices/main/admin/books/add.rb" } + before do fs.mkdir("slices/main") - fs.write("slices/main/admin/books/add.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "admin.books.add", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/part_spec.rb b/spec/unit/hanami/cli/commands/app/generate/part_spec.rb index 00bc74fc..44d33265 100644 --- a/spec/unit/hanami/cli/commands/app/generate/part_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/part_spec.rb @@ -4,9 +4,10 @@ require "ostruct" RSpec.describe Hanami::CLI::Commands::App::Generate::Part, :app do - subject { described_class.new(fs: fs, inflector: inflector, generator: generator) } + subject { described_class.new(fs: fs, inflector: inflector, generator: generator, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:generator) { Hanami::CLI::Generators::App::Part.new(fs: fs, inflector: inflector) } @@ -17,6 +18,8 @@ def output out.rewind && out.read.chomp end + def error_output = err.string.chomp + context "generating for app" do context "without base part" do it "generates base part and the part" do @@ -60,17 +63,20 @@ class User < Test::Views::Part end context "with existing file" do + let(:file_path) { "app/views/parts/user.rb" } + before do within_application_directory do - fs.write("app/views/parts/user.rb", "existing content") + fs.write(file_path, "existing content") end end - it "raises error" do - within_application_directory do - expect { - subject.call(name: "user") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + within_application_directory { subject.call(name: "user") } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} end end end @@ -226,18 +232,21 @@ class User < Main::Views::Part end context "with existing file" do + let(:file_path) { "slices/main/views/parts/user.rb" } + before do within_application_directory do fs.mkdir("slices/main") - fs.write("slices/main/views/parts/user.rb", "existing content") + fs.write(file_path, "existing content") end end - it "raises error" do - within_application_directory do - expect { - subject.call(name: "user", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + within_application_directory { subject.call(name: "user", slice: "main") } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/relation_spec.rb b/spec/unit/hanami/cli/commands/app/generate/relation_spec.rb index 669816ec..03bd4368 100644 --- a/spec/unit/hanami/cli/commands/app/generate/relation_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/relation_spec.rb @@ -1,13 +1,17 @@ # frozen_string_literal: true RSpec.describe Hanami::CLI::Commands::App::Generate::Relation, "#call", :app_integration do - subject { described_class.new(inflector: inflector, out: out) } + subject { described_class.new(inflector: inflector, out: out, err: err) } let(:inflector) { Dry::Inflector.new } let(:out) { StringIO.new } + let(:err) { StringIO.new } + def output = out.string + def error_output = err.string.chomp + before do with_directory(@dir = make_tmp_directory) do write "config/app.rb", <<~RUBY @@ -116,13 +120,19 @@ class Books < TestApp::DB::Relation end context "with existing file" do + let(:file_path) { "app/relations/books.rb" } + before do - write "app/relations/books.rb", "existing content" + write file_path, "existing content" end - it "raises error" do - expect { subject.call(name: "books") } - .to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + subject.call(name: "books") + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -191,13 +201,19 @@ class Drafts < Main::DB::Relation end context "with existing file" do + let(:file_path) { "slices/main/relations/books.rb" } + before do - write "slices/main/relations/books.rb", "existing content" + write file_path, "existing content" end - it "raises error" do - expect { subject.call(name: "books", slice: "main") } - .to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + subject.call(name: "books", slice: "main") + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/repo_spec.rb b/spec/unit/hanami/cli/commands/app/generate/repo_spec.rb index a15163bd..f42bdb3a 100644 --- a/spec/unit/hanami/cli/commands/app/generate/repo_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/repo_spec.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true RSpec.describe Hanami::CLI::Commands::App::Generate::Repo, :app do - subject { described_class.new(fs: fs, inflector: inflector, out: out) } + subject { described_class.new(fs: fs, inflector: inflector, out: out, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:app) { Hanami.app.namespace } @@ -12,6 +13,8 @@ def output out.string end + def error_output = err.string.chomp + context "generating for app" do describe "without namespace" do it "generates a repo and singularizes name properly" do @@ -94,14 +97,19 @@ class HardcoverRepo < Test::DB::Repo end context "with existing file" do + let(:file_path) { "app/repos/book_repo.rb" } + before do - fs.write("app/repos/book_repo.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "books") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -148,14 +156,19 @@ class DraftRepo < Main::DB::Repo end context "with existing file" do + let(:file_path) { "slices/main/repos/book_repo.rb" } + before do - fs.write("slices/main/repos/book_repo.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "books", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/struct_spec.rb b/spec/unit/hanami/cli/commands/app/generate/struct_spec.rb index 490914cd..550b90bb 100644 --- a/spec/unit/hanami/cli/commands/app/generate/struct_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/struct_spec.rb @@ -1,16 +1,17 @@ # frozen_string_literal: true RSpec.describe Hanami::CLI::Commands::App::Generate::Struct, :app do - subject { described_class.new(fs: fs, inflector: inflector, out: out) } + subject { described_class.new(fs: fs, inflector: inflector, out: out, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:app) { Hanami.app.namespace } - def output - out.string.chomp - end + def output = out.string.chomp + + def error_output = err.string.chomp context "generating for app" do it "generates a struct without a namespace" do @@ -74,14 +75,19 @@ class Hardcover < Test::DB::Struct end context "with existing file" do + let(:file_path) { "app/structs/book/published/hardcover.rb" } + before do - fs.write("app/structs/book/published/hardcover.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "book/published/hardcover") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end @@ -128,14 +134,19 @@ class DraftBook < Main::DB::Struct end context "with existing file" do + let(:file_path) { "slices/main/structs/book/draft_book.rb" } + before do - fs.write("slices/main/structs/book/draft_book.rb", "existing content") + fs.write(file_path, "existing content") end - it "raises error" do - expect { + it "exits with error message" do + expect do subject.call(name: "book.draft_book", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} + end end end end diff --git a/spec/unit/hanami/cli/commands/app/generate/view_spec.rb b/spec/unit/hanami/cli/commands/app/generate/view_spec.rb index b761979f..b246c33c 100644 --- a/spec/unit/hanami/cli/commands/app/generate/view_spec.rb +++ b/spec/unit/hanami/cli/commands/app/generate/view_spec.rb @@ -4,9 +4,10 @@ require "ostruct" RSpec.describe Hanami::CLI::Commands::App::Generate::View, :app do - subject { described_class.new(fs: fs, inflector: inflector, generator: generator) } + subject { described_class.new(fs: fs, inflector: inflector, generator: generator, err: err) } let(:out) { StringIO.new } + let(:err) { StringIO.new } let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } let(:inflector) { Dry::Inflector.new } let(:generator) { Hanami::CLI::Generators::App::View.new(fs: fs, inflector: inflector) } @@ -17,6 +18,8 @@ def output out.rewind && out.read.chomp end + def error_output = err.string.chomp + # it "raises error if action name doesn't respect the convention" do # expect { # subject.call(name: "foo") @@ -93,17 +96,20 @@ class Index < Test::View end context "with existing file" do + let(:file_path) { "app/views/users/index.rb" } + before do within_application_directory do - fs.write("app/views/users/index.rb", "existing content") + fs.write(file_path, "existing content") end end - it "raises error" do - within_application_directory do - expect { - subject.call(name: "users.index") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + within_application_directory { subject.call(name: "users.index") } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} end end end @@ -145,18 +151,21 @@ class Index < Main::View end context "with existing file" do + let(:file_path) { "slices/main/views/users/index.rb" } + before do within_application_directory do fs.mkdir("slices/main") - fs.write("slices/main/views/users/index.rb", "existing content") + fs.write(file_path, "existing content") end end - it "raises error" do - within_application_directory do - expect { - subject.call(name: "users.index", slice: "main") - }.to raise_error(Hanami::CLI::FileAlreadyExistsError) + it "exits with error message" do + expect do + within_application_directory { subject.call(name: "users.index", slice: "main") } + end.to raise_error SystemExit do |exception| + expect(exception.status).to eq 1 + expect(error_output).to eq Hanami::CLI::FileAlreadyExistsError::ERROR_MESSAGE % {file_path:} end end end