test/cli/commands/test_compile.rb in nanoc-3.7.4 vs test/cli/commands/test_compile.rb in nanoc-3.7.5
- old
+ new
@@ -1,11 +1,10 @@
# encoding: utf-8
class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
-
def test_profiling_information
- with_site do |site|
+ with_site do |_site|
Nanoc::CLI.run %w( create_item foo )
Nanoc::CLI.run %w( create_item bar )
Nanoc::CLI.run %w( create_item baz )
File.open('Rules', 'w') do |io|
@@ -27,11 +26,11 @@
Nanoc::CLI.run %w( compile --verbose )
end
end
def test_auto_prune
- with_site do |site|
+ with_site do |_site|
Nanoc::CLI.run %w( create_item foo )
Nanoc::CLI.run %w( create_item bar )
Nanoc::CLI.run %w( create_item baz )
File.open('Rules', 'w') do |io|
@@ -68,11 +67,11 @@
refute File.file?('output/stray.html')
end
end
def test_auto_prune_with_exclude
- with_site do |site|
+ with_site do |_site|
Nanoc::CLI.run %w( create_item foo )
Nanoc::CLI.run %w( create_item bar )
Nanoc::CLI.run %w( create_item baz )
File.open('Rules', 'w') do |io|
@@ -116,22 +115,33 @@
end
def test_setup_and_teardown_listeners
with_site do
test_listener_class = Class.new(::Nanoc::CLI::Commands::Compile::Listener) do
- def start; @started = true; end
- def stop; @stopped = true; end
- def started?; @started; end
- def stopped?; @stopped; end
+ def start
+ @started = true
+ end
+
+ def stop
+ @stopped = true
+ end
+
+ def started?
+ @started
+ end
+
+ def stopped?
+ @stopped
+ end
end
options = {}
arguments = []
cmd = nil
listener_classes = [test_listener_class]
cmd_runner = Nanoc::CLI::Commands::Compile.new(
- options, arguments, cmd, :listener_classes => listener_classes)
+ options, arguments, cmd, listener_classes: listener_classes)
cmd_runner.run
listeners = cmd_runner.send(:listeners)
assert listeners.size == 1
@@ -181,25 +191,24 @@
assert_equal 'output/foo.txt', listener.events[0][:path]
assert_nil listener.events[0][:duration]
end
def new_file_action_printer(reps)
- listener = Nanoc::CLI::Commands::Compile::FileActionPrinter.new(:reps => reps)
+ listener = Nanoc::CLI::Commands::Compile::FileActionPrinter.new(reps: reps)
def listener.log(level, action, path, duration)
@events ||= []
@events << {
- :level => level,
- :action => action,
- :path => path,
- :duration => duration
+ level: level,
+ action: action,
+ path: path,
+ duration: duration
}
end
def listener.events
@events
end
listener
end
-
end