2009-07-27 16:25:32 -07:00
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
describe "Builder" do
|
|
|
|
def project_file(*parts)
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), "..", *parts))
|
|
|
|
end
|
|
|
|
|
|
|
|
before :all do
|
|
|
|
@root_dir = project_file("spec", "fixtures", "sample")
|
|
|
|
end
|
|
|
|
|
2009-09-29 10:10:47 -07:00
|
|
|
before :each do
|
2009-07-27 16:25:32 -07:00
|
|
|
build_cmd = project_file("bin", "mm-build")
|
|
|
|
`cd #{@root_dir} && #{build_cmd}`
|
|
|
|
end
|
2009-09-29 10:10:47 -07:00
|
|
|
|
2009-07-27 16:25:32 -07:00
|
|
|
after :each do
|
|
|
|
FileUtils.rm_rf(File.join(@root_dir, "build"))
|
|
|
|
end
|
2009-07-28 09:39:06 -07:00
|
|
|
|
|
|
|
it "should build haml files" do
|
2009-07-27 16:25:32 -07:00
|
|
|
File.exists?("#{@root_dir}/build/index.html").should be_true
|
2009-07-28 11:06:45 -07:00
|
|
|
File.read("#{@root_dir}/build/index.html").should include("<h1>Welcome</h1>")
|
2009-07-27 16:25:32 -07:00
|
|
|
end
|
2009-07-28 09:39:06 -07:00
|
|
|
|
2009-10-08 11:53:37 -07:00
|
|
|
it "should build maruku files" do
|
2009-07-28 09:39:06 -07:00
|
|
|
File.exists?("#{@root_dir}/build/maruku.html").should be_true
|
2009-07-28 11:06:45 -07:00
|
|
|
File.read("#{@root_dir}/build/maruku.html").should include("<h1 class='header' id='hello_maruku'>Hello Maruku</h1>")
|
2009-07-28 09:39:06 -07:00
|
|
|
end
|
|
|
|
|
2009-07-27 16:25:32 -07:00
|
|
|
it "should build static files" do
|
|
|
|
File.exists?("#{@root_dir}/build/static.html").should be_true
|
2009-07-28 11:06:45 -07:00
|
|
|
File.read("#{@root_dir}/build/static.html").should include("Static, no code!")
|
2009-07-27 16:25:32 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should build subdirectory files" do
|
|
|
|
File.exists?("#{@root_dir}/build/services/index.html").should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should build sass files" do
|
|
|
|
File.exists?("#{@root_dir}/build/stylesheets/site.css").should be_true
|
2009-09-24 16:35:03 -07:00
|
|
|
File.read("#{@root_dir}/build/stylesheets/site.css").should include("html,body,div,span,applet,object,iframe")
|
2009-07-27 16:25:32 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should build static css files" do
|
|
|
|
File.exists?("#{@root_dir}/build/stylesheets/static.css").should be_true
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should not build partial files" do
|
|
|
|
File.exists?("#{@root_dir}/build/_partial.html").should be_false
|
|
|
|
end
|
2009-09-21 10:11:22 -07:00
|
|
|
|
|
|
|
it "should minify inline javascript" do
|
|
|
|
File.readlines("#{@root_dir}/build/inline-js.html").length.should == 9
|
|
|
|
end
|
2009-09-29 10:10:47 -07:00
|
|
|
|
|
|
|
it "should combine javascript" do
|
|
|
|
File.read("#{@root_dir}/build/javascripts/empty-with-include.js").should include("combo")
|
|
|
|
end
|
2009-07-27 16:25:32 -07:00
|
|
|
end
|