Created
July 13, 2011 16:13
-
-
Save gabebw/1080650 to your computer and use it in GitHub Desktop.
Test Rake task
This file contains hidden or 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 'spec_helper' | |
describe "Rake tasks" do | |
def fake_rake_application | |
app = Rake::Application.new | |
Rake.application = app | |
Rake::Task.define_task('environment'){} | |
app | |
end | |
before(:all) do | |
@rake = fake_rake_application | |
tasks = Dir[Rails.root.join('lib', 'tasks', '**', '*')] | |
tasks.each{|t| load t } | |
end | |
after(:all) do | |
Rake.application = nil | |
end | |
context "the backup task" do | |
it "runs when :cron is run" do | |
HerokuBackupTask.should_receive(:execute).once | |
@rake['cron'].invoke | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment