spec/less/parser_spec.rb in less-2.0.10 vs spec/less/parser_spec.rb in less-2.0.11
- old
+ new
@@ -12,20 +12,30 @@
it "accepts options when assembling the parse tree" do
subject.parse(".class {width: 1+1}").to_css(:compress => true).strip.should eql ".class{width:2;}"
end
end
+
it "throws a ParseError if the lesscss is bogus" do
expect {subject.parse('{^)')}.should raise_error(Less::ParseError)
end
+ it "passes exceptions from the less compiler" do
+ expect {subject.parse('body { color: @a; }').to_css}.should raise_error(Less::ParseError, /variable @a is undefined/)
+ end
+
describe "when configured with multiple load paths" do
- before {@parser = Less::Parser.new :paths => [cwd.join('one'), cwd.join('two')]}
+ subject {Less::Parser.new :paths => [cwd.join('one'), cwd.join('two'), cwd.join('faulty')]}
it "will load files from both paths" do
- @parser.parse('@import "one.less";').to_css.gsub(/\n/,'').strip.should eql ".one { width: 1;}"
- @parser.parse('@import "two.less";').to_css.gsub(/\n/,'').strip.should eql ".two { width: 1;}"
+ subject.parse('@import "one.less";').to_css.gsub(/\n/,'').strip.should eql ".one { width: 1;}"
+ subject.parse('@import "two.less";').to_css.gsub(/\n/,'').strip.should eql ".two { width: 1;}"
end
+
+ it "passes exceptions from less imported less files" do
+ expect {subject.parse('@import "faulty.less";').to_css}.should raise_error(Less::ParseError, /variable @a is undefined/)
+ end
+
end
describe "when load paths are specified in as default options" do
before do
Less.paths << cwd.join('one')