sass-embedded 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +1,53 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "test_helper"
3
+ require_relative 'test_helper'
4
4
 
5
5
  module Sass
6
6
  class OutputStyleTest < MiniTest::Test
7
-
8
7
  def setup
9
8
  @compiler = Embedded::Compiler.new
10
9
  end
11
10
 
12
11
  def teardown
12
+ @compiler.close
13
13
  end
14
14
 
15
15
  def input_scss
16
- input_scss = <<-CSS
17
- $color: #fff;
18
-
19
- #main {
20
- color: $color;
21
- background-color: #000;
22
- p {
23
- width: 10em;
24
- }
25
- }
26
-
27
- .huge {
28
- font-size: 10em;
29
- font-weight: bold;
30
- text-decoration: underline;
31
- }
32
- CSS
16
+ <<~CSS
17
+ $color: #fff;
18
+
19
+ #main {
20
+ color: $color;
21
+ background-color: #000;
22
+ p {
23
+ width: 10em;
24
+ }
25
+ }
26
+
27
+ .huge {
28
+ font-size: 10em;
29
+ font-weight: bold;
30
+ text-decoration: underline;
31
+ }
32
+ CSS
33
33
  end
34
34
 
35
35
  def expected_expanded_output
36
- <<-CSS.chomp
37
- #main {
38
- color: #fff;
39
- background-color: #000;
40
- }
41
- #main p {
42
- width: 10em;
43
- }
44
-
45
- .huge {
46
- font-size: 10em;
47
- font-weight: bold;
48
- text-decoration: underline;
49
- }
50
- CSS
36
+ <<~CSS.chomp
37
+ #main {
38
+ color: #fff;
39
+ background-color: #000;
40
+ }
41
+ #main p {
42
+ width: 10em;
43
+ }
44
+
45
+ .huge {
46
+ font-size: 10em;
47
+ font-weight: bold;
48
+ text-decoration: underline;
49
+ }
50
+ CSS
51
51
  end
52
52
 
53
53
  def test_expanded_output_is_default
@@ -61,32 +61,32 @@ CSS
61
61
  end
62
62
 
63
63
  def test_invalid_output_style
64
- assert_raises(InvalidStyleError) {
64
+ assert_raises(InvalidStyleError) do
65
65
  @compiler.render({ data: input_scss, output_style: :totally_wrong })[:css]
66
- }
66
+ end
67
67
  end
68
68
 
69
69
  def test_unsupported_output_style
70
- assert_raises(UnsupportedValue) {
70
+ assert_raises(UnsupportedValue) do
71
71
  @compiler.render({ data: input_scss, output_style: :nested })[:css]
72
- }
72
+ end
73
73
 
74
- assert_raises(UnsupportedValue) {
74
+ assert_raises(UnsupportedValue) do
75
75
  @compiler.render({ data: input_scss, output_style: :compact })[:css]
76
- }
76
+ end
77
77
  end
78
78
 
79
79
  def test_compressed_output
80
80
  output = @compiler.render({ data: input_scss, output_style: :compressed })[:css]
81
- assert_equal <<-CSS.chomp, output
82
- #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
81
+ assert_equal <<~CSS.chomp, output
82
+ #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
83
83
  CSS
84
84
  end
85
85
 
86
86
  def test_string_output_style_names
87
87
  output = @compiler.render({ data: input_scss, output_style: 'compressed' })[:css]
88
- assert_equal <<-CSS.chomp, output
89
- #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
88
+ assert_equal <<~CSS.chomp, output
89
+ #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
90
90
  CSS
91
91
  end
92
92
  end
data/test/sass_test.rb ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'test_helper'
4
+
5
+ module Sass
6
+ class SassTest < MiniTest::Test
7
+ def test_sass_works
8
+ assert_equal '', Sass.render({
9
+ data: ''
10
+ })[:css]
11
+
12
+ css = <<~CSS.chomp
13
+ h1 {
14
+ font-size: 2rem;
15
+ }
16
+ CSS
17
+ assert_equal css, Sass.render({
18
+ data: 'h1 { font-size: 2rem; }'
19
+ })[:css]
20
+ end
21
+ end
22
+ end
data/test/test_helper.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fileutils'
4
- require "minitest/autorun"
5
- require "minitest/pride"
6
- require "minitest/around/unit"
4
+ require 'minitest/autorun'
5
+ require 'minitest/pride'
6
+ require 'minitest/around/unit'
7
7
 
8
- require_relative "../lib/sass"
8
+ require_relative '../lib/sass'
9
9
 
10
10
  module TempFileTest
11
11
  def around
@@ -18,7 +18,7 @@ module TempFileTest
18
18
  end
19
19
 
20
20
  def temp_file(filename, contents)
21
- File.open(filename, "w",) do |file|
21
+ File.open(filename, 'w') do |file|
22
22
  file.write(contents)
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Use dart-sass with Ruby!
98
112
  email:
99
113
  - i@ntk.me
@@ -124,6 +138,7 @@ files:
124
138
  - test/error_test.rb
125
139
  - test/functions_test.rb
126
140
  - test/output_style_test.rb
141
+ - test/sass_test.rb
127
142
  - test/test_helper.rb
128
143
  homepage: https://github.com/ntkme/embedded-host-ruby
129
144
  licenses:
@@ -154,4 +169,5 @@ test_files:
154
169
  - test/error_test.rb
155
170
  - test/functions_test.rb
156
171
  - test/output_style_test.rb
172
+ - test/sass_test.rb
157
173
  - test/test_helper.rb