diff --git a/.travis.yml b/.travis.yml index 0b3a949e..bbe97c55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ rvm: matrix: allow_failures: # No mutators for 1.8 specifc AST nodes - - rvm: rbx-18mode + - rvm: rbx-18mode - rvm: 1.8.7 # We'll see what happens - rvm: ruby-head diff --git a/Changelog.md b/Changelog.md index 0a7dc7c6..77d3a206 100644 --- a/Changelog.md +++ b/Changelog.md @@ -122,7 +122,7 @@ # v0.2.1 2012-12-07 * [fixed] Crash on unavailable source location -* [fixed] Incorrect handling of if and unless statements +* [fixed] Incorrect handling of if and unless statements * [fixed] Expand Foo#initialize to spec/unit/foo in rspec dm2 strategy * [fixed] Correctly expand [] to element_reader_spec.rb in rspec dm2 strategy * [fixed] Correctly expand []= to element_writer_spec.rb in rspec dm2 strategy diff --git a/README.md b/README.md index 6b2a56cf..101013d1 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ mutant Mutant is a mutation testing tool for ruby that aims to be better than existing mutation testers. -The idea is that if code can be changed and your tests do not notice, either that code isn't being covered +The idea is that if code can be changed and your tests do not notice, either that code isn't being covered or it does not have a speced side effect. -Mutant does currently only support 1.9 mode under Rubinius or MRI. Support for JRuby is planned. +Mutant does currently only support 1.9 mode under Rubinius or MRI. Support for JRuby is planned. -Also it is easy to write a mutation killer for other test/spec frameworks than rspec2. +Also it is easy to write a mutation killer for other test/spec frameworks than rspec2. Just create your own Mutant::Killer subclass, and make sure I get a PR! See this [ASCII-Cast](http://ascii.io/a/1707) for mutant in action! (v0.2.1) @@ -45,7 +45,7 @@ CLI will be simplified in the next releases, but currently stick with this: cd virtus # Run mutant on virtus namespace (that uses the dm-2 style spec layout) mutant -I lib -r virtus --rspec-dm2 ::Virtus -# Run mutant on specific virtus class +# Run mutant on specific virtus class mutant -I lib -r virtus --rspec-dm2 ::Virtus::Attribute # Run mutant on specific virtus class method mutant -I lib -r virtus --rspec-dm2 ::Virtus::Attribute.build @@ -110,7 +110,7 @@ I'm very happy to receive/answer feedback/questions and critism. Your options: * Github Issue https://github.com/mutant/issues -* Ping me on https://twitter.com/_m_b_j_ +* Ping me on https://twitter.com/_m_b_j_ * #datamapper channel on freenode, I hang around on CET daytimes. (nick mbj) Credits diff --git a/TODO b/TODO index ac5a1dbb..243996e6 100644 --- a/TODO +++ b/TODO @@ -15,11 +15,11 @@ Mutations: * Mutate options on Regexp literals * Add mutations for dynamic regexp symbol and string literals * Mutate "def foo; bar; end" to "def foo; self; end"? - * Emit negative and positive mutations + * Emit negative and positive mutations * Mutate Block catch "def foo(&block)" and block pass "foo(&block)" * Mutate super arguments just like send arguments * Add timeout to terminate infinite loops - + Example of a negative mutation: Mutations on local variables and arguments prefixed with an underscore would be emitted as negative mutations that must be alive. @@ -29,7 +29,7 @@ Loader: Killers: * Move test framework specific stuff to strategy - * Add a general master <=> killer IPC interface. So different strategies of isolation + * Add a general master <=> killer IPC interface. So different strategies of isolation (fork, vs jruby runtime creation) will work without big impact. Strategy: diff --git a/config/roodi.yml b/config/roodi.yml index 0cb8e3d7..522e1fe3 100644 --- a/config/roodi.yml +++ b/config/roodi.yml @@ -5,7 +5,7 @@ AssignmentInConditionalCheck: {} CaseMissingElseCheck: {} ClassLineCountCheck: line_count: 324 -ClassNameCheck: +ClassNameCheck: pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/ ClassVariableCheck: {} CyclomaticComplexityBlockCheck: diff --git a/config/site.reek b/config/site.reek index db583178..2406b1c4 100644 --- a/config/site.reek +++ b/config/site.reek @@ -9,14 +9,14 @@ UncommunicativeParameterName: - !ruby/regexp /[A-Z]/ LargeClass: max_methods: 10 - exclude: + exclude: - "Mutant::Reporter::CLI" # 16 methods TODO Reduce! - "Mutant::Reporter::Stats" # 6 ivars TODO Reduce! - "Mutant::CLI" # 19 methods and 7 ivars, TODO Reduce! enabled: true max_instance_variables: 3 UncommunicativeMethodName: - accept: + accept: - sha1 exclude: [] enabled: true @@ -26,7 +26,7 @@ UncommunicativeMethodName: - !ruby/regexp /[A-Z]/ LongParameterList: max_params: 2 - exclude: + exclude: - "Mutant::Mutator::Node#new_send_with_arguments" # 3 params - "Mutant::Context::Constant#initialize" # 3 params - "Mutant::Subject#initialize" # 3 params @@ -45,7 +45,7 @@ IrresponsibleModule: exclude: [] enabled: true UncommunicativeModuleName: - accept: + accept: - Mutant::Mutator::Node::Iter19 - Mutant::Strategy::Rspec::DM2 exclude: [] @@ -55,7 +55,7 @@ UncommunicativeModuleName: - !ruby/regexp /[0-9]$/ NestedIterators: ignore_iterators: [] - exclude: + exclude: - Mutant#self.define_singleton_subclass - Mutant::Mutator::Util::Array::Element#dispatch - Mutant::Mutator::Node::ReceiverCase#emit_when_branch_mutation @@ -67,7 +67,7 @@ LongMethod: enabled: true Duplication: allow_calls: [] - exclude: + exclude: - Mutant::Mutator::Node::Literal::Hash#emit_element_presence enabled: true max_calls: 1 diff --git a/lib/mutant.rb b/lib/mutant.rb index 83fafe41..db27cfd5 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -19,7 +19,7 @@ require 'concord' # Patch ice none to freeze nodes correctly class IceNine::Freezer # Rubinius namsepace - class Rubinius + class Rubinius # AST namespace class AST < IceNine::Freezer::Object # Node configuration @@ -84,8 +84,8 @@ require 'mutant/mutator/node/return' require 'mutant/mutator/node/iter_19' require 'mutant/mutator/node/if' require 'mutant/mutator/node/receiver_case' -require 'mutant/config' -require 'mutant/loader' +require 'mutant/config' +require 'mutant/loader' require 'mutant/context' require 'mutant/context/scope' require 'mutant/subject' diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 8c3bbabb..4cd89880 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -149,7 +149,7 @@ module Mutant end # Process matcher argument - # + # # @return [undefined] # # @api private diff --git a/lib/mutant/cli/classifier.rb b/lib/mutant/cli/classifier.rb index fbaa4db0..970122d8 100644 --- a/lib/mutant/cli/classifier.rb +++ b/lib/mutant/cli/classifier.rb @@ -11,7 +11,7 @@ module Mutant SINGLETON_PATTERN = %r(\A(#{SCOPE_PATTERN})\z).freeze - # Return constant + # Return constant # # @param [String] location # diff --git a/lib/mutant/cli/classifier/namespace.rb b/lib/mutant/cli/classifier/namespace.rb index 0e73eac2..a2a643a2 100644 --- a/lib/mutant/cli/classifier/namespace.rb +++ b/lib/mutant/cli/classifier/namespace.rb @@ -26,7 +26,7 @@ module Mutant # @api private # def namespace - Classifier.const_lookup(match.to_s) + Classifier.const_lookup(match.to_s) end end end diff --git a/lib/mutant/cli_parser.rb b/lib/mutant/cli_parser.rb index 3e3c7957..cd701b41 100644 --- a/lib/mutant/cli_parser.rb +++ b/lib/mutant/cli_parser.rb @@ -1,8 +1,8 @@ module Mutant # Base class for cli parsers # - # I hate base classes for reusable functionallity. - # But could not come up with a nice composition/instantiation + # I hate base classes for reusable functionallity. + # But could not come up with a nice composition/instantiation # solution. # class CLIParser @@ -15,7 +15,7 @@ module Mutant OPTION_PATTERN = %r(\A-(?:-)?[a-zA-Z0-9\-]+\z).freeze - # Initialize CLI + # Initialize CLI # # @param [Array] arguments # diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index f51e0a5c..6fcfc63c 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -28,7 +28,7 @@ module Mutant # Wrap node into ast node # - # @param [Class, Module] scope + # @param [Class, Module] scope # @param [Rubinius::AST::Node] node # # @return [Rubinius::AST::Class] diff --git a/lib/mutant/differ.rb b/lib/mutant/differ.rb index 43bfdcb2..c41906e0 100644 --- a/lib/mutant/differ.rb +++ b/lib/mutant/differ.rb @@ -3,7 +3,7 @@ module Mutant class Differ include Adamantium::Flat - # Return source diff + # Return source diff # # @return [String] # @@ -20,7 +20,7 @@ module Mutant end memoize :diff - # Return colorized source diff + # Return colorized source diff # # @return [String] # @@ -40,7 +40,7 @@ module Mutant # Initialize differ object # - # @param [String] old + # @param [String] old # @param [String] new # # @return [undefined] @@ -109,4 +109,3 @@ module Mutant end end end - diff --git a/lib/mutant/killer.rb b/lib/mutant/killer.rb index b7da07b1..d56f31fb 100644 --- a/lib/mutant/killer.rb +++ b/lib/mutant/killer.rb @@ -32,7 +32,7 @@ module Mutant @strategy, @mutation = strategy, mutation run_with_benchmark end - + # Test for kill failure # # @return [true] @@ -92,7 +92,7 @@ module Mutant start_time = Time.now @killed = run end_time = Time.now - @runtime = end_time - start_time + @runtime = end_time - start_time end # Run killer diff --git a/lib/mutant/killer/forked.rb b/lib/mutant/killer/forked.rb index 5056e1fb..fe839d04 100644 --- a/lib/mutant/killer/forked.rb +++ b/lib/mutant/killer/forked.rb @@ -21,7 +21,7 @@ module Mutant # Run killer # - # @return [true] + # @return [true] # if mutant was killed # # @return [false] diff --git a/lib/mutant/killer/rspec.rb b/lib/mutant/killer/rspec.rb index 91c40495..efb05908 100644 --- a/lib/mutant/killer/rspec.rb +++ b/lib/mutant/killer/rspec.rb @@ -8,7 +8,7 @@ module Mutant # Run rspec test # # @return [true] - # when test is NOT successful + # when test is NOT successful # # @return [false] # otherwise diff --git a/lib/mutant/matcher/method.rb b/lib/mutant/matcher/method.rb index 88e8fafe..058eb476 100644 --- a/lib/mutant/matcher/method.rb +++ b/lib/mutant/matcher/method.rb @@ -4,7 +4,7 @@ module Mutant class Method < self include Adamantium::Flat, Equalizer.new(:identification) - # Methods within rbx kernel directory are precompiled and their source + # Methods within rbx kernel directory are precompiled and their source # cannot be accessed via reading source location BLACKLIST = /\Akernel\//.freeze @@ -17,7 +17,7 @@ module Mutant # returns self when block given # # @api private - # + # def each(&block) return to_enum unless block_given? diff --git a/lib/mutant/matcher/method/instance.rb b/lib/mutant/matcher/method/instance.rb index 36e4b3b5..278dfa19 100644 --- a/lib/mutant/matcher/method/instance.rb +++ b/lib/mutant/matcher/method/instance.rb @@ -1,6 +1,6 @@ module Mutant class Matcher - class Method + class Method # Matcher for instance methods class Instance < self SUBJECT_CLASS = Subject::Method::Instance diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index 3d10651e..c70166b8 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -32,8 +32,8 @@ module Mutant # def match?(node) node.class == Rubinius::AST::DefineSingleton && - line?(node) && - name?(node) && + line?(node) && + name?(node) && receiver?(node) end @@ -66,7 +66,7 @@ module Mutant # @api private # def name?(node) - node.body.name == method_name + node.body.name == method_name end # Test for receiver match diff --git a/lib/mutant/matcher/methods.rb b/lib/mutant/matcher/methods.rb index a1353ace..a06fa79e 100644 --- a/lib/mutant/matcher/methods.rb +++ b/lib/mutant/matcher/methods.rb @@ -1,6 +1,6 @@ module Mutant class Matcher - # Abstract base class for matcher that returns method subjects extracted from scope + # Abstract base class for matcher that returns method subjects extracted from scope class Methods < self include AbstractType, Equalizer.new(:scope) @@ -29,7 +29,7 @@ module Mutant # @return [self] # if block given # - # @return [Enumerator] + # @return [Enumerator] # otherwise # # @api private @@ -99,7 +99,7 @@ module Mutant # Return method names # - # @return [Enumerable] + # @return [Enumerable] # # @api private # diff --git a/lib/mutant/matcher/namespace.rb b/lib/mutant/matcher/namespace.rb index 5696406c..b96d42a5 100644 --- a/lib/mutant/matcher/namespace.rb +++ b/lib/mutant/matcher/namespace.rb @@ -36,7 +36,7 @@ module Mutant private - # Initialize object space matcher + # Initialize object space matcher # # @param [Class, Module] namespace # @@ -96,8 +96,8 @@ module Mutant # @api private # def emit_scope(scope) - if pattern =~ scope.name - yield scope + if pattern =~ scope.name + yield scope end end end diff --git a/lib/mutant/mutation/filter.rb b/lib/mutant/mutation/filter.rb index 115e8a09..16986042 100644 --- a/lib/mutant/mutation/filter.rb +++ b/lib/mutant/mutation/filter.rb @@ -32,7 +32,7 @@ module Mutant # @api private # def self.build(notation) - descendants.each do |descendant| + descendants.each do |descendant| filter = descendant.handle(notation) return filter if filter end diff --git a/lib/mutant/mutation/filter/code.rb b/lib/mutant/mutation/filter/code.rb index 0e72ab0c..8eb35fef 100644 --- a/lib/mutant/mutation/filter/code.rb +++ b/lib/mutant/mutation/filter/code.rb @@ -1,6 +1,6 @@ module Mutant class Mutation - class Filter + class Filter # Mutation filter that filters on mutation codes class Code < self include Equalizer.new(:code) @@ -36,7 +36,7 @@ module Mutant # @api private # def self.handle(notation) - match = PATTERN.match(notation) + match = PATTERN.match(notation) return unless match new(match[1]) end diff --git a/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb b/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb index 027d76f5..73a1f48b 100644 --- a/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb +++ b/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb @@ -23,7 +23,7 @@ module Mutant mutation.defaults = nil end mutation - end + end end end diff --git a/lib/mutant/mutator/node/if.rb b/lib/mutant/mutator/node/if.rb index 558e4aa7..34f751d0 100644 --- a/lib/mutant/mutator/node/if.rb +++ b/lib/mutant/mutator/node/if.rb @@ -18,7 +18,7 @@ module Mutant emit_attribute_mutations(:condition) emit_attribute_mutations(:body) unless nil_literal?(:body) emit_attribute_mutations(:else) unless nil_literal?(:else) - emit_inverted_condition + emit_inverted_condition emit_deleted_if_branch emit_deleted_else_branch emit_true_if_branch @@ -43,7 +43,7 @@ module Mutant # Emit inverted condition # - # Especially the same like swap branches but more universal as it also + # Especially the same like swap branches but more universal as it also # covers the case there is no else branch # # @return [undefined] diff --git a/lib/mutant/mutator/node/noop.rb b/lib/mutant/mutator/node/noop.rb index 9944abc4..2e3a3bef 100644 --- a/lib/mutant/mutator/node/noop.rb +++ b/lib/mutant/mutator/node/noop.rb @@ -10,7 +10,7 @@ module Mutant # Currently unhandled node classes. Feel free to contribute your mutator! # # FIXME: This list is mixed with some 1.8 only nodes that should be extracted - # + # %w( ZSuper ElementAssignment @@ -50,7 +50,7 @@ module Mutant ).each do |name| handle(Rubinius::AST.const_get(name)) end - + private # Emit mutations diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 630b48ef..d0ad501c 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -16,14 +16,14 @@ module Mutant # @api private # def dispatch - emit_receiver + emit_receiver emit_implicit_self_receiver emit_receiver_mutations emit_block_mutations emit_block_absence_mutation end - # Emit receiver + # Emit receiver # # @return [undefined] # @@ -52,7 +52,7 @@ module Mutant # @api private # def emit_receiver_mutations - emit_attribute_mutations(:receiver) + emit_attribute_mutations(:receiver) end # Emit block absence mutation @@ -102,11 +102,11 @@ module Mutant end # Emit mutation that replaces explicit send to self with implicit send to self - # + # # @example: # # # This class does use Foo#a with explicitly specifing the receiver self. - # # But an implicit (privately) call should be used as there is no need for + # # But an implicit (privately) call should be used as there is no need for # # specifing en explicit receiver. # # class Foo # Mutation diff --git a/lib/mutant/mutator/node/send/with_arguments.rb b/lib/mutant/mutator/node/send/with_arguments.rb index 77c7f69e..de5ef57c 100644 --- a/lib/mutant/mutator/node/send/with_arguments.rb +++ b/lib/mutant/mutator/node/send/with_arguments.rb @@ -5,7 +5,7 @@ module Mutant # Mutator for send with arguments class WithArguments < self - + handle(Rubinius::AST::SendWithArguments) private diff --git a/lib/mutant/mutator/node/super.rb b/lib/mutant/mutator/node/super.rb index a99553df..9e2f7275 100644 --- a/lib/mutant/mutator/node/super.rb +++ b/lib/mutant/mutator/node/super.rb @@ -18,7 +18,7 @@ module Mutant emit_node(Rubinius::AST::ZSuper) emit_without_block emit_attribute_mutations(:block) if node.block - emit_attribute_mutations(:arguments) + emit_attribute_mutations(:arguments) end # Emit without block mutation diff --git a/lib/mutant/mutator/util/array.rb b/lib/mutant/mutator/util/array.rb index 7f9c7072..c1a7264e 100644 --- a/lib/mutant/mutator/util/array.rb +++ b/lib/mutant/mutator/util/array.rb @@ -34,7 +34,7 @@ module Mutant private # Emit mutations - # + # # @return [undefined] # # @api private @@ -54,7 +54,7 @@ module Mutant private # Emit mutations - # + # # @return [undefined] # # @api private diff --git a/lib/mutant/reporter/cli.rb b/lib/mutant/reporter/cli.rb index 4890b657..a9720080 100644 --- a/lib/mutant/reporter/cli.rb +++ b/lib/mutant/reporter/cli.rb @@ -118,14 +118,14 @@ module Mutant self end - private + private # Return IO stream # # @return [IO] # # @api private - # + # attr_reader :io # Test for colored output @@ -200,7 +200,7 @@ module Mutant # # @return [true] # returns true if output is a tty - # + # # @return [false] # returns false otherwise # diff --git a/lib/mutant/reporter/stats.rb b/lib/mutant/reporter/stats.rb index 70904c7d..73a6595b 100644 --- a/lib/mutant/reporter/stats.rb +++ b/lib/mutant/reporter/stats.rb @@ -61,7 +61,7 @@ module Mutant protected - # Return counts + # Return counts # # @return [Hash] # @@ -77,7 +77,7 @@ module Mutant # attr_reader :start - # Return killers + # Return killers # # @return [Hash] # @@ -123,7 +123,7 @@ module Mutant self end - # Test for errors + # Test for errors # # @return [true] # if there are errors diff --git a/lib/mutant/runner.rb b/lib/mutant/runner.rb index 9ccf73bf..2aa463c5 100644 --- a/lib/mutant/runner.rb +++ b/lib/mutant/runner.rb @@ -48,7 +48,7 @@ module Mutant # otherwise # # @api private - # + # abstract_method :success? private diff --git a/lib/mutant/strategy.rb b/lib/mutant/strategy.rb index 62b57b8f..eaada14d 100644 --- a/lib/mutant/strategy.rb +++ b/lib/mutant/strategy.rb @@ -1,7 +1,7 @@ module Mutant # Abstract base class for killing strategies - class Strategy + class Strategy include AbstractType, Adamantium::Flat, Equalizer.new # Return config diff --git a/lib/mutant/strategy/rspec/dm2/lookup.rb b/lib/mutant/strategy/rspec/dm2/lookup.rb index 21e94662..9f6f77c3 100644 --- a/lib/mutant/strategy/rspec/dm2/lookup.rb +++ b/lib/mutant/strategy/rspec/dm2/lookup.rb @@ -3,7 +3,7 @@ module Mutant class Rspec class DM2 - # Example lookup for the rspec dm2 + # Example lookup for the rspec dm2 class Lookup include AbstractType, Adamantium::Flat, Equalizer.new(:subject) @@ -64,7 +64,7 @@ module Mutant # # @param [Subjecŧ] subject # - # @return [Lookup] + # @return [Lookup] # # @api private # diff --git a/lib/mutant/subject.rb b/lib/mutant/subject.rb index cb7f0a1f..220c1e2d 100644 --- a/lib/mutant/subject.rb +++ b/lib/mutant/subject.rb @@ -85,7 +85,7 @@ module Mutant # @return [Source] # # @api private - # + # def source ToSource.to_source(node) end diff --git a/lib/mutant/subject/method.rb b/lib/mutant/subject/method.rb index 8c980a82..1f5b50ad 100644 --- a/lib/mutant/subject/method.rb +++ b/lib/mutant/subject/method.rb @@ -70,7 +70,7 @@ module Mutant end # Singleton method subjects - class Singleton < self + class Singleton < self # Test if method is public # diff --git a/spec/integration/mutant/method_matching_spec.rb b/spec/integration/mutant/method_matching_spec.rb index 8e6eb03c..2fc9af54 100644 --- a/spec/integration/mutant/method_matching_spec.rb +++ b/spec/integration/mutant/method_matching_spec.rb @@ -19,7 +19,7 @@ describe Mutant, 'method matching' do let(:method_arity) { values.fetch(:method_arity) } let(:scope) { values.fetch(:scope) } let(:node_class) { values.fetch(:node_class) } - + let(:node) { mutation_subject.node } let(:context) { mutation_subject.context } let(:mutation_subject) { subject.first } diff --git a/spec/support/ice_nine_config.rb b/spec/support/ice_nine_config.rb index 5e077e59..cc738345 100644 --- a/spec/support/ice_nine_config.rb +++ b/spec/support/ice_nine_config.rb @@ -6,4 +6,3 @@ module IceNine end end end - diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb index 67a60cec..a495f2de 100644 --- a/spec/support/rspec.rb +++ b/spec/support/rspec.rb @@ -8,7 +8,7 @@ module Rspec # @api private # def self.nest - original_world, original_configuration = + original_world, original_configuration = ::RSpec.instance_variable_get(:@world), ::RSpec.instance_variable_get(:@configuration) diff --git a/spec/support/zombie.rb b/spec/support/zombie.rb index 91f644fa..d87a2fcb 100644 --- a/spec/support/zombie.rb +++ b/spec/support/zombie.rb @@ -151,7 +151,7 @@ module Zombie # # @api private # - # FIXME: + # FIXME: # Yeah looks very ugly but im currently to exited to do a cleanup. # def self.files diff --git a/spec/unit/mutant/cli/class_methods/new_spec.rb b/spec/unit/mutant/cli/class_methods/new_spec.rb index 82b8942b..bf04ff9f 100644 --- a/spec/unit/mutant/cli/class_methods/new_spec.rb +++ b/spec/unit/mutant/cli/class_methods/new_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' shared_examples_for 'an invalid cli run' do it 'should raise error' do - expect { subject }.to raise_error(Mutant::CLIParser::Error, expected_message) + expect { subject }.to raise_error(Mutant::CLIParser::Error, expected_message) end end @@ -61,7 +61,7 @@ describe Mutant::CLI, '.new' do context 'with code filter and missing argument' do let(:arguments) { %w(--rspec-unit --code) } - let(:expected_message) { '"--code" is missing an argument' } + let(:expected_message) { '"--code" is missing an argument' } it_should_behave_like 'an invalid cli run' end diff --git a/spec/unit/mutant/cli/class_methods/run_spec.rb b/spec/unit/mutant/cli/class_methods/run_spec.rb index 02d8095c..1e8278df 100644 --- a/spec/unit/mutant/cli/class_methods/run_spec.rb +++ b/spec/unit/mutant/cli/class_methods/run_spec.rb @@ -10,7 +10,7 @@ describe Mutant::CLI, '.run' do let(:config) { mock('Config') } let(:instance) { mock(described_class.name, :config => config) } - before do + before do described_class.stub(:new => instance) Mutant::Runner::Config.stub(:run => runner) end diff --git a/spec/unit/mutant/context/scope/root_spec.rb b/spec/unit/mutant/context/scope/root_spec.rb index c7655c07..b1d49553 100644 --- a/spec/unit/mutant/context/scope/root_spec.rb +++ b/spec/unit/mutant/context/scope/root_spec.rb @@ -5,7 +5,7 @@ describe Mutant::Context::Scope, '#root' do let(:object) { described_class.new(TestApp::Literal, path) } let(:path) { mock('Path') } - let(:node) { ':node'.to_ast } + let(:node) { ':node'.to_ast } let(:scope) { subject.body } let(:scope_body) { scope.body } diff --git a/spec/unit/mutant/killer/success_predicate_spec.rb b/spec/unit/mutant/killer/success_predicate_spec.rb index 829d3400..c606e99b 100644 --- a/spec/unit/mutant/killer/success_predicate_spec.rb +++ b/spec/unit/mutant/killer/success_predicate_spec.rb @@ -12,7 +12,7 @@ describe Mutant::Killer, '#success?' do kill_state.stub(:freeze => kill_state, :dup => kill_state) end - let(:class_under_test) do + let(:class_under_test) do Class.new(described_class) do def run end diff --git a/spec/unit/mutant/matcher/chain/each_spec.rb b/spec/unit/mutant/matcher/chain/each_spec.rb index f59926bc..6ca1f593 100644 --- a/spec/unit/mutant/matcher/chain/each_spec.rb +++ b/spec/unit/mutant/matcher/chain/each_spec.rb @@ -12,7 +12,7 @@ describe Mutant::Matcher::Chain, '#each' do let(:subject_a) { mock('Subject A') } let(:subject_b) { mock('Subject B') } - + before do matcher_a.stub(:each).and_yield(subject_a).and_return(matcher_a) matcher_b.stub(:each).and_yield(subject_b).and_return(matcher_b) diff --git a/spec/unit/mutant/matcher/chain/matchers_spec.rb b/spec/unit/mutant/matcher/chain/matchers_spec.rb index 3e5e43a3..a9c35ed2 100644 --- a/spec/unit/mutant/matcher/chain/matchers_spec.rb +++ b/spec/unit/mutant/matcher/chain/matchers_spec.rb @@ -4,7 +4,7 @@ describe Mutant::Matcher::Chain, '#matchers' do subject { object.matchers } let(:object) { described_class.new(matchers) } - let(:matchers) { mock('Matchers') } + let(:matchers) { mock('Matchers') } it { should be(matchers) } diff --git a/spec/unit/mutant/mutator/node/define/mutation_spec.rb b/spec/unit/mutant/mutator/node/define/mutation_spec.rb index a70d0280..4e063e9e 100644 --- a/spec/unit/mutant/mutator/node/define/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/define/mutation_spec.rb @@ -70,7 +70,7 @@ describe Mutant::Mutator, 'define' do Mutant::Random.stub(:hex_string => 'random') end - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'def foo(a); end' mutations << 'def foo(); end' @@ -90,9 +90,9 @@ describe Mutant::Mutator, 'define' do mutations = [] # Body presence mutations - mutations << 'def self.foo; bar; self.baz; end' - mutations << 'def self.foo; self.bar; baz; end' - + mutations << 'def self.foo; bar; self.baz; end' + mutations << 'def self.foo; self.bar; baz; end' + # Body presence mutations mutations << 'def self.foo; self.bar; end' mutations << 'def self.foo; self.baz; end' diff --git a/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb b/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb index 0da533f4..a22eaf05 100644 --- a/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb @@ -20,12 +20,12 @@ describe Mutant::Mutator, 'if statement' do mutants << 'if self.condition; false end' # mutations of body - mutants << 'if self.condition; false; else false; end' - mutants << 'if self.condition; nil; else false; end' + mutants << 'if self.condition; false; else false; end' + mutants << 'if self.condition; nil; else false; end' # mutations of else body - mutants << 'if self.condition; true; else true; end' - mutants << 'if self.condition; true; else nil; end' + mutants << 'if self.condition; true; else true; end' + mutants << 'if self.condition; true; else nil; end' # mutation of condition to always be true mutants << 'if true; true; else false; end' diff --git a/spec/unit/mutant/mutator/node/literal/hash_spec.rb b/spec/unit/mutant/mutator/node/literal/hash_spec.rb index 29da7553..6e25b4e9 100644 --- a/spec/unit/mutant/mutator/node/literal/hash_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/hash_spec.rb @@ -20,8 +20,8 @@ describe Mutant::Mutator::Node::Literal, 'hash' do mutations << '{ true => true , false => nil }' # Remove each key once - mutations << '{ true => true }' - mutations << '{ false => false }' + mutations << '{ true => true }' + mutations << '{ false => false }' # Empty hash mutations << '{}' diff --git a/spec/unit/mutant/mutator/node/send/mutation_spec.rb b/spec/unit/mutant/mutator/node/send/mutation_spec.rb index 254f889c..066ceb04 100644 --- a/spec/unit/mutant/mutator/node/send/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/send/mutation_spec.rb @@ -16,7 +16,7 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] # with implicit receiver (send privately) - mutations << 'foo' + mutations << 'foo' end it_should_behave_like 'a mutator' @@ -58,7 +58,7 @@ describe Mutant::Mutator, 'send' do context 'with block' do let(:source) { 'foo() { a; b }' } - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'foo() { a }' mutations << 'foo() { b }' @@ -77,7 +77,7 @@ describe Mutant::Mutator, 'send' do Mutant::Random.stub(:hex_string => :random) end - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'foo' mutations << 'foo { |a, b| Object.new }' @@ -99,7 +99,7 @@ describe Mutant::Mutator, 'send' do let(:source) { 'foo { |(a, b), c| }' } - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'foo { || }' mutations << 'foo { |a, b, c| }' @@ -120,7 +120,7 @@ describe Mutant::Mutator, 'send' do context 'one argument' do let(:source) { 'foo(nil)' } - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'foo' mutations << 'nil' @@ -133,7 +133,7 @@ describe Mutant::Mutator, 'send' do context 'with explicit self as receiver' do let(:source) { 'self.foo(nil)' } - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'self.foo' mutations << 'foo(nil)' @@ -149,7 +149,7 @@ describe Mutant::Mutator, 'send' do context "with keyword #{keyword}" do let(:source) { "foo.#{keyword}(nil)" } - let(:mutations) do + let(:mutations) do mutations = [] mutations << "foo.#{keyword}" mutations << "foo" @@ -166,7 +166,7 @@ describe Mutant::Mutator, 'send' do Mutant::BINARY_METHOD_OPERATORS.each do |operator| let(:source) { "true #{operator} false" } - let(:mutations) do + let(:mutations) do mutations = [] mutations << "((false) #{operator} (false))" mutations << "((nil) #{operator} (false))" @@ -183,7 +183,7 @@ describe Mutant::Mutator, 'send' do context 'two arguments' do let(:source) { 'foo(nil, nil)' } - let(:mutations) do + let(:mutations) do mutations = [] mutations << 'foo()' mutations << 'foo(nil)' diff --git a/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb b/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb index 2201b4d3..1a15269c 100644 --- a/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +++ b/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Mutant::Strategy::MethodExpansion, '.run' do +describe Mutant::Strategy::MethodExpansion, '.run' do subject { object.run(name) } let(:object) { described_class } diff --git a/test_app/spec/shared/method_filter_parse_behavior.rb b/test_app/spec/shared/method_filter_parse_behavior.rb index 7a80294e..f4876032 100644 --- a/test_app/spec/shared/method_filter_parse_behavior.rb +++ b/test_app/spec/shared/method_filter_parse_behavior.rb @@ -12,5 +12,3 @@ shared_examples_for 'a method filter parse result' do subject end end - - diff --git a/test_app/spec/shared/method_match_behavior.rb b/test_app/spec/shared/method_match_behavior.rb index 7257e7ac..97347e46 100644 --- a/test_app/spec/shared/method_match_behavior.rb +++ b/test_app/spec/shared/method_match_behavior.rb @@ -8,7 +8,7 @@ shared_examples_for 'a method match' do let(:method_arity) { values.fetch(:method_arity) } let(:scope) { values.fetch(:scope) } let(:node_class) { values.fetch(:node_class) } - + let(:node) { mutation_subject.node } let(:context) { mutation_subject.context } let(:mutation_subject) { subject.first }