Skip to content

Commit

Permalink
Merge pull request livingsocial#50 from dudleyf/rake-task-spec
Browse files Browse the repository at this point in the history
Fix assets:precompile task (with a test, too!)
  • Loading branch information
wycats committed Feb 2, 2012
2 parents 0c8afe5 + a2042cf commit c0124fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rake-pipeline/precompile.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace :assets do
desc "Precompile assets using Rake::Pipeline"
task :precompile do
config = Rails.application.config.rake_pipeline_assetfile
Rake::Pipeline::Runner.new(config).invoke
Rake::Pipeline::Project.new(config).invoke
end
end

21 changes: 21 additions & 0 deletions spec/rake_tasks_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe "Rake tasks" do
before do
@rake = Rake::Application.new
Rake.application = @rake
end

describe "assets:precompile" do
before do
load File.expand_path("../../lib/rake-pipeline/precompile.rake", __FILE__)
Rails = double("Rails")
Rails.stub_chain(:application, :config, :rake_pipeline_assetfile).and_return("Assetfile")
end

it "creates and invokes a new Project" do
project = double("Project")
project.should_receive(:invoke)
Rake::Pipeline::Project.should_receive(:new).with("Assetfile").and_return(project)
@rake["assets:precompile"].invoke
end
end
end

0 comments on commit c0124fb

Please sign in to comment.