Skip to content

Commit

Permalink
[Spec] fix test for stylus
Browse files Browse the repository at this point in the history
  • Loading branch information
samnung committed Sep 18, 2018
1 parent d5d2ccf commit f3f0ad8
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions spec/unit/compiler/file/stylus_file_spec.rb
Expand Up @@ -60,41 +60,40 @@ module FileTypes
end

it 'allows to use constants inside stylus files' do
source = %q(
__abc = {
hej: "hou"
}
a
// value: __const.some_value
value: __abc.hej
)

source = <<~STYLUS
__abc = {
hej: "hou"
}
a
// value: __const.some_value
value: __abc.hej
value2: __const.some_value
STYLUS

File.write('/tmp/epuber_stylus_tests/some_file.styl', source)

file = StylusFile.new('/tmp/epuber_stylus_tests/some_file.styl')
file.destination_path = 'some_file.css'
file.destination_path = '/tmp/epuber_stylus_tests/some_file.css'
file.compilation_context = ctx
resolve_file_paths(file)

ctx.book.default_target.add_const 'some_value' => 'abc'

file.process(ctx)

expected = <<~CSS
a {
value: "hou";
value2: "abc";
}
CSS

puts File.read(file.final_destination_path)

expect(File.read(file.final_destination_path)).to eq expected
end
end



end



end
end
end

0 comments on commit f3f0ad8

Please sign in to comment.