forked from jacquescrocker/guard-resque
-
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.
Added preliminary specs
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 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
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 |
---|---|---|
@@ -1,2 +1,32 @@ | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:spec) | ||
task :default => :spec | ||
|
||
namespace(:spec) do | ||
desc "Run all specs on multiple ruby versions (requires rvm)" | ||
task(:portability) do | ||
rubies = if ENV['RUBIES'] | ||
ENV['RUBIES'].split(' ') | ||
else | ||
%w[1.8.7 1.9.2 ree jruby] | ||
end | ||
rubies.each do |version| | ||
rvm_ruby = if ENV['GEMSET'] | ||
"#{version}@#{ENV['GEMSET']}" | ||
else | ||
version | ||
end | ||
system <<-BASH | ||
bash -c ' | ||
source ~/.rvm/scripts/rvm; | ||
rvm #{rvm_ruby}; | ||
echo "--------- version #{rvm_ruby} ----------\n"; | ||
bundle install; | ||
rake spec' | ||
BASH | ||
end | ||
end | ||
end |
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,45 @@ | ||
require 'guard' | ||
require 'guard/guard' | ||
|
||
module Guard | ||
class DelayedJob < Guard | ||
|
||
def initialize(watchers = [], options = {}) | ||
super | ||
end | ||
|
||
def start | ||
UI.info "Starting up DelayedJob..." | ||
system('script/delayed_job', 'start') | ||
end | ||
|
||
# Called on Ctrl-C signal (when Guard quits) | ||
def stop | ||
UI.info "Starting up DelayedJob..." | ||
system('script/delayed_job', 'stop') | ||
end | ||
|
||
# Called on Ctrl-Z signal | ||
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/... | ||
def reload | ||
restart | ||
end | ||
|
||
# Called on Ctrl-/ signal | ||
# This method should be principally used for long action like running all specs/tests/... | ||
def run_all | ||
restart | ||
end | ||
|
||
# Called on file(s) modifications | ||
def run_on_change(paths) | ||
restart | ||
end | ||
|
||
private | ||
|
||
def restart | ||
system('script/delayed_job', 'restart') | ||
end | ||
end | ||
end |
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,20 @@ | ||
require 'spec_helper' | ||
|
||
describe Guard::DelayedJob do | ||
subject { Guard::DelayedJob.new } | ||
|
||
describe "start" do | ||
before do | ||
subject = Guard::DelayedJob.new | ||
end | ||
|
||
after do | ||
subject.stop | ||
end | ||
|
||
it "should create a pid in /tmp/pids" do | ||
subject.start | ||
Dir.glob("tmp/pids/delayed_job*.pid").should_not be_empty | ||
end | ||
end | ||
end |