Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Sep 9, 2011
1 parent f1d82ed commit afb29cf
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions spec/kumade/deployer_spec.rb
Expand Up @@ -197,9 +197,7 @@
end

it "prints an error if packaging failed" do
Jammit.stub(:package!) do
raise Jammit::MissingConfiguration.new("random Jammit error")
end
Jammit.stub(:package!).and_raise(Jammit::MissingConfiguration.new("random Jammit error"))
subject.should_receive(:error).with("Error: Jammit::MissingConfiguration: random Jammit error")

subject.package_with_jammit
Expand Down Expand Up @@ -255,29 +253,25 @@
end

context "with no changed assets" do
before { subject.stub(:git => stub(:dirty? => false)) }

it "prints no message" do
subject.stub(:run).with("bundle exec rake more:generate")
subject.stub(:git => mock(:dirty? => false))
subject.should_not_receive(:say)

subject.package_with_more
end

it "does not call git_add_and_commit_all_more_assets" do
it "does not call git_add_and_commit_all_assets_in" do
subject.stub(:run).with("bundle exec rake more:generate")
subject.stub(:git => mock(:dirty? => false))
subject.should_not_receive(:git_add_and_commit_all_assets_in)

subject.package_with_more
end
end

it "prints an error if packaging failed" do
subject.stub(:run) do |arg|
if arg == "bundle exec rake more:generate"
raise "blerg"
end
end
subject.should_receive(:run).with("bundle exec rake more:generate").and_raise(RuntimeError.new("blerg"))

subject.should_receive(:error).with("Error: RuntimeError: blerg")

Expand All @@ -297,22 +291,26 @@
end

describe Kumade::Deployer, "#jammit_assets_path" do
let(:current_dir) { File.expand_path(Dir.pwd) }

it "returns the correct asset path" do
Jammit.stub(:package_path => 'blerg')
current_dir = File.expand_path(Dir.pwd)
subject.jammit_assets_path.should == File.join(current_dir, 'public', 'blerg')
end
end

describe Kumade::Deployer, "#more_assets_path" do
it "returns the correct asset path" do
before do
module ::Less
class More
def self.destination_path
'blerg'
end
end
end
end

it "returns the correct asset path" do
subject.more_assets_path.should == 'public/blerg'
end
end
Expand All @@ -321,10 +319,6 @@ def self.destination_path
it "returns true because it's loaded by the Gemfile" do
Kumade::Deployer.new.jammit_installed?.should be_true
end

it "returns false if jammit is not installed" do
Kumade::Deployer.new.jammit_installed?.should be_true
end
end

describe Kumade::Deployer, "#more_installed?" do
Expand Down

0 comments on commit afb29cf

Please sign in to comment.