spec/fontcustom/util_spec.rb in fontcustom-1.1.0.pre2 vs spec/fontcustom/util_spec.rb in fontcustom-1.1.0
- old
+ new
@@ -4,11 +4,11 @@
class Generator
include Fontcustom::Util
attr_accessor :cli_options
def initialize
- @cli_options = { :project_root => fixture, :verbose => true }
+ @cli_options = { :project_root => fixture, :quiet => false }
@shell = Thor::Shell::Color.new
end
end
context "#check_fontforge" do
@@ -25,24 +25,45 @@
gen = Generator.new
output = capture(:stdout) { gen.say_changed(:success, changed) }
output.should_not match(fixture)
end
- it "should not respond if :verbose is false" do
+ it "should not respond if :quiet is true " do
changed = %w|a b c|.map { |file| fixture(file) }
gen = Generator.new
- gen.cli_options[:verbose] = false
+ gen.cli_options[:quiet] = true
output = capture(:stdout) { gen.say_changed(:success, changed) }
output.should == ""
end
end
context "#say_message" do
- it "should not respond if :verbose is false" do
+ it "should not respond if :quiet is true" do
gen = Generator.new
- gen.cli_options[:verbose] = false
+ gen.cli_options[:quiet] = true
output = capture(:stdout) { gen.say_message(:test, "Hello") }
output.should == ""
+ end
+ end
+
+ context "#expand_path" do
+ it "should leave absolute paths alone" do
+ gen = Generator.new
+ path = gen.expand_path "/absolute/path"
+ path.should == "/absolute/path"
+ end
+
+ it "should prepend paths with :project_root" do
+ gen = Generator.new
+ path = gen.expand_path "generators"
+ path.should == fixture("generators")
+ end
+
+ it "should follow ../../ relative paths" do
+ gen = Generator.new
+ gen.cli_options[:project_root] = fixture("shared/vectors")
+ path = gen.expand_path "../../generators"
+ path.should == fixture("generators")
end
end
context "#relative_to_root" do
it "should trim project root from paths" do