Skip to content

Commit

Permalink
fix command can't use string as hashref error
Browse files Browse the repository at this point in the history
I made all the commands into objects, but I forgot to fix the entry
point...
  • Loading branch information
preaction committed Mar 8, 2019
1 parent f315d47 commit 002e8b7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Changelog for Beam-Minion

{{ $NEXT }}

[Fixed]

- Fixed a problem that caused commands to not work at all

0.015 2018-11-03 14:16:37-05:00 America/Chicago

[Fixed]
Expand Down
2 changes: 1 addition & 1 deletion lib/Beam/Runner/Command/minion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sub run {
}
die "Error loading module '$cmd_class': $@\n";
}
return $cmd_class->run( @args );
return $cmd_class->new->run( @args );
}

1;
Expand Down
13 changes: 13 additions & 0 deletions t/command/job.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use warnings;
use Test::More;
use Test::Lib;
use Test::Fatal;
use Beam::Runner::Command::minion;
use Beam::Minion::Command::job;
use File::Temp;
use FindBin ();
Expand Down Expand Up @@ -59,4 +60,16 @@ subtest 'BEAM_MINION must be set' => sub {
'BEAM_MINION missing raises exception';
};

subtest 'can call through Beam::Runner::Command::minion' => sub {
my $mock = Mock::MonkeyPatch->patch(
'Minion::Command::minion::job::run',
sub { },
);

Beam::Runner::Command::minion->run( 'job', '-w' );

ok $mock->called, 'Minion::Command::minion::job->run called';
is_deeply $mock->method_arguments, [qw( -w )], 'arguments are correct';
};

done_testing;
1 change: 1 addition & 0 deletions t/lib/Beam/Minion/Command/test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ loaded and run correctly.
=cut

our @ARGS;
sub new { bless {}, shift }
sub run { @ARGS = @_ }
1;

0 comments on commit 002e8b7

Please sign in to comment.