-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
use
so workers can use middleware.
Note: I'm ~99.9% sure we'll want to use `unshift` rather than `<<` in Gearup::Builder#use, but I'll let tests involving multiple middleware decide :)
- Loading branch information
Brian Cobb
committed
Apr 12, 2012
1 parent
35761eb
commit 767e0a9
Showing
5 changed files
with
70 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Feature: Workers are supported by middleware | ||
|
||
Gearup's DSL implements `use` to specify middleware used by a worker. | ||
|
||
Scenario: Run a worker that uses a basic middleware | ||
Given a file named "worker.rb" with: | ||
""" | ||
module Test | ||
class FromYaml | ||
def initialize(ability) | ||
@ability = ability | ||
end | ||
def call(data, job) | ||
@ability.call(YAML.load(data), job) | ||
end | ||
end | ||
class Echo | ||
def call(data, job) | ||
return data | ||
end | ||
end | ||
end | ||
use Test::FromYaml | ||
enable 'test.echo', Test::Echo.new | ||
""" | ||
When I successfully run `gearup -l ../../log/test.log -v worker.rb` | ||
And I run the test.echo task with "--- :hello" | ||
Then the task should complete with "hello" |
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
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
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
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
767e0a9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naturally, the comment in the commit message does not reflect the fact that I used
unshift
anyway in the implementation. Heh.