Skip to content
Snippets Groups Projects
Commit 6a87ef49 authored by Dean Lovett's avatar Dean Lovett
Browse files

Merge branch '1-fix-generator-issues' into 'master'

fix: add a newline and an instantiator to generators

Closes #1

See merge request !1
parents e54c007a 2b782f89
No related branches found
No related tags found
1 merge request!1fix: add a newline and an instantiator to generators
Pipeline #8521 passed
...@@ -22,7 +22,7 @@ module NexusCqrs ...@@ -22,7 +22,7 @@ module NexusCqrs
template('register_cqrs_handlers.rb', handler_config) template('register_cqrs_handlers.rb', handler_config)
end end
code_to_inject = "$COMMAND_EXECUTOR.register_command(#{full_name}, #{full_name}Handler)" code_to_inject = "$COMMAND_EXECUTOR.register_command(#{full_name}, #{full_name}Handler.new)\n"
inject_into_file(handler_config, code_to_inject, after: "# Register Commands\n") inject_into_file(handler_config, code_to_inject, after: "# Register Commands\n")
end end
......
...@@ -22,7 +22,7 @@ module NexusCqrs ...@@ -22,7 +22,7 @@ module NexusCqrs
template('register_cqrs_handlers.rb', handler_config) template('register_cqrs_handlers.rb', handler_config)
end end
code_to_inject = "$QUERY_EXECUTOR.register_command(#{full_name}, #{full_name}Handler)" code_to_inject = "$QUERY_EXECUTOR.register_command(#{full_name}, #{full_name}Handler.new)\n"
inject_into_file(handler_config, code_to_inject, after: "# Register Queries\n") inject_into_file(handler_config, code_to_inject, after: "# Register Queries\n")
end end
......
...@@ -16,7 +16,7 @@ describe NexusCqrs::CommandGenerator, type: :generator do ...@@ -16,7 +16,7 @@ describe NexusCqrs::CommandGenerator, type: :generator do
end end
it "creates the registration config file for handlers" do it "creates the registration config file for handlers" do
line = "$COMMAND_EXECUTOR.register_command(TestCommand, TestCommandHandler)" line = "$COMMAND_EXECUTOR.register_command(TestCommand, TestCommandHandler.new)"
base_path = File.expand_path("../../tmp", __FILE__) base_path = File.expand_path("../../tmp", __FILE__)
expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line)) expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line))
end end
...@@ -34,7 +34,7 @@ describe NexusCqrs::CommandGenerator, type: :generator do ...@@ -34,7 +34,7 @@ describe NexusCqrs::CommandGenerator, type: :generator do
end end
it "creates the registration config file for handlers" do it "creates the registration config file for handlers" do
line = "$COMMAND_EXECUTOR.register_command(Test::TestCommand, Test::TestCommandHandler)" line = "$COMMAND_EXECUTOR.register_command(Test::TestCommand, Test::TestCommandHandler.new)"
base_path = File.expand_path("../../tmp", __FILE__) base_path = File.expand_path("../../tmp", __FILE__)
expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line)) expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line))
end end
......
...@@ -16,7 +16,7 @@ describe NexusCqrs::QueryGenerator, type: :generator do ...@@ -16,7 +16,7 @@ describe NexusCqrs::QueryGenerator, type: :generator do
end end
it "creates the registration config file for handlers" do it "creates the registration config file for handlers" do
line = "$QUERY_EXECUTOR.register_command(TestQuery, TestQueryHandler)" line = "$QUERY_EXECUTOR.register_command(TestQuery, TestQueryHandler.new)"
base_path = File.expand_path("../../tmp", __FILE__) base_path = File.expand_path("../../tmp", __FILE__)
expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line)) expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line))
end end
...@@ -34,7 +34,7 @@ describe NexusCqrs::QueryGenerator, type: :generator do ...@@ -34,7 +34,7 @@ describe NexusCqrs::QueryGenerator, type: :generator do
end end
it "creates the registration config file for handlers" do it "creates the registration config file for handlers" do
line = "$QUERY_EXECUTOR.register_command(Test::TestQuery, Test::TestQueryHandler)" line = "$QUERY_EXECUTOR.register_command(Test::TestQuery, Test::TestQueryHandler.new)"
base_path = File.expand_path("../../tmp", __FILE__) base_path = File.expand_path("../../tmp", __FILE__)
expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line)) expect(File.read(base_path + "/config/initializers/register_cqrs_handlers.rb")).to(include(line))
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment