lib/plsql/spec/cli.rb in ruby-plsql-spec-0.3.0 vs lib/plsql/spec/cli.rb in ruby-plsql-spec-0.4.0
- old
+ new
@@ -1,7 +1,9 @@
require 'thor'
require 'thor/actions'
+require 'rspec/support'
+RSpec::Support.require_rspec_support 'differ'
# use plsql-spec for showing diff of files
# by defuault Thor uses diff utility which is not available on Windows
ENV['THOR_DIFF'] = 'plsql-spec diff'
@@ -40,10 +42,14 @@
desc 'run [FILES]', 'run all *_spec.rb tests in spec subdirectory or specified files'
method_option :"dbms-output",
:type => :boolean,
:default => false,
:banner => "show DBMS_OUTPUT messages"
+ method_option :capture,
+ :type => :boolean,
+ :default => true,
+ :banner => "hide the output when some exception occur"
method_option :"html",
:type => :string,
:banner => "generate HTML RSpec output to specified file (default is test-results.html)"
method_option :coverage,
:type => :string,
@@ -74,14 +80,14 @@
speccommand = "rspec"
end
if files.empty?
say "Running all specs from spec/", :yellow
- puts run("#{speccommand} spec", :verbose => false, :capture => true)
+ puts run("#{speccommand} spec", :verbose => false, :capture => options[:capture])
else
say "Running specs from #{files.join(', ')}", :yellow
- puts run("#{speccommand} #{files.join(' ')}", :verbose => false, :capture => true)
+ puts run("#{speccommand} #{files.join(' ')}", :verbose => false, :capture => options[:capture])
end
if options[:html]
say "Test results in #{spec_output_filename}"
end
@@ -96,11 +102,11 @@
end
end
desc 'diff [FILE1] [FILE2]', 'show difference between files'
def diff(file1, file2)
- differ = RSpec::Expectations::Differ.new
+ differ = RSpec::Support::Differ.new
say differ.diff_as_string File.read(file2), File.read(file1)
end
desc '-v', 'show ruby-plsql-spec and ruby-plsql version'
def version
@@ -110,6 +116,6 @@
end
end
end
-end
\ No newline at end of file
+end