Skip to content

Commit

Permalink
Remove extra trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Maher4Ever committed Jan 3, 2012
1 parent 4cc638a commit fac7c92
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions lib/guard/phpunit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Guard

# The PHPUnit guard gets notified about system
# The PHPUnit guard gets notified about system
# events.
#
class PHPUnit < Guard
Expand Down Expand Up @@ -91,7 +91,7 @@ def update_failed_paths(tests_passed, paths)
if tests_passed
@failed_paths -= paths
else
@failed_paths += paths
@failed_paths += paths
end
end

Expand Down
10 changes: 5 additions & 5 deletions lib/guard/phpunit/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class PHPUnit

# The Guard::PHPUnit formatter parses the output
# of phpunit which gets printed by the progress
# printer.
# printer.
#
module Formatter
class << self
Expand Down Expand Up @@ -31,16 +31,16 @@ def parse_output(text)
#
# @param [String, Array<String>] string_list the words
# @param [String] text the tests output
# @return [Integer] the total number assigned to the words
# @return [Integer] the total number assigned to the words
#
def look_for_words_in(strings_list, text)
count = 0
strings_list = Array(strings_list)
strings_list.each do |s|
text =~ %r{
(\d+) # count of what we are looking for
(\d+) # count of what we are looking for
[ ] # then a space
#{s}s? # then the string
#{s}s? # then the string
.* # then whatever
\Z # start looking at the end of the text
}x
Expand All @@ -53,7 +53,7 @@ def look_for_words_in(strings_list, text)
#
# @param [String] text the tests output
# @return [Integer] the duration
#
#
def look_for_duration_in(text)
text =~ %r{Finished in (\d)+ seconds?.*\Z}m
$1.nil? ? 0 : $1.to_i
Expand Down
20 changes: 10 additions & 10 deletions lib/guard/phpunit/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PHPUnit
module Runner
class << self

# The exittcode phpunit returns when the tests contain failures
# The exittcode phpunit returns when the tests contain failures
#
PHPUNIT_FAILURES_EXITCODE = 1

Expand All @@ -22,14 +22,14 @@ class << self
# about the results.
#
# @param [Array<Strings>] path to the tests files.
# @param (see PHPUnit#initialize)
# @param (see PHPUnit#initialize)
# @return [Boolean] whether the tests were run successfully
#
def run(paths, options = {})
paths = Array(paths)

return false if paths.empty?

unless phpunit_exists?
UI.error('phpunit is not installed on your machine.', :reset => true)
return false
Expand All @@ -49,7 +49,7 @@ def phpunit_exists?
system('which phpunit > /dev/null 2>&1')
end

# Executes the testing command on the tests
# Executes the testing command on the tests
# and returns the status of this process.
#
# @param (see #run)
Expand Down Expand Up @@ -77,7 +77,7 @@ def run_tests(paths, options)
if $?.success? or tests_contain_failures? or tests_contain_errors?
notify_results(output, options)
else
notify_failure(options)
notify_failure(options)
end

$?.success?
Expand Down Expand Up @@ -112,7 +112,7 @@ def notify_failure(options)
return if options[:notification] == false
Notifier.notify('Failed! Check the console', :title => 'PHPUnit results', :image => :failed)
end

# Checks the exitstatus of the phpunit command
# for a sign of failures in the tests.
#
Expand Down Expand Up @@ -146,7 +146,7 @@ def create_tests_folder_for(paths)
end
end

# Creates symbolic links inside the folder pointing
# Creates symbolic links inside the folder pointing
# back to the paths.
#
# @see #create_tests_folder_for
Expand All @@ -162,11 +162,11 @@ def symlink_paths_to_tests_folder(paths, folder)
end

# Generates the phpunit command for the tests paths.
#
#
# @param (see #run)
# @param (see #run)
# @see #run_tests
#
#
def phpunit_command(path, options)
formatter_path = File.join( File.dirname(__FILE__), 'formatters', 'PHPUnit-Progress')

Expand Down
8 changes: 4 additions & 4 deletions spec/guard/phpunit/formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe '.parse_output' do
context 'when all tests pass' do
it 'returns a hash containing the tests result' do
output = load_phpunit_output('passing')
output = load_phpunit_output('passing')
subject.parse_output(output).should == {
:tests => 2, :failures => 0,
:errors => 0, :pending => 0,
Expand All @@ -15,7 +15,7 @@

context 'when all tests fail' do
it 'returns a hash containing the tests result' do
output = load_phpunit_output('failing')
output = load_phpunit_output('failing')
subject.parse_output(output).should == {
:tests => 2, :failures => 2,
:errors => 0, :pending => 0,
Expand All @@ -26,7 +26,7 @@

context 'when tests are skipped or incomplete' do
it 'returns a hash containing the tests result' do
output = load_phpunit_output('skipped_and_incomplete')
output = load_phpunit_output('skipped_and_incomplete')
subject.parse_output(output).should == {
:tests => 3, :failures => 0,
:errors => 0, :pending => 3,
Expand All @@ -37,7 +37,7 @@

context 'when tests have mixed statuses' do
it 'returns a hash containing the tests result' do
output = load_phpunit_output('mixed')
output = load_phpunit_output('mixed')
subject.parse_output(output).should == {
:tests => 13, :failures => 3,
:errors => 1, :pending => 3,
Expand Down
4 changes: 2 additions & 2 deletions spec/guard/phpunit/notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
subject.notify_results(
:tests => 10, :failures => 0,
:errors => 0, :pending => 0,
:duration => 5
:duration => 5
)
end
end
Expand All @@ -36,7 +36,7 @@
subject.notify_results(
:tests => 10, :failures => 3,
:errors => 4, :pending => 0,
:duration => 6
:duration => 6
)
end
end
Expand Down
12 changes: 6 additions & 6 deletions spec/guard/phpunit/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
before do
FileUtils.stub(:ln_s)
FileUtils.stub(:mkdir_p)

subject.stub(:execute_command)
subject.stub(:phpunit_exists?).and_return(true)
notifier.stub(:notify_results)

system("`exit 0`") # prime the $? variable
end

Expand Down Expand Up @@ -54,18 +54,18 @@
it 'prints the tests output to the console' do
output = load_phpunit_output('passing')
subject.stub(:notify_start)
subject.stub(:execute_command).and_return(output)
subject.stub(:execute_command).and_return(output)

ui.should_receive(:info).with(output)

subject.run( ['tests'] )
end

context 'when PHPUnit executes the tests' do
it 'parses the tests output' do
output = load_phpunit_output('passing')
subject.stub(:execute_command).and_return(output)

formatter.should_receive(:parse_output).with(output)

subject.run( ['tests'] )
Expand Down
8 changes: 4 additions & 4 deletions spec/guard/phpunit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
it 'throws :task_has_failed when an error occurs' do
runner.should_receive(:run).with(['tests/firstTest.php', 'tests/secondTest.php'], anything).and_return(false)
expect { subject.run_on_change ['tests/firstTest.php', 'tests/secondTest.php'] }.to throw_symbol :task_has_failed
end
end

it 'passes the options to the runner' do
runner.should_receive(:run).with(anything, hash_including(defaults)).and_return(true)
subject.run_on_change ['tests/firstTest.php', 'tests/secondTest.php']
end

context 'when tests fail' do
before do
runner.stub(:run).and_return(false)
Expand Down Expand Up @@ -163,14 +163,14 @@
expect { subject.run_on_change ['tests/firstTest.php'] }.to throw_symbol :task_has_failed
subject.run_on_change ['tests/firstTest.php']
end

it 'calls #run_all (2)' do
expect { subject.run_all }.to throw_symbol :task_has_failed
subject.should_receive(:run_all)
subject.run_on_change ['tests/firstTest.php']
end
end

context 'with the :all_after_pass option set to false' do
subject { Guard::PHPUnit.new(nil, :all_after_pass => false) }

Expand Down

0 comments on commit fac7c92

Please sign in to comment.