From d50ecc483da688d015065b15ec807ee670458fd8 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Tue, 31 Jul 2012 04:10:37 +0200 Subject: [PATCH] Cleanup missing whitespace after comma * There must be a code metric tool helping me in converting my style. --- lib/mutant/context/constant.rb | 16 +++---- lib/mutant/loader.rb | 10 ++--- lib/mutant/matcher/method.rb | 20 ++++----- lib/mutant/matcher/method/instance.rb | 8 ++-- lib/mutant/matcher/method/singleton.rb | 12 ++--- lib/mutant/mutatee.rb | 18 ++++---- lib/mutant/mutator.rb | 44 +++++++++---------- lib/mutant/mutator/abstract_range.rb | 12 ++--- lib/mutant/mutator/boolean.rb | 2 +- lib/mutant/mutator/empty_array.rb | 2 +- lib/mutant/mutator/false_literal.rb | 2 +- lib/mutant/mutator/fixnum_literal.rb | 2 +- lib/mutant/mutator/float_literal.rb | 4 +- lib/mutant/mutator/hash_literal.rb | 4 +- lib/mutant/mutator/range.rb | 4 +- lib/mutant/mutator/range_exclude.rb | 2 +- lib/mutant/mutator/regex_literal.rb | 2 +- lib/mutant/mutator/true_literal.rb | 4 +- lib/mutant/support/abstract.rb | 8 ++-- spec/integration/loader_spec.rb | 6 +-- spec/integration/method_matching_spec.rb | 22 +++++----- spec/shared/method_match_behavior.rb | 4 +- spec/support/fake_ast.rb | 14 +++--- .../constant/class_methods/build_spec.rb | 8 ++-- .../unit/mutant/context/constant/root_spec.rb | 2 +- spec/unit/mutant/context/root_spec.rb | 2 +- .../mutant/loader/class_methods/load_spec.rb | 2 +- spec/unit/mutant/matcher/context_spec.rb | 2 +- spec/unit/mutant/matcher/each_spec.rb | 4 +- .../classifier/class_methods/run_spec.rb | 2 +- .../matcher/method/classifier/matcher_spec.rb | 6 +-- .../mutant/matcher/method/context_spec.rb | 4 +- spec/unit/mutant/matcher/method/each_spec.rb | 2 +- .../unit/mutant/matcher/method/method_spec.rb | 4 +- .../mutant/matcher/method/node_class_spec.rb | 4 +- .../mutant/mutatee/class_methods/new_spec.rb | 4 +- spec/unit/mutant/mutatee/context_spec.rb | 4 +- spec/unit/mutant/mutatee/each_spec.rb | 4 +- spec/unit/mutant/mutatee/node_spec.rb | 4 +- spec/unit/mutant/mutatee/reset_spec.rb | 4 +- spec/unit/mutant/mutator/each_spec.rb | 14 +++--- spec/unit/mutant/mutator/emit_new_spec.rb | 8 ++-- spec/unit/mutant/mutator/emit_safe_spec.rb | 8 ++-- 43 files changed, 157 insertions(+), 157 deletions(-) diff --git a/lib/mutant/context/constant.rb b/lib/mutant/context/constant.rb index badf4f8f..7b92bad3 100644 --- a/lib/mutant/context/constant.rb +++ b/lib/mutant/context/constant.rb @@ -1,5 +1,5 @@ module Mutant - class Context + class Context # Constant context for mutation (Class or Module) class Constant < Context include Veritas::Immutable @@ -24,7 +24,7 @@ module Mutant raise ArgumentError, 'Can only build constant mutation scope from class or module' end - new(value,*arguments) + new(value, *arguments) end # Return ast wrapping mutated node @@ -35,13 +35,13 @@ module Mutant # def root(node) root = root_ast - root.body = @scope_class.new(1,root.name,node) + root.body = @scope_class.new(1, root.name, node) Rubinius::AST::Script.new(root) end # Return unqualified name of constant # - # @return [String] + # @return [String] # # @api private # @@ -66,11 +66,11 @@ module Mutant # # @api private # - def initialize(constant,keyword,scope_class) - @constant,@keyword,@scope_class = constant,keyword,scope_class + def initialize(constant, keyword, scope_class) + @constant, @keyword, @scope_class = constant, keyword, scope_class end - # Return new root ast + # Return new root ast # # @return [Rubinius::AST::Node] # @@ -82,7 +82,7 @@ module Mutant # Return qualified name of constant # - # @return [String] + # @return [String] # # @api private # diff --git a/lib/mutant/loader.rb b/lib/mutant/loader.rb index d22324cd..5a43d75f 100644 --- a/lib/mutant/loader.rb +++ b/lib/mutant/loader.rb @@ -2,12 +2,12 @@ module Mutant # A method object for inserting an AST into the Rubinius VM # # The idea is to split the steps for a mutation into documented - # methods. Also subclasses can override the steps. Also passing + # methods. Also subclasses can override the steps. Also passing # around the root node is not needed with a method object. # - # As the initializer does the work there is no need for the + # As the initializer does the work there is no need for the # instances of this class to be used outside of this class, hence - # the Loader.new method is private and the Loader.run method + # the Loader.new method is private and the Loader.run method # returns self. # class Loader @@ -46,8 +46,8 @@ module Mutant # Return compiled code for node # - # This method actually returns a Rubnius::CompiledMethod - # instance. But it is named on the future name of CompiledMethod + # This method actually returns a Rubnius::CompiledMethod + # instance. But it is named on the future name of CompiledMethod # that will be renamed to Rubinius::CompiledCode. # # @return [Rubinius::CompiledMethod] diff --git a/lib/mutant/matcher/method.rb b/lib/mutant/matcher/method.rb index a7dc2c45..d5dfcd51 100644 --- a/lib/mutant/matcher/method.rb +++ b/lib/mutant/matcher/method.rb @@ -25,7 +25,7 @@ module Mutant # returns self when block given # # @api private - # + # def each(&block) return to_enum unless block_given? mutatee.tap do |mutatee| @@ -68,7 +68,7 @@ module Mutant # Initialize method filter - # + # # @param [String] constant_name # @param [Symbol] method_name # @@ -77,11 +77,11 @@ module Mutant # @api private # def initialize(constant_name, method_name) - @constant_name,@method_name = constant_name, method_name + @constant_name, @method_name = constant_name, method_name end # Return method - # + # # @return [UnboundMethod] # # @api private @@ -96,7 +96,7 @@ module Mutant # abstract :node_class - # Check if node is matched + # Check if node is matched # # @param [Rubinius::AST::Node] node # @@ -109,8 +109,8 @@ module Mutant # @api private # def match?(node) - node.line == source_file_line && - node.class == node_class && + node.line == source_file_line && + node.class == node_class && node.name == method_name end @@ -160,7 +160,7 @@ module Mutant # # @api private # - abstract :matched_node + abstract :matched_node # Return mutatee # @@ -171,7 +171,7 @@ module Mutant def mutatee node = matched_node if node - Mutatee.new(context,node) + Mutatee.new(context, node) end end @@ -182,7 +182,7 @@ module Mutant # @api private # def constant - constant_name.split('::').inject(::Object) do |parent,name| + constant_name.split('::').inject(::Object) do |parent, name| parent.const_get(name) end end diff --git a/lib/mutant/matcher/method/instance.rb b/lib/mutant/matcher/method/instance.rb index c4b339e0..5d92209f 100644 --- a/lib/mutant/matcher/method/instance.rb +++ b/lib/mutant/matcher/method/instance.rb @@ -1,5 +1,5 @@ module Mutant - class Matcher + class Matcher class Method < Matcher # Matcher for instance methods class Instance < Method @@ -7,7 +7,7 @@ module Mutant private # Return method instance - # + # # @return [UnboundMethod] # # @api private @@ -16,8 +16,8 @@ module Mutant constant.instance_method(method_name) end - # Return matched node class - # + # Return matched node class + # # @return [Rubinius::AST::Define] # # @api private diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index 4c2a9093..2378316f 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -7,7 +7,7 @@ module Mutant private # Return method instance - # + # # @return [UnboundMethod] # # @api private @@ -16,8 +16,8 @@ module Mutant constant.method(method_name) end - # Return matched node class - # + # Return matched node class + # # @return [Rubinius::AST::DefineSingletonScope] # # @api private @@ -28,7 +28,7 @@ module Mutant # Check for stopping AST walk on branch # - # This method exist to protect against the + # This method exist to protect against the # artifical edge case where DefineSingleton nodes # with differend receivers exist on the same line. # @@ -41,13 +41,13 @@ module Mutant # returns false when node can be followed # # @api private - # + # def stop?(node) node.is_a?(Rubinius::AST::DefineSingleton) && !match_receiver?(node) end # Check if receiver matches - # + # # @param [Rubinius::AST::DefineSingleton] node # # @return [true] diff --git a/lib/mutant/mutatee.rb b/lib/mutant/mutatee.rb index 6ea02177..67195e40 100644 --- a/lib/mutant/mutatee.rb +++ b/lib/mutant/mutatee.rb @@ -31,26 +31,26 @@ module Mutant # def each(&block) return to_enum unless block_given? - Mutator.each(node,&block) + Mutator.each(node, &block) self end - # Reset implementation to original + # Reset implementation to original # - # This method inserts the original node again. + # This method inserts the original node again. # # @return [self] # # @api private - # + # def reset insert(@node) self end - private + private # Initialize a mutatee # @@ -64,18 +64,18 @@ module Mutant # # @api private # - def initialize(context,node) - @context,@node = context,node + def initialize(context, node) + @context, @node = context, node end # Insert AST node under context # # @param [Rubinius::AST::Node] node - # + # # @return [self] # # @api private - # + # def insert(node) Loader.load(context.root(node)) diff --git a/lib/mutant/mutator.rb b/lib/mutant/mutator.rb index dfafb330..a9d7648e 100644 --- a/lib/mutant/mutator.rb +++ b/lib/mutant/mutator.rb @@ -13,9 +13,9 @@ module Mutant # # @api private # - def self.each(node,&block) - return to_enum(__method__,node) unless block_given? - generator(node).new(node,block) + def self.each(node, &block) + return to_enum(__method__, node) unless block_given? + generator(node).new(node, block) self end @@ -33,7 +33,7 @@ module Mutant # def self.generator(node) unqualified_name = node.class.name.split('::').last - const_get(unqualified_name) + const_get(unqualified_name) end private_class_method :generator @@ -49,8 +49,8 @@ module Mutant # # @api private # - def initialize(node,block) - @node,@block = node,block + def initialize(node, block) + @node, @block = node, block dispatch end @@ -93,7 +93,7 @@ module Mutant # a nice interface for retring generation when generation accidentally generated the # same AST that is about to be mutated. # - # @yield + # @yield # Execute block until AST node that does not equal wrapped node is generated by block # # @return [self] @@ -104,10 +104,10 @@ module Mutant # @api private # def emit_new - MAX_TRIES.times do + MAX_TRIES.times do node = yield if new?(node) - emit_unsafe(node) + emit_unsafe(node) return end end @@ -116,7 +116,7 @@ module Mutant end # Call block with node - # + # # @param [Rubinius::AST::Node] node # # @return [self] @@ -163,8 +163,8 @@ module Mutant # # @api private # - def emit(node_class,*arguments) - emit_safe(new(node_class,*arguments)) + def emit(node_class, *arguments) + emit_safe(new(node_class, *arguments)) end # Create a new AST node with same class as wrapped node @@ -174,7 +174,7 @@ module Mutant # @api private # def new_self(*arguments) - new(node.class,*arguments) + new(node.class, *arguments) end # Create a new AST node with Rubnius::AST::NilLiteral class @@ -195,8 +195,8 @@ module Mutant # # @api private # - def new(node_class,*arguments) - node_class.new(node.line,*arguments) + def new(node_class, *arguments) + node_class.new(node.line, *arguments) end # Emit a new AST node with same class as wrapped node @@ -248,7 +248,7 @@ module Mutant # @api private # def emit_elements(elements) - elements.each_with_index do |element,index| + elements.each_with_index do |element, index| dup_elements = elements.dup Mutator.each(element).each do |mutation| dup_elements[index]=mutation @@ -274,7 +274,7 @@ module Mutant # @api private # def negative_infinity - new(Rubinius::AST::Negate,infinity) + new(Rubinius::AST::Negate, infinity) end # Return AST representing infinity @@ -284,7 +284,7 @@ module Mutant # @api private # def infinity - new_call(new_float(1),:/,new_float(0)) + new_call(new_float(1), :/, new_float(0)) end @@ -298,8 +298,8 @@ module Mutant # # @api private # - def new_call(receiver,name,arguments) - new(Rubinius::AST::SendWithArguments,receiver,name,arguments) + def new_call(receiver, name, arguments) + new(Rubinius::AST::SendWithArguments, receiver, name, arguments) end # Return new float literal @@ -311,7 +311,7 @@ module Mutant # @api private # def new_float(value) - new(Rubinius::AST::FloatLiteral,value) + new(Rubinius::AST::FloatLiteral, value) end # Return AST representing NaN @@ -321,7 +321,7 @@ module Mutant # @api private # def nan - new_call(new_float(0),:/,new_float(0)) + new_call(new_float(0), :/, new_float(0)) end memoize :sexp diff --git a/lib/mutant/mutator/abstract_range.rb b/lib/mutant/mutator/abstract_range.rb index 2135e683..b3a9dc7a 100644 --- a/lib/mutant/mutator/abstract_range.rb +++ b/lib/mutant/mutator/abstract_range.rb @@ -13,7 +13,7 @@ module Mutant # def dispatch emit_nil - emit_safe(inverse(node.start,node.finish)) + emit_safe(inverse(node.start, node.finish)) emit_range end @@ -24,11 +24,11 @@ module Mutant # @api private # def emit_range - start,finish = node.start,node.finish - emit_self(negative_infinity,finish) - emit_self(nan,finish) - emit_self(start,infinity) - emit_self(start,nan) + start, finish = node.start, node.finish + emit_self(negative_infinity, finish) + emit_self(nan, finish) + emit_self(start, infinity) + emit_self(start, nan) end # Return inverse AST node class diff --git a/lib/mutant/mutator/boolean.rb b/lib/mutant/mutator/boolean.rb index 08dda6d8..d56d748b 100644 --- a/lib/mutant/mutator/boolean.rb +++ b/lib/mutant/mutator/boolean.rb @@ -16,7 +16,7 @@ module Mutant emit_safe(inverse) end - # Return inverse + # Return inverse # # @return [Rubinius::AST::Node] # diff --git a/lib/mutant/mutator/empty_array.rb b/lib/mutant/mutator/empty_array.rb index d0ec7c3d..dfffe20a 100644 --- a/lib/mutant/mutator/empty_array.rb +++ b/lib/mutant/mutator/empty_array.rb @@ -13,7 +13,7 @@ module Mutant # def dispatch emit_nil - emit(Rubinius::AST::ArrayLiteral,[new_nil]) + emit(Rubinius::AST::ArrayLiteral, [new_nil]) end end end diff --git a/lib/mutant/mutator/false_literal.rb b/lib/mutant/mutator/false_literal.rb index 4420f209..b558b690 100644 --- a/lib/mutant/mutator/false_literal.rb +++ b/lib/mutant/mutator/false_literal.rb @@ -2,7 +2,7 @@ module Mutant class Mutator # Represent mutations of false literal class FalseLiteral < Boolean - + private # Return inverse class diff --git a/lib/mutant/mutator/fixnum_literal.rb b/lib/mutant/mutator/fixnum_literal.rb index 6c3e5c08..4b1e2a2c 100644 --- a/lib/mutant/mutator/fixnum_literal.rb +++ b/lib/mutant/mutator/fixnum_literal.rb @@ -24,7 +24,7 @@ module Mutant # @api private # def values - [0,1,-node.value] + [0, 1, -node.value] end end end diff --git a/lib/mutant/mutator/float_literal.rb b/lib/mutant/mutator/float_literal.rb index 61fed5c0..d9d0679c 100644 --- a/lib/mutant/mutator/float_literal.rb +++ b/lib/mutant/mutator/float_literal.rb @@ -5,7 +5,7 @@ module Mutant private - # Emit mutants + # Emit mutants # # @return [undefined] # @@ -25,7 +25,7 @@ module Mutant # @api private # def values - [0.0,1.0] << -node.value + [0.0, 1.0] << -node.value end end end diff --git a/lib/mutant/mutator/hash_literal.rb b/lib/mutant/mutator/hash_literal.rb index 26168f5c..8fd15e1e 100644 --- a/lib/mutant/mutator/hash_literal.rb +++ b/lib/mutant/mutator/hash_literal.rb @@ -39,7 +39,7 @@ module Mutant end # Return values to mutate against - # + # # @return [Array] # # @api private @@ -55,7 +55,7 @@ module Mutant # @api private # def emit_element_presence - 0.step(array.length-1,2) do |index| + 0.step(array.length-1, 2) do |index| contents = dup_array contents.delete_at(index) contents.delete_at(index) diff --git a/lib/mutant/mutator/range.rb b/lib/mutant/mutator/range.rb index b9fbcd78..1ea058fc 100644 --- a/lib/mutant/mutator/range.rb +++ b/lib/mutant/mutator/range.rb @@ -5,14 +5,14 @@ module Mutant private - # Return inverse + # Return inverse # # @return [Rubinius::AST::RangeExclude] # # @api private # def inverse(*arguments) - new(Rubinius::AST::RangeExclude,*arguments) + new(Rubinius::AST::RangeExclude, *arguments) end end end diff --git a/lib/mutant/mutator/range_exclude.rb b/lib/mutant/mutator/range_exclude.rb index 1740e080..733bfed3 100644 --- a/lib/mutant/mutator/range_exclude.rb +++ b/lib/mutant/mutator/range_exclude.rb @@ -12,7 +12,7 @@ module Mutant # @api private # def inverse(*arguments) - new(Rubinius::AST::Range,*arguments) + new(Rubinius::AST::Range, *arguments) end end end diff --git a/lib/mutant/mutator/regex_literal.rb b/lib/mutant/mutator/regex_literal.rb index 4ddc38fd..07419763 100644 --- a/lib/mutant/mutator/regex_literal.rb +++ b/lib/mutant/mutator/regex_literal.rb @@ -13,7 +13,7 @@ module Mutant # def dispatch emit_nil - emit_new { new_self(Mutant.random_hex_string,node.options) } + emit_new { new_self(Mutant.random_hex_string, node.options) } end end end diff --git a/lib/mutant/mutator/true_literal.rb b/lib/mutant/mutator/true_literal.rb index 1a525ffd..b8dec7b9 100644 --- a/lib/mutant/mutator/true_literal.rb +++ b/lib/mutant/mutator/true_literal.rb @@ -2,10 +2,10 @@ module Mutant class Mutator # Represent mutations of true literal class TrueLiteral < Boolean - + private - # Return inverse + # Return inverse # # @return [Rubinius::AST::FalseLiteral] # diff --git a/lib/mutant/support/abstract.rb b/lib/mutant/support/abstract.rb index e7fdee34..5497a99b 100644 --- a/lib/mutant/support/abstract.rb +++ b/lib/mutant/support/abstract.rb @@ -41,9 +41,9 @@ module Mutant # @api private # def define_singleton_method(name) - class_eval(<<-RUBY,__FILE__,__LINE__+1) + class_eval(<<-RUBY, __FILE__, __LINE__+1) def #{name}(*) - raise NotImplementedError,"\#{self.name}.\#{__method__} is not implemented" + raise NotImplementedError, "\#{self.name}.\#{__method__} is not implemented" end RUBY end @@ -57,9 +57,9 @@ module Mutant # @api private # def define_instance_method(name) - class_eval(<<-RUBY,__FILE__,__LINE__+1) + class_eval(<<-RUBY, __FILE__, __LINE__+1) def #{name}(*) - raise NotImplementedError,"\#{self.class.name}#\#{__method__} is not implemented" + raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented" end RUBY end diff --git a/spec/integration/loader_spec.rb b/spec/integration/loader_spec.rb index 24cb64c6..e3a07680 100644 --- a/spec/integration/loader_spec.rb +++ b/spec/integration/loader_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' -if "".respond_to?(:to_ast) +if "".respond_to?(:to_ast) class CodeLoadingSubject def x true end end - describe Mutant,'code loading' do + describe Mutant, 'code loading' do let(:context) { Mutant::Context::Constant.build(CodeLoadingSubject) } let(:node) { 'def foo; :bar; end'.to_ast } let(:root) { context.root(node) } - + subject { Mutant::Loader.load(root) } before { subject } diff --git a/spec/integration/method_matching_spec.rb b/spec/integration/method_matching_spec.rb index e0375d61..7005d7d6 100644 --- a/spec/integration/method_matching_spec.rb +++ b/spec/integration/method_matching_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' if "".respond_to?(:to_ast) - describe Mutant,'method matching' do + describe Mutant, 'method matching' do after do if defined?(::Foo) - Object.send(:remove_const,'Foo') + Object.send(:remove_const, 'Foo') end end @@ -12,7 +12,7 @@ if "".respond_to?(:to_ast) eval(body) File.stub(:read => body) end - + let(:defaults) { {} } context 'on instance methods' do @@ -28,7 +28,7 @@ if "".respond_to?(:to_ast) context 'when method is defined once' do let(:body) do - <<-RUBY + <<-RUBY class Foo def bar; end end @@ -45,7 +45,7 @@ if "".respond_to?(:to_ast) context 'when method is defined multiple times' do context 'on differend lines' do let(:body) do - <<-RUBY + <<-RUBY class Foo def bar; end def bar(arg); end @@ -65,7 +65,7 @@ if "".respond_to?(:to_ast) context 'on the same line' do let(:body) do - <<-RUBY + <<-RUBY class Foo def bar; end; def bar(arg); end end @@ -84,7 +84,7 @@ if "".respond_to?(:to_ast) context 'on the same line with differend scope' do let(:body) do - <<-RUBY + <<-RUBY class Foo def self.bar; end; def bar(arg); end end @@ -107,7 +107,7 @@ if "".respond_to?(:to_ast) context 'in class' do let(:body) do <<-RUBY - class Foo + class Foo class Bar def baz; end end @@ -116,7 +116,7 @@ if "".respond_to?(:to_ast) end let(:expectation) do - { + { :method_line => 3, :method_name => :baz, :constant => Foo::Bar @@ -129,7 +129,7 @@ if "".respond_to?(:to_ast) context 'in module' do let(:body) do <<-RUBY - module Foo + module Foo class Bar def baz; end end @@ -138,7 +138,7 @@ if "".respond_to?(:to_ast) end let(:expectation) do - { + { :method_line => 3, :method_name => :baz, :constant => Foo::Bar diff --git a/spec/shared/method_match_behavior.rb b/spec/shared/method_match_behavior.rb index 56e064d9..e704427e 100644 --- a/spec/shared/method_match_behavior.rb +++ b/spec/shared/method_match_behavior.rb @@ -30,10 +30,10 @@ shared_examples_for 'a method match' do end it 'should have correct constant in context' do - context.send(:constant).should eql(constant) + context.send(:constant).should eql(constant) end it 'should have the correct node class' do - node.should be_a(node_class) + node.should be_a(node_class) end end diff --git a/spec/support/fake_ast.rb b/spec/support/fake_ast.rb index bb8f6087..54595951 100644 --- a/spec/support/fake_ast.rb +++ b/spec/support/fake_ast.rb @@ -8,8 +8,8 @@ unless defined?(Rubinius) attr_accessor :body - def initialize(line,name,body=[]) - @line,@name,@body = line,name,body + def initialize(line, name, body=[]) + @line, @name, @body = line, name, body end end @@ -27,16 +27,16 @@ unless defined?(Rubinius) # Dummy class node class Class < Node - def initialize(line,name,superclass,body) - super(line,name) - @superclass,@body = superclass,body + def initialize(line, name, superclass, body) + super(line, name) + @superclass, @body = superclass, body end end # Dummy module node class Module < Node - def initialize(line,name,body) - super(line,name) + def initialize(line, name, body) + super(line, name) @body = body end end diff --git a/spec/unit/mutant/context/constant/class_methods/build_spec.rb b/spec/unit/mutant/context/constant/class_methods/build_spec.rb index 8742a555..b9856e44 100644 --- a/spec/unit/mutant/context/constant/class_methods/build_spec.rb +++ b/spec/unit/mutant/context/constant/class_methods/build_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Context::Constant,'.build' do +describe Mutant::Context::Constant, '.build' do subject { described_class.build(constant) } let(:object) { described_class } @@ -14,7 +14,7 @@ describe Mutant::Context::Constant,'.build' do let(:constant) { Module.new } it 'should initialize context correctly' do - described_class.should_receive(:new).with(constant,'module',Rubinius::AST::ModuleScope).and_return(context) + described_class.should_receive(:new).with(constant, 'module', Rubinius::AST::ModuleScope).and_return(context) should be(context) end @@ -25,7 +25,7 @@ describe Mutant::Context::Constant,'.build' do let(:constant) { Class.new } it 'should initialize context correctly' do - described_class.should_receive(:new).with(constant,'class',Rubinius::AST::ClassScope).and_return(context) + described_class.should_receive(:new).with(constant, 'class', Rubinius::AST::ClassScope).and_return(context) should be(context) end @@ -36,7 +36,7 @@ describe Mutant::Context::Constant,'.build' do let(:constant) { Object.new } it 'should raise error' do - expect { subject }.to raise_error(ArgumentError,'Can only build constant mutation scope from class or module') + expect { subject }.to raise_error(ArgumentError, 'Can only build constant mutation scope from class or module') end end end diff --git a/spec/unit/mutant/context/constant/root_spec.rb b/spec/unit/mutant/context/constant/root_spec.rb index cb2153bc..ce127289 100644 --- a/spec/unit/mutant/context/constant/root_spec.rb +++ b/spec/unit/mutant/context/constant/root_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -if "".respond_to?(:to_ast) +if "".respond_to?(:to_ast) describe Mutant::Context::Constant, '#root' do subject { object.root(node) } diff --git a/spec/unit/mutant/context/root_spec.rb b/spec/unit/mutant/context/root_spec.rb index 47247c3a..29877513 100644 --- a/spec/unit/mutant/context/root_spec.rb +++ b/spec/unit/mutant/context/root_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Context,'#root' do +describe Mutant::Context, '#root' do subject { object.root(mock) } let(:object) { described_class.allocate } diff --git a/spec/unit/mutant/loader/class_methods/load_spec.rb b/spec/unit/mutant/loader/class_methods/load_spec.rb index 6d432845..d87e02db 100644 --- a/spec/unit/mutant/loader/class_methods/load_spec.rb +++ b/spec/unit/mutant/loader/class_methods/load_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Loader,'.load' do +describe Mutant::Loader, '.load' do subject { object.load(node) } let(:object) { described_class } diff --git a/spec/unit/mutant/matcher/context_spec.rb b/spec/unit/mutant/matcher/context_spec.rb index e47878ab..1ec628e2 100644 --- a/spec/unit/mutant/matcher/context_spec.rb +++ b/spec/unit/mutant/matcher/context_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Matcher,'#context' do +describe Mutant::Matcher, '#context' do subject { object.context } let(:object) { described_class.new(constant_name) } diff --git a/spec/unit/mutant/matcher/each_spec.rb b/spec/unit/mutant/matcher/each_spec.rb index 5a2f8a4f..673db61c 100644 --- a/spec/unit/mutant/matcher/each_spec.rb +++ b/spec/unit/mutant/matcher/each_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' # This spec is only present to ensure 100% test coverage. # The code should not be triggered on runtime. -describe Mutant::Matcher,'#each' do +describe Mutant::Matcher, '#each' do subject { object.send(:each) } let(:object) { described_class.allocate } it 'should raise error' do - expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher#each is not implemented') + expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher#each is not implemented') end end diff --git a/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb b/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb index 078b213d..1e4ef602 100644 --- a/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +++ b/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb @@ -38,7 +38,7 @@ describe Mutant::Matcher::Method::Classifier, '.run' do let(:input) { 'Foo' } it 'should raise error' do - expect { subject }.to raise_error(ArgumentError,"Cannot determine subject from #{input.inspect}") + expect { subject }.to raise_error(ArgumentError, "Cannot determine subject from #{input.inspect}") end end end diff --git a/spec/unit/mutant/matcher/method/classifier/matcher_spec.rb b/spec/unit/mutant/matcher/method/classifier/matcher_spec.rb index 749b54a2..ed0b0990 100644 --- a/spec/unit/mutant/matcher/method/classifier/matcher_spec.rb +++ b/spec/unit/mutant/matcher/method/classifier/matcher_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' # This method cannot be called directly, spec only exists for heckle demands -describe Mutant::Matcher::Method::Classifier,'#matcher' do +describe Mutant::Matcher::Method::Classifier, '#matcher' do subject { object.matcher } - let(:object) { described_class.send(:new,match) } + let(:object) { described_class.send(:new, match) } - let(:match) { [mock,constant_name,scope_symbol,method_name] } + let(:match) { [mock, constant_name, scope_symbol, method_name] } let(:constant_name) { mock('Constant Name') } let(:method_name) { 'foo' } diff --git a/spec/unit/mutant/matcher/method/context_spec.rb b/spec/unit/mutant/matcher/method/context_spec.rb index b534e840..ea19426b 100644 --- a/spec/unit/mutant/matcher/method/context_spec.rb +++ b/spec/unit/mutant/matcher/method/context_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe Mutant::Matcher::Method,'#context' do +describe Mutant::Matcher::Method, '#context' do subject { object.context } - let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule','foo') } + let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule', 'foo') } let(:context) { mock('Context') } before do diff --git a/spec/unit/mutant/matcher/method/each_spec.rb b/spec/unit/mutant/matcher/method/each_spec.rb index 457dc7d4..ec87797c 100644 --- a/spec/unit/mutant/matcher/method/each_spec.rb +++ b/spec/unit/mutant/matcher/method/each_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' # This method implementation cannot be called from the outside, but heckle needs to be happy. -describe Mutant::Matcher::Method,'#each' do +describe Mutant::Matcher::Method, '#each' do let(:class_under_test) do node = self.matched_node Class.new(described_class) do diff --git a/spec/unit/mutant/matcher/method/method_spec.rb b/spec/unit/mutant/matcher/method/method_spec.rb index 3b7cddec..b00c47be 100644 --- a/spec/unit/mutant/matcher/method/method_spec.rb +++ b/spec/unit/mutant/matcher/method/method_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe Mutant::Matcher::Method,'#method' do +describe Mutant::Matcher::Method, '#method' do subject { object.send(:method) } let(:object) { described_class.allocate } it 'should raise error' do - expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#method is not implemented') + expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#method is not implemented') end end diff --git a/spec/unit/mutant/matcher/method/node_class_spec.rb b/spec/unit/mutant/matcher/method/node_class_spec.rb index 8b9deb85..4ab947fd 100644 --- a/spec/unit/mutant/matcher/method/node_class_spec.rb +++ b/spec/unit/mutant/matcher/method/node_class_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe Mutant::Matcher::Method,'#node_class' do +describe Mutant::Matcher::Method, '#node_class' do subject { object.send(:node_class) } let(:object) { described_class.allocate } it 'should raise error' do - expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#node_class is not implemented') + expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#node_class is not implemented') end end diff --git a/spec/unit/mutant/mutatee/class_methods/new_spec.rb b/spec/unit/mutant/mutatee/class_methods/new_spec.rb index abd98cc9..e3bad505 100644 --- a/spec/unit/mutant/mutatee/class_methods/new_spec.rb +++ b/spec/unit/mutant/mutatee/class_methods/new_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe Mutant::Mutatee,'.new' do - subject { object.new(context,ast) } +describe Mutant::Mutatee, '.new' do + subject { object.new(context, ast) } let(:object) { described_class } diff --git a/spec/unit/mutant/mutatee/context_spec.rb b/spec/unit/mutant/mutatee/context_spec.rb index dd431864..dd87c259 100644 --- a/spec/unit/mutant/mutatee/context_spec.rb +++ b/spec/unit/mutant/mutatee/context_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe Mutant::Mutatee,'#context' do +describe Mutant::Mutatee, '#context' do subject { object.context } - let(:object) { described_class.new(context,ast) } + let(:object) { described_class.new(context, ast) } let(:ast) { mock('AST') } let(:context) { mock('Context') } diff --git a/spec/unit/mutant/mutatee/each_spec.rb b/spec/unit/mutant/mutatee/each_spec.rb index 4499299b..56fd6db7 100644 --- a/spec/unit/mutant/mutatee/each_spec.rb +++ b/spec/unit/mutant/mutatee/each_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe Mutant::Mutatee,'#each' do +describe Mutant::Mutatee, '#each' do subject { object.each { |item| yields << item } } - let(:object) { described_class.new(context,ast) } + let(:object) { described_class.new(context, ast) } let(:root) { mock('Root AST') } let(:ast) { mock('AST') } let(:context) { mock('Context', :root => root) } diff --git a/spec/unit/mutant/mutatee/node_spec.rb b/spec/unit/mutant/mutatee/node_spec.rb index 5bbca9fe..148fcd0e 100644 --- a/spec/unit/mutant/mutatee/node_spec.rb +++ b/spec/unit/mutant/mutatee/node_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe Mutant::Mutatee,'#node' do +describe Mutant::Mutatee, '#node' do subject { object.node } - let(:object) { described_class.new(context,node) } + let(:object) { described_class.new(context, node) } let(:node) { mock('Node') } let(:context) { mock('Context') } diff --git a/spec/unit/mutant/mutatee/reset_spec.rb b/spec/unit/mutant/mutatee/reset_spec.rb index 943d47d5..dd594dfc 100644 --- a/spec/unit/mutant/mutatee/reset_spec.rb +++ b/spec/unit/mutant/mutatee/reset_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe Mutant::Mutatee,'#reset' do +describe Mutant::Mutatee, '#reset' do subject { object.reset } - let(:object) { described_class.new(context,ast) } + let(:object) { described_class.new(context, ast) } let(:root) { mock('Root AST') } let(:ast) { mock('AST') } let(:context) { mock('Context', :root => root) } diff --git a/spec/unit/mutant/mutator/each_spec.rb b/spec/unit/mutant/mutator/each_spec.rb index 58c7a494..5185d173 100644 --- a/spec/unit/mutant/mutator/each_spec.rb +++ b/spec/unit/mutant/mutator/each_spec.rb @@ -12,7 +12,7 @@ shared_examples_for 'a mutation enumerator method' do it { should be_instance_of(to_enum.class) } - let(:expected_mutations) do + let(:expected_mutations) do mutations.map do |mutation| if mutation.respond_to?(:to_ast) mutation.to_ast.to_sexp @@ -136,7 +136,7 @@ describe Mutant::Mutator, '.each' do mutations << [:negate, [:call, [:lit, 1.0], :/, [:arglist, [:lit, 0.0]]]] mutations << [:lit, -10.0] end - + let(:random_float) { 7.123 } before do @@ -171,7 +171,7 @@ describe Mutant::Mutator, '.each' do # Literal replaced with nil mutations << [:nil] - + # Mutation of each element in array mutations << '[nil, false]' mutations << '[false, false]' @@ -188,7 +188,7 @@ describe Mutant::Mutator, '.each' do # Extra element mutations << '[true, false, nil]' end - + it_should_behave_like 'a mutation enumerator method' end @@ -226,7 +226,7 @@ describe Mutant::Mutator, '.each' do end context 'range literal' do - let(:source) { '1..100' } + let(:source) { '1..100' } let(:mutations) do mutations = [] @@ -242,7 +242,7 @@ describe Mutant::Mutator, '.each' do end context 'exclusive range literal' do - let(:source) { '1...100' } + let(:source) { '1...100' } let(:mutations) do mutations = [] @@ -288,7 +288,7 @@ describe Mutant::Mutator, '.each' do let(:mutations) do mutations = [] - + # Mutation of each statement in block mutations << "nil\nfalse" mutations << "false\nfalse" diff --git a/spec/unit/mutant/mutator/emit_new_spec.rb b/spec/unit/mutant/mutator/emit_new_spec.rb index 941fb265..b4e6934a 100644 --- a/spec/unit/mutant/mutator/emit_new_spec.rb +++ b/spec/unit/mutant/mutator/emit_new_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Mutator,'#emit_new' do +describe Mutant::Mutator, '#emit_new' do subject { object.send(:emit_new) { node } } class Block @@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_new' do end end - let(:object) { class_under_test.new(wrapped_node,block) } + let(:object) { class_under_test.new(wrapped_node, block) } let(:block) { Block.new } let(:wrapped_node) { '"foo"'.to_ast } @@ -40,12 +40,12 @@ describe Mutant::Mutator,'#emit_new' do block.arguments.should eql([node]) end end - + context 'when new AST could not be generated' do let(:node) { '"foo"'.to_ast } it 'should raise error' do - expect { subject }.to raise_error(RuntimeError,'New AST could not be generated after 3 attempts') + expect { subject }.to raise_error(RuntimeError, 'New AST could not be generated after 3 attempts') end end end diff --git a/spec/unit/mutant/mutator/emit_safe_spec.rb b/spec/unit/mutant/mutator/emit_safe_spec.rb index ea86c9c6..9f245ff4 100644 --- a/spec/unit/mutant/mutator/emit_safe_spec.rb +++ b/spec/unit/mutant/mutator/emit_safe_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe Mutant::Mutator,'#emit_safe' do - subject { object.send(:emit_safe,node) } +describe Mutant::Mutator, '#emit_safe' do + subject { object.send(:emit_safe, node) } class Block attr_reader :arguments @@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_safe' do end end - let(:object) { class_under_test.new(wrapped_node,block) } + let(:object) { class_under_test.new(wrapped_node, block) } let(:block) { Block.new } let(:wrapped_node) { '"foo"'.to_ast } @@ -40,7 +40,7 @@ describe Mutant::Mutator,'#emit_safe' do block.arguments.should eql([node]) end end - + context 'with node that is equal to wrapped node' do let(:node) { '"foo"'.to_ast }