commit
						a5db408d5c
					
				|  | @ -118,7 +118,7 @@ Style/RedundantReturn: | |||
| Style/RedundantSelf: | ||||
|   Enabled: false | ||||
| Style/RegexpLiteral: | ||||
|   EnforcedStyle: slashes | ||||
|   EnforcedStyle: percent_r | ||||
| Style/RescueModifier: | ||||
|   Enabled: false | ||||
| Style/SignalException: | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have a blank site in "(.*)"$/) do |path| | ||||
| Given(%r!^I have a blank site in "(.*)"$!) do |path| | ||||
|   unless File.exist?(path) | ||||
|     then FileUtils.mkdir_p(path) | ||||
|   end | ||||
|  | @ -22,13 +22,13 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I do not have a "(.*)" directory$/) do |path| | ||||
| Given(%r!^I do not have a "(.*)" directory$!) do |path| | ||||
|   Paths.test_dir.join(path).directory? | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/) do |file, key, value, text| | ||||
| Given(%r!^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$!) do |file, key, value, text| | ||||
|   File.write(file, Jekyll::Utils.strip_heredoc(<<-DATA)) | ||||
|     --- | ||||
|     #{key || "layout"}: #{value || "nil"} | ||||
|  | @ -40,13 +40,13 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have an? "(.*)" file that contains "(.*)"$/) do |file, text| | ||||
| Given(%r!^I have an? "(.*)" file that contains "(.*)"$!) do |file, text| | ||||
|   File.write(file, text) | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have an? (.*) (layout|theme) that contains "(.*)"$/) do |name, type, text| | ||||
| Given(%r!^I have an? (.*) (layout|theme) that contains "(.*)"$!) do |name, type, text| | ||||
|   folder = type == "layout" ? "_layouts" : "_theme" | ||||
| 
 | ||||
|   destination_file = Pathname.new(File.join(folder, "#{name}.html")) | ||||
|  | @ -56,13 +56,13 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have an? "(.*)" file with content:$/) do |file, text| | ||||
| Given(%r!^I have an? "(.*)" file with content:$!) do |file, text| | ||||
|   File.write(file, text) | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have an? (.*) directory$/) do |dir| | ||||
| Given(%r!^I have an? (.*) directory$!) do |dir| | ||||
|   unless File.directory?(dir) | ||||
|     then FileUtils.mkdir_p(dir) | ||||
|   end | ||||
|  | @ -70,7 +70,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have the following (draft|page|post)s?(?: (in|under) "([^"]+)")?:$/) do |status, direction, folder, table| | ||||
| Given(%r!^I have the following (draft|page|post)s?(?: (in|under) "([^"]+)")?:$!) do |status, direction, folder, table| | ||||
|   table.hashes.each do |input_hash| | ||||
|     title = slug(input_hash["title"]) | ||||
|     ext = input_hash["type"] || "markdown" | ||||
|  | @ -92,7 +92,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have a configuration file with "(.*)" set to "(.*)"$/) do |key, value| | ||||
| Given(%r!^I have a configuration file with "(.*)" set to "(.*)"$!) do |key, value| | ||||
|   config = \ | ||||
|     if source_dir.join("_config.yml").exist? | ||||
|       SafeYAML.load_file(source_dir.join("_config.yml")) | ||||
|  | @ -105,7 +105,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have a configuration file with:$/) do |table| | ||||
| Given(%r!^I have a configuration file with:$!) do |table| | ||||
|   table.hashes.each do |row| | ||||
|     step %(I have a configuration file with "#{row["key"]}" set to "#{row["value"]}") | ||||
|   end | ||||
|  | @ -113,7 +113,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have a configuration file with "([^\"]*)" set to:$/) do |key, table| | ||||
| Given(%r!^I have a configuration file with "([^\"]*)" set to:$!) do |key, table| | ||||
|   File.open("_config.yml", "w") do |f| | ||||
|     f.write("#{key}:\n") | ||||
|     table.hashes.each do |row| | ||||
|  | @ -124,20 +124,20 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I have fixture collections$/) do | ||||
| Given(%r!^I have fixture collections$!) do | ||||
|   FileUtils.cp_r Paths.source_dir.join("test", "source", "_methods"), source_dir | ||||
|   FileUtils.cp_r Paths.source_dir.join("test", "source", "_thanksgiving"), source_dir | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Given(/^I wait (\d+) second(s?)$/) do |time, _| | ||||
| Given(%r!^I wait (\d+) second(s?)$!) do |time, _| | ||||
|   sleep(time.to_f) | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| When(/^I run jekyll(.*)$/) do |args| | ||||
| When(%r!^I run jekyll(.*)$!) do |args| | ||||
|   run_jekyll(args) | ||||
|   if args.include?("--verbose") || ENV["DEBUG"] | ||||
|     $stderr.puts "\n#{jekyll_run_output}\n" | ||||
|  | @ -146,7 +146,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| When(/^I run bundle(.*)$/) do |args| | ||||
| When(%r!^I run bundle(.*)$!) do |args| | ||||
|   run_bundle(args) | ||||
|   if args.include?("--verbose") || ENV["DEBUG"] | ||||
|     $stderr.puts "\n#{jekyll_run_output}\n" | ||||
|  | @ -155,7 +155,7 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| When(/^I change "(.*)" to contain "(.*)"$/) do |file, text| | ||||
| When(%r!^I change "(.*)" to contain "(.*)"$!) do |file, text| | ||||
|   File.open(file, "a") do |f| | ||||
|     f.write(text) | ||||
|   end | ||||
|  | @ -163,13 +163,13 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| When(/^I delete the file "(.*)"$/) do |file| | ||||
| When(%r!^I delete the file "(.*)"$!) do |file| | ||||
|   File.delete(file) | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^the (.*) directory should +(not )?exist$/) do |dir, negative| | ||||
| Then(%r!^the (.*) directory should +(not )?exist$!) do |dir, negative| | ||||
|   if negative.nil? | ||||
|     expect(Pathname.new(dir)).to exist | ||||
|   else | ||||
|  | @ -178,7 +178,7 @@ Then(/^the (.*) directory should +(not )?exist$/) do |dir, negative| | |||
| end | ||||
| 
 | ||||
