Skip to content

Commit abedcfd

Browse files
committed
Fix warnings from the test suite.
1 parent 2890796 commit abedcfd

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

test/sass_rails_generators_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ScaffoldGeneratorTest < Sass::Rails::TestCase
66
generate_scaffold
77
assert_file_exists "app/assets/stylesheets/foos.scss"
88
assert_file_exists "app/assets/stylesheets/scaffolds.scss"
9-
assert_not_output /conflict/
9+
assert_not_output %r{conflict}
1010
end
1111
end
1212

@@ -15,7 +15,7 @@ class ScaffoldGeneratorTest < Sass::Rails::TestCase
1515
generate_scaffold
1616
assert_file_exists "app/assets/stylesheets/foos.sass"
1717
assert_file_exists "app/assets/stylesheets/scaffolds.sass"
18-
assert_not_output /conflict/
18+
assert_not_output %r{conflict}
1919
end
2020
end
2121

@@ -24,7 +24,7 @@ class ScaffoldGeneratorTest < Sass::Rails::TestCase
2424
generate_scaffold "--stylesheet-engine=scss"
2525
assert_file_exists "app/assets/stylesheets/engine_project/foos.scss"
2626
assert_file_exists "app/assets/stylesheets/scaffolds.scss"
27-
assert_not_output /conflict/
27+
assert_not_output %r{conflict}
2828
end
2929
end
3030

@@ -33,7 +33,7 @@ class ScaffoldGeneratorTest < Sass::Rails::TestCase
3333
generate_scaffold "--stylesheet-engine=sass"
3434
assert_file_exists "app/assets/stylesheets/engine_project/foos.sass"
3535
assert_file_exists "app/assets/stylesheets/scaffolds.sass"
36-
assert_not_output /conflict/
36+
assert_not_output %r{conflict}
3737
end
3838
end
3939

test/sass_rails_logger_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SassRailsLoggerTest < Sass::Rails::TestCase
1717
"Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, %Q|#{message}|)"
1818
end
1919

20-
assert File.exists?("#{app_root}/log/development.log"), "log file was not created"
20+
assert File.exist?("#{app_root}/log/development.log"), "log file was not created"
2121

2222
log_output = File.open("#{app_root}/log/development.log").read
2323
assert log_output.include?(message), "the #{level} log message was not found in the log file"

test/sass_rails_test.rb

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SassRailsTest < Sass::Rails::TestCase
1212
"puts Rails.application.config.sass.style"
1313
end
1414

15-
assert_output /compact/
15+
assert_output %r{compact}
1616
end
1717
end
1818

@@ -42,7 +42,7 @@ class SassRailsTest < Sass::Rails::TestCase
4242
"puts Rails.application.config.assets.css_compressor"
4343
end
4444

45-
assert_output /yui/
45+
assert_output %r{yui}
4646
end
4747
end
4848

@@ -52,7 +52,7 @@ class SassRailsTest < Sass::Rails::TestCase
5252
"puts Rails.application.config.sass.style"
5353
end
5454

55-
assert_output /expanded/
55+
assert_output %r{expanded}
5656
end
5757
end
5858

@@ -99,49 +99,49 @@ class SassRailsTest < Sass::Rails::TestCase
9999
test 'sprockets require works correctly' do
100100
within_rails_app('scss_project') do |app_root|
101101
css_output = asset_output('css_application.css')
102-
assert_match /globbed/, css_output
102+
assert_match %r{globbed}, css_output
103103

104-
if File.exists?("#{app_root}/log/development.log")
104+
if File.exist?("#{app_root}/log/development.log")
105105
log_file = "#{app_root}/log/development.log"
106-
elsif File.exists?("#{app_root}/log/test.log")
106+
elsif File.exist?("#{app_root}/log/test.log")
107107
log_file = "#{app_root}/log/test.log"
108108
else
109109
flunk "log file was not created"
110110
end
111111

112112
log_output = File.open(log_file).read
113-
refute_match /Warning/, log_output
113+
refute_match %r{Warning}, log_output
114114
end
115115
end
116116

117117
test 'sass imports work correctly' do
118118
css_output = sprockets_render('scss_project', 'application.css')
119-
assert_match /main/, css_output
120-
assert_match /top-level/, css_output
121-
assert_match /partial-sass/, css_output
122-
assert_match /partial-scss/, css_output
123-
assert_match /sub-folder-relative-sass/, css_output
124-
assert_match /sub-folder-relative-scss/, css_output
125-
assert_match /not-a-partial/, css_output
126-
assert_match /globbed/, css_output
127-
assert_match /nested-glob/, css_output
128-
assert_match /nested-glob-erb/, css_output
129-
assert_match /nested-glob-erb-css-scss/, css_output
130-
assert_match /plain-old-css/, css_output
131-
assert_match /another-plain-old-css/, css_output
132-
assert_match /without-css-ext/, css_output
133-
assert_match /css-erb-handler/, css_output
134-
assert_match /scss-erb-handler/, css_output
135-
assert_match /sass-erb-handler/, css_output
136-
assert_match /css-sass-erb-handler/, css_output
137-
assert_match /css-scss-erb-handler/, css_output
138-
assert_match /default-old-css/, css_output
119+
assert_match %r{main}, css_output
120+
assert_match %r{top-level}, css_output
121+
assert_match %r{partial-sass}, css_output
122+
assert_match %r{partial-scss}, css_output
123+
assert_match %r{sub-folder-relative-sass}, css_output
124+
assert_match %r{sub-folder-relative-scss}, css_output
125+
assert_match %r{not-a-partial}, css_output
126+
assert_match %r{globbed}, css_output
127+
assert_match %r{nested-glob}, css_output
128+
assert_match %r{nested-glob-erb}, css_output
129+
assert_match %r{nested-glob-erb-css-scss}, css_output
130+
assert_match %r{plain-old-css}, css_output
131+
assert_match %r{another-plain-old-css}, css_output
132+
assert_match %r{without-css-ext}, css_output
133+
assert_match %r{css-erb-handler}, css_output
134+
assert_match %r{scss-erb-handler}, css_output
135+
assert_match %r{sass-erb-handler}, css_output
136+
assert_match %r{css-sass-erb-handler}, css_output
137+
assert_match %r{css-scss-erb-handler}, css_output
138+
assert_match %r{default-old-css}, css_output
139139
end
140140

141141
test 'sprockets directives are ignored within an import' do
142142
css_output = sprockets_render('scss_project', 'import_css_application.css')
143-
assert_match /\.css-application/, css_output
144-
assert_match /\.import-css-application/, css_output
143+
assert_match %r{\.css-application}, css_output
144+
assert_match %r{\.import-css-application}, css_output
145145
end
146146

147147
test 'globbed imports work when new file is added' do
@@ -157,7 +157,7 @@ class SassRailsTest < Sass::Rails::TestCase
157157
end
158158

159159
css_output = asset_output(filename)
160-
assert_match /new-file-test/, css_output
160+
assert_match %r{new-file-test}, css_output
161161
end
162162
end
163163

@@ -174,7 +174,7 @@ class SassRailsTest < Sass::Rails::TestCase
174174
end
175175

176176
css_output = asset_output(filename)
177-
assert_match /changed-file-test/, css_output
177+
assert_match %r{changed-file-test}, css_output
178178
end
179179
end
180180

test/support/sass_rails_test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def asset_output(filename)
4949
end
5050

5151
def assert_file_exists(filename)
52-
assert File.exists?(filename), "could not find #{filename}. PWD=#{Dir.pwd}\nDid find: #{Dir.glob(File.dirname(filename)+"/*").join(", ")}"
52+
assert File.exist?(filename), "could not find #{filename}. PWD=#{Dir.pwd}\nDid find: #{Dir.glob(File.dirname(filename)+"/*").join(", ")}"
5353
end
5454

5555
def assert_not_output(match)

test/test_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if possible_dev_dependencies.include?(s.name)
1717
gem_path = s.full_gem_path
1818
gem_options = { version: s.version }
19-
gem_options[:path] = gem_path if File.exists?("#{gem_path}/#{s.name}.gemspec")
19+
gem_options[:path] = gem_path if File.exist?("#{gem_path}/#{s.name}.gemspec")
2020
$gem_options[s.name] = gem_options
2121
end
2222
end

0 commit comments

Comments
 (0)