Skip to content

Commit

Permalink
Fix tests for less 1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej committed Feb 28, 2013
1 parent f50c28b commit 4e72e0c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/less/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Less
module Defaults

def defaults
@defaults ||= { :paths => [] }
@defaults ||= { :paths => [], :relativeUrls => true }
end

def paths
Expand Down
2 changes: 1 addition & 1 deletion lib/less/java_script/rhino_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def handle_js_error(e)
if e.value && ( e.value['message'] || e.value['type'].is_a?(String) )
raise Less::ParseError.new(e, e.value) # LessError
end
if e.unwrap.to_s == "missing closing `}`"
if e.unwrap.to_s =~ /missing closing `}`/
raise Less::ParseError.new(e.unwrap.to_s)
end
if e.message && e.message[0, 12] == "Syntax Error"
Expand Down
2 changes: 1 addition & 1 deletion lib/less/java_script/v8_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def lock(&block)
# }, env);
#
# comes back as value: RuntimeError !
elsif e.value.to_s == "missing closing `}`"
elsif e.value.to_s =~ /missing closing `}`/
raise Less::ParseError.new(e.value.to_s)
end
raise Less::Error.new(e)
Expand Down
3 changes: 2 additions & 1 deletion lib/less/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def require(module_id)

class Path
def join(*components)
File.join(*components)
# node.js expands path on join
File.expand_path(File.join(*components))
end

def dirname(path)
Expand Down
5 changes: 3 additions & 2 deletions spec/less/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
it "will track imported files" do
subject.parse('@import "one.less";')
subject.parse('@import "two.less";')
subject.imports.should include("one.less")
subject.imports.should include("two.less")
# Parser#imports returns full path names
subject.imports.grep(/one\.less$/).should_not be_empty
subject.imports.grep(/two\.less$/).should_not be_empty
end

it "reports type, line, column and filename of (parse) error" do
Expand Down

0 comments on commit 4e72e0c

Please sign in to comment.