| # | ||||
| Then(/^I should (not )?see "(.*)" in "(.*)"$/) do |negative, text, file| | ||||
| Then(%r!^I should (not )?see "(.*)" in "(.*)"$!) do |negative, text, file| | ||||
|   step %(the "#{file}" file should exist) | ||||
|   regexp = Regexp.new(text, Regexp::MULTILINE) | ||||
|   if negative.nil? || negative.empty? | ||||
|  | @ -190,20 +190,20 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should see exactly "(.*)" in "(.*)"$/) do |text, file| | ||||
| Then(%r!^I should see exactly "(.*)" in "(.*)"$!) do |text, file| | ||||
|   step %(the "#{file}" file should exist) | ||||
|   expect(file_contents(file).strip).to eq text | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should see escaped "(.*)" in "(.*)"$/) do |text, file| | ||||
| Then(%r!^I should see escaped "(.*)" in "(.*)"$!) do |text, file| | ||||
|   step %(I should see "#{Regexp.escape(text)}" in "#{file}") | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^the "(.*)" file should +(not )?exist$/) do |file, negative| | ||||
| Then(%r!^the "(.*)" file should +(not )?exist$!) do |file, negative| | ||||
|   if negative.nil? | ||||
|     expect(Pathname.new(file)).to exist | ||||
|   else | ||||
|  | @ -213,19 +213,19 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should see today's time in "(.*)"$/) do |file| | ||||
| Then(%r!^I should see today's time in "(.*)"$!) do |file| | ||||
|   step %(I should see "#{seconds_agnostic_time(Time.now)}" in "#{file}") | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should see today's date in "(.*)"$/) do |file| | ||||
| Then(%r!^I should see today's date in "(.*)"$!) do |file| | ||||
|   step %(I should see "#{Date.today}" in "#{file}") | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should (not )?see "(.*)" in the build output$/) do |negative, text| | ||||
| Then(%r!^I should (not )?see "(.*)" in the build output$!) do |negative, text| | ||||
|   if negative.nil? || negative.empty? | ||||
|     expect(jekyll_run_output).to match Regexp.new(text) | ||||
|   else | ||||
|  | @ -235,12 +235,12 @@ end | |||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should get a zero exit(?:\-| )status$/) do | ||||
| Then(%r!^I should get a zero exit(?:\-| )status$!) do | ||||
|   step %(I should see "EXIT STATUS: 0" in the build output) | ||||
| end | ||||
| 
 | ||||
