Created
July 23, 2010 14:00
-
-
Save laszpio/487467 to your computer and use it in GitHub Desktop.
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
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') | |
require "rake" | |
describe "Upload inventory to abe" do | |
before(:all) do | |
@rake = Rake::Application.new | |
Rake.application = @rake | |
Rake.application.rake_require "lib/tasks/cron/abe/upload_inventory" | |
Rake::Task.define_task(:environment) | |
end | |
after(:all) do | |
`ps -e -o pid,command | grep "[c]ron:abe:upload" | grep "[t]est" | awk '{print $1}' | xargs kill` | |
end | |
it "should run only 1 rake task at any given time" do | |
3.times { system("rake cron:abe:upload_inventory[1] RAILS_ENV=test") } | |
`ps -e -o pid,command | grep "[c]ron:abe:upload_inventory"`.split("\n").count.should eql 1 | |
end | |
it "should raise error if batch count is not specified" do | |
lambda { @rake.invoke_task("cron:abe:upload_inventory") }.should raise_error ArgumentError, "Batch count missing" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment