spec/cli_spec.rb in wright-0.3.2 vs spec/cli_spec.rb in wright-0.4.0

- old
+ new

@@ -19,10 +19,22 @@ argv = %w(-e foo -e bar -- --baz) @cli.parse(argv).must_equal %w(--baz) @cli.send(:commands).must_equal %w(foo bar) end + it 'parses -r LIBRARY' do + argv = %w(-r library1 -r library2 -rlibrary3 file.rb) + @cli.parse(argv).must_equal %w(file.rb) + @cli.send(:requires).must_equal %w(library1 library2 library3) + end + + it 'parses --dry-run' do + argv = %w(--dry-run file.rb) + @cli.parse(argv).must_equal %w(file.rb) + @cli.send(:dry_run).must_equal true + end + it 'parses --verbose' do argv = ['--verbose'] @cli.parse(argv) @cli.send(:log_level).must_equal Wright::Logger::DEBUG end @@ -36,11 +48,17 @@ describe '#run' do it 'parses --version' do argv = ['--version'] expected = "wright version #{Wright::VERSION}\n" + -> { @cli.run(argv) }.must_output expected + end + it 'enables dry-run mode when requested to do so' do + argv = ['--dry-run', '-e', 'print Wright.dry_run?'] + expected = 'true' -> { @cli.run(argv) }.must_output expected + Wright.instance_variable_set(:@dry_run, false) end it 'loads files' do argv = [File.join(@cli_dir, 'shebang.rb')] expected = 'loaded shebang.rb'