| # | ||||
| 
 | ||||
| Then(/^I should get a non-zero exit(?:\-| )status$/) do | ||||
| Then(%r!^I should get a non-zero exit(?:\-| )status$!) do | ||||
|   step %(I should not see "EXIT STATUS: 0" in the build output) | ||||
| end | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ def file_content_from_hash(input_hash) | |||
|   Jekyll::Utils.strip_heredoc(<<-EOF) | ||||
|     --- | ||||
|     #{matter.gsub( | ||||
|       /\n/, "\n    " | ||||
|       %r!\n!, "\n    " | ||||
|     )} | ||||
|     --- | ||||
|     #{content} | ||||
|  | @ -121,7 +121,7 @@ end | |||
| def slug(title = nil) | ||||
|   if !title | ||||
|     then Time.now.strftime("%s%9N") # nanoseconds since the Epoch | ||||
|   else title.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, "-") | ||||
|   else title.downcase.gsub(%r![^\w]!, " ").strip.gsub(%r!\s+!, "-") | ||||
|   end | ||||
| end | ||||
| 
 | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ module Jekyll | |||
|         def fsnotify_buggy?(_site) | ||||
|           return true unless Utils::Platforms.osx? | ||||
|           if Dir.pwd != `pwd`.strip | ||||
|             Jekyll.logger.error "  " + <<-STR.strip.gsub(/\n\s+/, "\n  ") | ||||
|             Jekyll.logger.error "  " + <<-STR.strip.gsub(%r!\n\s+!, "\n  ") | ||||
|               We have detected that there might be trouble using fsevent on your | ||||
|               operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug) | ||||
|               for possible work arounds or you can work around it immediately | ||||
|  |  | |||
|  | @ -37,10 +37,10 @@ module Jekyll | |||
| 
 | ||||
|         private | ||||
|         def validate_and_ensure_charset(_req, res) | ||||
|           key = res.header.keys.grep(/content-type/i).first | ||||
|           key = res.header.keys.grep(%r!content-type!i).first | ||||
|           typ = res.header[key] | ||||
| 
 | ||||
|           unless typ =~ /;\s*charset=/ | ||||
|           unless typ =~ %r!;\s*charset=! | ||||
|             res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}" | ||||
|           end | ||||
|         end | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ module Jekyll | |||
| 
 | ||||
|       private | ||||
|       def custom_class_allowed?(parser_name) | ||||
|         parser_name !~ /[^A-Za-z0-9_]/ && self.class.constants.include?( | ||||
|         parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?( | ||||
|           parser_name.to_sym | ||||
|         ) | ||||
|       end | ||||
|  |  | |||
|  | @ -86,7 +86,7 @@ module Jekyll | |||
|         private | ||||
|         def strip_coderay_prefix(hash) | ||||
|           hash.each_with_object({}) do |(key, val), hsh| | ||||
|             cleaned_key = key.gsub(/\Acoderay_/, "") | ||||
|             cleaned_key = key.gsub(%r!\Acoderay_!, "") | ||||
| 
 | ||||
|             if key != cleaned_key | ||||
|               Jekyll::Deprecator.deprecation_message( | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ class Jekyll::Converters::Markdown::RedcarpetParser | |||
|     def add_code_tags(code, lang) | ||||
|       code = code.to_s | ||||
|       code = code.sub( | ||||
|         /<pre>/, | ||||
|         %r!<pre>!, | ||||
|         "<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">" | ||||
|       ) | ||||
|       code = code.sub(%r!</pre>!, "</code></pre>") | ||||
|  |  | |||
|  | @ -117,7 +117,7 @@ module Jekyll | |||
|       if tail.empty? | ||||
|         head | ||||
|       else | ||||
|         "" << head << "\n\n" << tail.scan(/^\[[^\]]+\]:.+$/).join("\n") | ||||
|         "" << head << "\n\n" << tail.scan(%r!^\[[^\]]+\]:.+$!).join("\n") | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|  |  | |||
|  | @ -98,7 +98,7 @@ module Jekyll | |||
|     # | ||||
|     # Returns the formatted message | ||||
|     def message(topic, message) | ||||
|       msg = formatted_topic(topic) + message.to_s.gsub(/\s+/, " ") | ||||
|       msg = formatted_topic(topic) + message.to_s.gsub(%r!\s+!, " ") | ||||
|       messages << msg | ||||
|       msg | ||||
|     end | ||||
|  |  | |||
|  | @ -62,9 +62,9 @@ module Jekyll | |||
|     end | ||||
| 
 | ||||
|     def sanitize_filename(name) | ||||
|       name.gsub!(/[^\w\s-]+/, "") | ||||
|       name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2') | ||||
|       name.gsub(/\s+/, "_") | ||||
|       name.gsub!(%r![^\w\s-]+!, "") | ||||
|       name.gsub!(%r!(^|\b\s)\s+($|\s?\b)!, '\\1\\2') | ||||
|       name.gsub(%r!\s+!, "_") | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ module Jekyll | |||
|       # forms: name, name=value, or name="<quoted list>" | ||||
|       # | ||||
|       # <quoted list> is a space-separated list of numbers | ||||
|       SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$/ | ||||
|       SYNTAX = %r!^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$! | ||||
| 
 | ||||
|       def initialize(tag_name, markup, tokens) | ||||
|         super | ||||
|  | @ -29,7 +29,7 @@ eos | |||
|       def render(context) | ||||
|         prefix = context["highlighter_prefix"] || "" | ||||
|         suffix = context["highlighter_suffix"] || "" | ||||
|         code = super.to_s.gsub(/\A(\n|\r)+|(\n|\r)+\z/, "") | ||||
|         code = super.to_s.gsub(%r!\A(\n|\r)+|(\n|\r)+\z!, "") | ||||
| 
 | ||||
|         is_safe = !!context.registers[:site].safe | ||||
| 
 | ||||
|  | @ -67,7 +67,7 @@ eos | |||
|         options = {} | ||||
|         unless input.empty? | ||||
|           # Split along 3 possible forms -- key="<quoted list>", key=value, or key | ||||
|           input.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt| | ||||
|           input.scan(%r!(?:\w="[^"]*"|\w=\w|\w)+!) do |opt| | ||||
|             key, value = opt.split("=") | ||||
|             # If a quoted list, convert to array | ||||
|             if value && value.include?("\"") | ||||
|  |  | |||
|  | @ -12,14 +12,14 @@ module Jekyll | |||
|     end | ||||
| 
 | ||||
|     class IncludeTag < Liquid::Tag | ||||
|       VALID_SYNTAX = / | ||||
|       VALID_SYNTAX = %r! | ||||
|         ([\w-]+)\s*=\s* | ||||
|         (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+)) | ||||
|       /x | ||||
|       VARIABLE_SYNTAX = / | ||||
|       !x | ||||
|       VARIABLE_SYNTAX = %r! | ||||
|         (?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+) | ||||
|         (?<params>.*) | ||||
|       /x | ||||
|       !x | ||||
| 
 | ||||
|       def initialize(tag_name, markup, tokens) | ||||
|         super | ||||
|  | @ -28,7 +28,7 @@ module Jekyll | |||
|           @file = matched["variable"].strip | ||||
|           @params = matched["params"].strip | ||||
|         else | ||||
|           @file, @params = markup.strip.split(/\s+/, 2) | ||||
|           @file, @params = markup.strip.split(%r!\s+!, 2) | ||||
|         end | ||||
|         validate_params if @params | ||||
|         @tag_name = tag_name | ||||
|  | @ -46,9 +46,9 @@ module Jekyll | |||
|           markup = markup[match.end(0)..-1] | ||||
| 
 | ||||
