Permalink
Browse files

More cleanup

  • Loading branch information...
1 parent f1d82ed commit afb29cf91457b1dd45e425ccd54ea7b3acc87ca7 @gabebw gabebw committed Sep 9, 2011
Showing with 11 additions and 17 deletions.
  1. +11 −17 spec/kumade/deployer_spec.rb
View
28 spec/kumade/deployer_spec.rb
@@ -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
@@ -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")
@@ -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
@@ -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

0 comments on commit afb29cf

Please sign in to comment.