|           value = if match[2] | ||||
|                     match[2].gsub(/\\"/, '"') | ||||
|                     match[2].gsub(%r!\\"!, '"') | ||||
|                   elsif match[3] | ||||
|                     match[3].gsub(/\\'/, "'") | ||||
|                     match[3].gsub(%r!\\'!, "'") | ||||
|                   elsif match[4] | ||||
|                     context[match[4]] | ||||
|                   end | ||||
|  | @ -74,7 +74,7 @@ eos | |||
|       end | ||||
| 
 | ||||
|       def validate_params | ||||
|         full_valid_syntax = /\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z/ | ||||
|         full_valid_syntax = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z! | ||||
|         unless @params =~ full_valid_syntax | ||||
|           raise ArgumentError, <<-eos | ||||
| Invalid syntax for include tag: | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ module Jekyll | |||
|             "'#{name}' does not contain valid date and/or title." | ||||
|         end | ||||
| 
 | ||||
|         @name_regex = /^#{path}#{date}-#{slug}\.[^.]+/ | ||||
|         @name_regex = %r!^#{path}#{date}-#{slug}\.[^.]+! | ||||
|       end | ||||
| 
 | ||||
|       def post_date | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ class Jekyll::ThemeBuilder | |||
|   attr_reader :name, :path | ||||
| 
 | ||||
|   def initialize(theme_name) | ||||
|     @name = theme_name.to_s.tr(" ", "_").gsub(/_+/, "_") | ||||
|     @name = theme_name.to_s.tr(" ", "_").gsub(%r!_+!, "_") | ||||
|     @path = Pathname.new(File.expand_path(name, Dir.pwd)) | ||||
|   end | ||||
| 
 | ||||
|  |  | |||
|  | @ -72,13 +72,13 @@ module Jekyll | |||
|           # Remove leading "/" to avoid generating urls with `//` | ||||
|           result.gsub(%r!/:#{token.first}!, "") | ||||
|         else | ||||
|           result.gsub(/:#{token.first}/, self.class.escape_path(token.last)) | ||||
|           result.gsub(%r!:#{token.first}!, self.class.escape_path(token.last)) | ||||
|         end | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     def generate_url_from_drop(template) | ||||
|       template.gsub(/:([a-z_]+)/) do |match| | ||||
|       template.gsub(%r!:([a-z_]+)!) do |match| | ||||
|         replacement = @placeholders.public_send(match.sub(":".freeze, "".freeze)) | ||||
|         if replacement.nil? | ||||
|           "".freeze | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ module Jekyll | |||
|       extend self | ||||
| 
 | ||||
|       ESCAPE = format("%c", 27) | ||||
|       MATCH = /#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix | ||||
|       MATCH = %r!#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m!ix | ||||
|       COLORS = { | ||||
|         :red     => 31, | ||||
|         :green   => 32, | ||||
|  |  | |||
|  | @ -17,8 +17,8 @@ module Jekyll | |||
|       # platforms. This is mostly useful for `jekyll doctor` and for testing | ||||
|       # where we kick off certain tests based on the platform. | ||||
| 
 | ||||
|       { :windows? => /mswin|mingw|cygwin/, :linux? => /linux/, \ | ||||
|           :osx? => /darwin|mac os/, :unix? => /solaris|bsd/ }.each do |k, v| | ||||
|       { :windows? => %r!mswin|mingw|cygwin!, :linux? => %r!linux!, \ | ||||
|           :osx? => %r!darwin|mac os!, :unix? => %r!solaris|bsd! }.each do |k, v| | ||||
|         define_method k do | ||||
|           !!( | ||||
|             RbConfig::CONFIG["host_os"] =~ v | ||||
|  |  | |||
|  | @ -29,8 +29,8 @@ class TestConvertible < JekyllUnitTest | |||
|         ret = @convertible.read_yaml(@base, name) | ||||
|         assert_equal({}, ret) | ||||
|       end | ||||
|       assert_match(/YAML Exception|syntax error|Error reading file/, out) | ||||
|       assert_match(/#{File.join(@base, name)}/, out) | ||||
|       assert_match(%r!YAML Exception|syntax error|Error reading file!, out) | ||||
|       assert_match(%r!#{File.join(@base, name)}!, out) | ||||
|     end | ||||
| 
 | ||||
|     should "not allow ruby objects in yaml" do | ||||
|  | @ -46,8 +46,8 @@ class TestConvertible < JekyllUnitTest | |||
|         ret = @convertible.read_yaml(@base, name, :encoding => "utf-8") | ||||
|         assert_equal({}, ret) | ||||
|       end | ||||
|       assert_match(/invalid byte sequence in UTF-8/, out) | ||||
|       assert_match(/#{File.join(@base, name)}/, out) | ||||
|       assert_match(%r!invalid byte sequence in UTF-8!, out) | ||||
|       assert_match(%r!#{File.join(@base, name)}!, out) | ||||
|     end | ||||
| 
 | ||||
|     should "parse the front-matter but show an error if permalink is empty" do | ||||
|  | @ -61,7 +61,7 @@ class TestConvertible < JekyllUnitTest | |||
|       out = capture_stderr do | ||||
|         @convertible.read_yaml(@base, "front_matter.erb") | ||||
|       end | ||||
|       refute_match(/Invalid permalink/, out) | ||||
|       refute_match(%r!Invalid permalink!, out) | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ class TestEntryFilter < JekyllUnitTest | |||
|     should "allow regexp filtering" do | ||||
|       files = %w(README.md) | ||||
|       @site.exclude = [ | ||||
|         /README/ | ||||
|         %r!README! | ||||
|       ] | ||||
| 
 | ||||
|       assert_empty @site.reader.filter_entries( | ||||
|  |  | |||
|  | @ -14,8 +14,8 @@ class TestLiquidRenderer < JekyllUnitTest | |||
| 
 | ||||
|       # rubocop:disable Metrics/LineLength | ||||
|       expected = [ | ||||
|         /^Filename\s+|\s+Count\s+|\s+Bytes\s+|\s+Time$/, | ||||
|         /^-+\++-+\++-+\++-+$/, | ||||
|         %r!^Filename\s+|\s+Count\s+|\s+Bytes\s+|\s+Time$!, | ||||
|         %r!^-+\++-+\++-+\++-+$!, | ||||
|         %r!^_posts/2010-01-09-date-override\.markdown\s+|\s+\d+\s+|\s+\d+\.\d{2}K\s+|\s+\d+\.\d{3}$! | ||||
|       ] | ||||
|       # rubocop:enable Metrics/LineLength | ||||
|  |  | |||
|  | @ -34,8 +34,8 @@ class TestNewCommand < JekyllUnitTest | |||
|       refute_exist @full_path | ||||
|       capture_stdout { Jekyll::Commands::New.process(@args) } | ||||
|       assert_exist gemfile | ||||
|       assert_match(/gem "jekyll", "#{Jekyll::VERSION}"/, File.read(gemfile)) | ||||
|       assert_match(/gem "github-pages"/, File.read(gemfile)) | ||||
|       assert_match(%r!gem "jekyll", "#{Jekyll::VERSION}"!, File.read(gemfile)) | ||||
|       assert_match(%r!gem "github-pages"!, File.read(gemfile)) | ||||
|     end | ||||
| 
 | ||||
|     should "display a success message" do | ||||
|  | @ -91,7 +91,7 @@ class TestNewCommand < JekyllUnitTest | |||
|     should "force created folder" do | ||||
|       capture_stdout { Jekyll::Commands::New.process(@args) } | ||||
|       output = capture_stdout { Jekyll::Commands::New.process(@args, "--force") } | ||||
|       assert_match(/New jekyll site installed in/, output) | ||||
|       assert_match(%r!New jekyll site installed in!, output) | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|  |  | |||
|  | @ -313,7 +313,7 @@ class TestPage < JekyllUnitTest | |||
|         page.write(dest_dir) | ||||
| 
 | ||||
|         assert_equal "/sitemap.xml", page.url | ||||
|         assert_nil page.url[/\.html$/] | ||||
|         assert_nil page.url[%r!\.html$!] | ||||
|         assert File.directory?(dest_dir) | ||||
|         assert_exist dest_dir("sitemap.xml") | ||||
|       end | ||||
|  |  | |||
|  | @ -177,7 +177,7 @@ CONTENT | |||
|       end | ||||
| 
 | ||||
|       should "not cause a markdown error" do | ||||
|         refute_match(/markdown\-html\-error/, @result) | ||||
|         refute_match(%r!markdown\-html\-error!, @result) | ||||
|       end | ||||
| 
 | ||||
|       should "render markdown with pygments" do | ||||
|  | @ -544,7 +544,7 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "not cause an error" do | ||||
|       refute_match(/markdown\-html\-error/, @result) | ||||
|       refute_match(%r!markdown\-html\-error!, @result) | ||||
|     end | ||||
| 
 | ||||
|     should "have the url to the \"complex\" post from 2008-11-21" do | ||||
|  | @ -573,7 +573,7 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "not cause an error" do | ||||
|       refute_match(/markdown\-html\-error/, @result) | ||||
|       refute_match(%r!markdown\-html\-error!, @result) | ||||
|     end | ||||
| 
 | ||||
|     should "have the url to the \"complex\" post from 2008-11-21" do | ||||
|  | @ -645,7 +645,7 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "not cause an error" do | ||||
|       refute_match(/markdown\-html\-error/, @result) | ||||
|       refute_match(%r!markdown\-html\-error!, @result) | ||||
|     end | ||||
| 
 | ||||
|     should "have the url to the \"yaml_with_dots\" item" do | ||||
|  | @ -672,7 +672,7 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "not cause an error" do | ||||
|       refute_match(/markdown\-html\-error/, @result) | ||||
|       refute_match(%r!markdown\-html\-error!, @result) | ||||
|     end | ||||
| 
 | ||||
|     should "have the url to the \"sanitized_path\" item" do | ||||
|  | @ -727,7 +727,7 @@ CONTENT | |||
|           }) | ||||
|         end | ||||
|         @result ||= "" | ||||
|         refute_match(/SYMLINK TEST/, @result) | ||||
|         refute_match(%r!SYMLINK TEST!, @result) | ||||
|       end | ||||
| 
 | ||||
|       should "not expose the existence of symlinked files" do | ||||
|  | @ -954,15 +954,15 @@ CONTENT | |||
|       end | ||||
| 
 | ||||
|       should "include file as variable with liquid filters" do | ||||
|         assert_match(/1 included/, @content) | ||||
|         assert_match(/2 included/, @content) | ||||
|         assert_match(/3 included/, @content) | ||||
|         assert_match(%r!1 included!, @content) | ||||
|         assert_match(%r!2 included!, @content) | ||||
|         assert_match(%r!3 included!, @content) | ||||
|       end | ||||
| 
 | ||||
|       should "include file as variable and liquid filters with arbitrary whitespace" do | ||||
|         assert_match(/4 included/, @content) | ||||
|         assert_match(/5 included/, @content) | ||||
|         assert_match(/6 included/, @content) | ||||
|         assert_match(%r!4 included!, @content) | ||||
|         assert_match(%r!5 included!, @content) | ||||
|         assert_match(%r!6 included!, @content) | ||||
|       end | ||||
| 
 | ||||
|       should "include file as variable and filters with additional parameters" do | ||||
|  | @ -971,7 +971,7 @@ CONTENT | |||
|       end | ||||
| 
 | ||||
|       should "include file as partial variable" do | ||||
|         assert_match(/8 included/, @content) | ||||
|         assert_match(%r!8 included!, @content) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|  | @ -986,15 +986,15 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "include file as variable with liquid filters" do | ||||
|       assert_match(/1 relative_include/, @content) | ||||
|       assert_match(/2 relative_include/, @content) | ||||
|       assert_match(/3 relative_include/, @content) | ||||
|       assert_match(%r!1 relative_include!, @content) | ||||
|       assert_match(%r!2 relative_include!, @content) | ||||
|       assert_match(%r!3 relative_include!, @content) | ||||
|     end | ||||
| 
 | ||||
|     should "include file as variable and liquid filters with arbitrary whitespace" do | ||||
|       assert_match(/4 relative_include/, @content) | ||||
|       assert_match(/5 relative_include/, @content) | ||||
|       assert_match(/6 relative_include/, @content) | ||||
|       assert_match(%r!4 relative_include!, @content) | ||||
|       assert_match(%r!5 relative_include!, @content) | ||||
|       assert_match(%r!6 relative_include!, @content) | ||||
|     end | ||||
| 
 | ||||
|     should "include file as variable and filters with additional parameters" do | ||||
|  | @ -1003,11 +1003,11 @@ CONTENT | |||
|     end | ||||
| 
 | ||||
|     should "include file as partial variable" do | ||||
|       assert_match(/8 relative_include/, @content) | ||||
|       assert_match(%r!8 relative_include!, @content) | ||||
|     end | ||||
| 
 | ||||
|     should "include files relative to self" do | ||||
|       assert_match(/9 —\ntitle: Test Post Where YAML/, @content) | ||||
|       assert_match(%r!9 —\ntitle: Test Post Where YAML!, @content) | ||||
|     end | ||||
| 
 | ||||
|     context "trying to do bad stuff" do | ||||
|  | @ -1087,7 +1087,7 @@ CONTENT | |||
|           }) | ||||
|         end | ||||
|         @result ||= "" | ||||
|         refute_match(/SYMLINK TEST/, @result) | ||||
|         refute_match(%r!SYMLINK TEST!, @result) | ||||
|       end | ||||
| 
 | ||||
|       should "not expose the existence of symlinked files" do | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue