From cc69582cb2078033a947e3612a143a29009a1dfa Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Tue, 27 May 2014 15:12:36 +0000 Subject: [PATCH 1/2] Consolidate ruby style --- config/rubocop.yml | 13 +++++++++++ lib/mutant-rspec.rb | 7 ------ lib/mutant/cli.rb | 4 ++-- lib/mutant/cli/classifier.rb | 2 +- lib/mutant/constants.rb | 18 +++++++-------- lib/mutant/matcher/method.rb | 2 +- lib/mutant/matcher/method/singleton.rb | 2 +- lib/mutant/matcher/null.rb | 2 +- lib/mutant/mutator/node/arguments.rb | 2 +- lib/mutant/mutator/node/send.rb | 2 +- lib/mutant/reporter/cli/printer.rb | 4 ++-- lib/mutant/reporter/cli/report/config.rb | 14 ++++++------ lib/mutant/rspec.rb | 4 ++++ lib/mutant/rspec/strategy.rb | 2 +- lib/mutant/strategy.rb | 2 -- lib/mutant/subject/method/instance.rb | 2 -- lib/mutant/zombifier.rb | 6 ++--- lib/mutant/zombifier/file.rb | 2 +- mutant-rspec.gemspec | 2 +- spec/integration/mutant/corpus_spec.rb | 21 +++++++++++------- spec/integration/mutant/zombie_spec.rb | 2 +- spec/unit/mutant/cli_new_spec.rb | 20 ++++++++--------- spec/unit/mutant/diff_spec.rb | 22 +++++++++---------- .../mutant/matcher/method/instance_spec.rb | 7 +++--- .../mutant/matcher/method/singleton_spec.rb | 3 ++- .../mutator/node/literal/boolean_spec.rb | 4 ++-- .../mutator/node/literal/fixnum_spec.rb | 2 +- .../mutator/node/literal/string_spec.rb | 2 +- .../mutator/node/literal/symbol_spec.rb | 2 +- test_app/lib/test_app/literal.rb | 2 +- 30 files changed, 96 insertions(+), 83 deletions(-) delete mode 100644 lib/mutant-rspec.rb diff --git a/config/rubocop.yml b/config/rubocop.yml index 565c990e..19e2bfed 100644 --- a/config/rubocop.yml +++ b/config/rubocop.yml @@ -30,6 +30,19 @@ CollectionMethods: find: 'detect' find_all: 'select' +# Use square brackets for literal Array objects +PercentLiteralDelimiters: + PreferredDelimiters: + '%': () + '%i': '[]' + '%q': () + '%Q': () + '%r': '{}' + '%s': () + '%w': '[]' + '%W': '[]' + '%x': () + MethodLength: CountComments: false Max: 17 # TODO: Bring down to 10 diff --git a/lib/mutant-rspec.rb b/lib/mutant-rspec.rb deleted file mode 100644 index 67588bbd..00000000 --- a/lib/mutant-rspec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# encoding: UTF-8 - -require 'rspec' - -require 'mutant/rspec' -require 'mutant/rspec/strategy' -require 'mutant/rspec/test' diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 701c9043..4f2e3a92 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -285,7 +285,7 @@ module Mutant # @api private # def use(name) - require "mutant-#{name}" + require "mutant/#{name}" @strategy = Strategy.lookup(name).new rescue LoadError $stderr.puts("Cannot load plugin: #{name.inspect}") @@ -339,7 +339,7 @@ module Mutant def add_debug_options(opts) opts.on('--fail-fast', 'Fail fast') do @fail_fast = true - end.on('--version', 'Print mutants version') do |name| + end.on('--version', 'Print mutants version') do puts("mutant-#{Mutant::VERSION}") Kernel.exit(0) end.on('-d', '--debug', 'Enable debugging output') do diff --git a/lib/mutant/cli/classifier.rb b/lib/mutant/cli/classifier.rb index af8a3563..bb57fb29 100644 --- a/lib/mutant/cli/classifier.rb +++ b/lib/mutant/cli/classifier.rb @@ -132,7 +132,7 @@ module Mutant # @api private # abstract_method :matcher - private :matcher + private :matcher end # Classifier end # CLI diff --git a/lib/mutant/constants.rb b/lib/mutant/constants.rb index 60b01f38..f5bc94f2 100644 --- a/lib/mutant/constants.rb +++ b/lib/mutant/constants.rb @@ -5,20 +5,20 @@ module Mutant symbolset = ->(strings) { strings.map(&:to_sym).to_set.freeze } # Set of nodes that cannot be on the LHS of an assignment - NOT_ASSIGNABLE = symbolset.(%w(int float str dstr class module self)) + NOT_ASSIGNABLE = symbolset.(%w[int float str dstr class module self]) # Set of op-assign types - OP_ASSIGN = symbolset.call(%w(or_asgn and_asgn op_asgn)) + OP_ASSIGN = symbolset.call(%w[or_asgn and_asgn op_asgn]) # Set of node types that are not valid when emitted standalone - NOT_STANDALONE = symbolset.(%w( splat restarg block_pass)) - INDEX_OPERATORS = symbolset.(%w([] []=)) - UNARY_METHOD_OPERATORS = symbolset.(%w(~@ +@ -@ !)) + NOT_STANDALONE = symbolset.(%w[ splat restarg block_pass]) + INDEX_OPERATORS = symbolset.(%w[[] []=]) + UNARY_METHOD_OPERATORS = symbolset.(%w[~@ +@ -@ !]) # Operators ruby implementeds as methods - METHOD_OPERATORS = symbolset.(%w( + METHOD_OPERATORS = symbolset.(%w[ <=> === []= [] <= >= == !~ != =~ << >> ** * % / | ^ & < > + - ~@ +@ -@ ! - )) + ]) BINARY_METHOD_OPERATORS = ( METHOD_OPERATORS - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS) @@ -32,10 +32,10 @@ module Mutant # # not - 1.8 only, mutant does not support 1.8 # - NODE_BLACKLIST = symbolset.(%w(not)) + NODE_BLACKLIST = symbolset.(%w[not]) # Nodes that are NOT generated by parser but used by mutant / unparser. - NODE_EXTRA = symbolset.(%w(empty)) + NODE_EXTRA = symbolset.(%w[empty]) NODE_TYPES = ((Parser::Meta::NODE_TYPES + NODE_EXTRA) - NODE_BLACKLIST).to_set.freeze diff --git a/lib/mutant/matcher/method.rb b/lib/mutant/matcher/method.rb index 5f9d5f23..7bca6fe9 100644 --- a/lib/mutant/matcher/method.rb +++ b/lib/mutant/matcher/method.rb @@ -46,7 +46,7 @@ module Mutant def skip? location = source_location if location.nil? || BLACKLIST.match(location.first) - message = sprintf( + message = format( '%s does not have valid source location unable to emit matcher', method.inspect ) diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index 46e4e8a9..600bd3ef 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -94,7 +94,7 @@ module Mutant when :const receiver_name?(receiver) else - message = sprintf( + message = format( 'Can only match :defs on :self or :const got %s unable to match', receiver.type.inspect ) diff --git a/lib/mutant/matcher/null.rb b/lib/mutant/matcher/null.rb index 0f0c8432..e6a2f3b9 100644 --- a/lib/mutant/matcher/null.rb +++ b/lib/mutant/matcher/null.rb @@ -16,7 +16,7 @@ module Mutant # # @api private # - def each(&block) + def each return to_enum unless block_given? self end diff --git a/lib/mutant/mutator/node/arguments.rb b/lib/mutant/mutator/node/arguments.rb index 0c853b4e..425afe58 100644 --- a/lib/mutant/mutator/node/arguments.rb +++ b/lib/mutant/mutator/node/arguments.rb @@ -43,7 +43,7 @@ module Mutant # @api private # def mlhs_childs_with_index - children.each_with_index.select do |child, index| + children.each_with_index.select do |child, _index| child.type == :mlhs end end diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 0552b4e0..04f3a189 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -145,7 +145,7 @@ module Mutant # def mutate_arguments emit_self(receiver, selector) - remaining_children_with_index.each do |node, index| + remaining_children_with_index.each do |_node, index| mutate_child(index) delete_child(index) end diff --git a/lib/mutant/reporter/cli/printer.rb b/lib/mutant/reporter/cli/printer.rb index 85dff4c4..967f3e4a 100644 --- a/lib/mutant/reporter/cli/printer.rb +++ b/lib/mutant/reporter/cli/printer.rb @@ -60,7 +60,7 @@ module Mutant # @api private # def info(string, *arguments) - puts(sprintf(string, *arguments)) + puts(format(string, *arguments)) end # Print a status line to output @@ -70,7 +70,7 @@ module Mutant # @api private # def status(string, *arguments) - puts(colorize(status_color, sprintf(string, *arguments))) + puts(colorize(status_color, format(string, *arguments))) end # Print a line to output diff --git a/lib/mutant/reporter/cli/report/config.rb b/lib/mutant/reporter/cli/report/config.rb index dc5a6c44..8da6db31 100644 --- a/lib/mutant/reporter/cli/report/config.rb +++ b/lib/mutant/reporter/cli/report/config.rb @@ -23,13 +23,13 @@ module Mutant # def run failed_subjects.each(&method(:visit)) - info 'Subjects: %s', amount_subjects - info 'Mutations: %s', amount_mutations - info 'Kills: %s', amount_kills - info 'Alive: %s', amount_alive - info 'Runtime: %0.2fs', runtime - info 'Killtime: %0.2fs', killtime - info 'Overhead: %0.2f%%', overhead + info 'Subjects: %s', amount_subjects + info 'Mutations: %s', amount_mutations + info 'Kills: %s', amount_kills + info 'Alive: %s', amount_alive + info 'Runtime: %0.2fs', runtime + info 'Killtime: %0.2fs', killtime + info 'Overhead: %0.2f%%', overhead status 'Coverage: %0.2f%%', coverage status 'Expected: %0.2f%%', object.config.expected_coverage print_generic_stats diff --git a/lib/mutant/rspec.rb b/lib/mutant/rspec.rb index 45b9e8cf..b8e29f58 100644 --- a/lib/mutant/rspec.rb +++ b/lib/mutant/rspec.rb @@ -5,3 +5,7 @@ module Mutant module Rspec end # Rspec end # Mutant + +require 'mutant/rspec' +require 'mutant/rspec/strategy' +require 'mutant/rspec/test' diff --git a/lib/mutant/rspec/strategy.rb b/lib/mutant/rspec/strategy.rb index cc3c37ee..5bfa9585 100644 --- a/lib/mutant/rspec/strategy.rb +++ b/lib/mutant/rspec/strategy.rb @@ -125,7 +125,7 @@ module Mutant # @api private # def options - options = RSpec::Core::ConfigurationOptions.new(%w(--fail-fast spec)) + options = RSpec::Core::ConfigurationOptions.new(%w[--fail-fast spec]) options.parse_options if rspec2? options end diff --git a/lib/mutant/strategy.rb b/lib/mutant/strategy.rb index be177c6d..78a417f5 100644 --- a/lib/mutant/strategy.rb +++ b/lib/mutant/strategy.rb @@ -83,8 +83,6 @@ module Mutant [] end - private - # Null strategy that never kills a mutation class Null < self diff --git a/lib/mutant/subject/method/instance.rb b/lib/mutant/subject/method/instance.rb index 9d9826e6..2d7ac2d0 100644 --- a/lib/mutant/subject/method/instance.rb +++ b/lib/mutant/subject/method/instance.rb @@ -43,8 +43,6 @@ module Mutant self end - private - # Mutator for memoized instance methods class Memoized < self include NodeHelpers diff --git a/lib/mutant/zombifier.rb b/lib/mutant/zombifier.rb index 02b44f39..32d4225a 100644 --- a/lib/mutant/zombifier.rb +++ b/lib/mutant/zombifier.rb @@ -6,16 +6,16 @@ module Mutant include Adamantium::Flat, Concord.new(:namespace) # Excluded into zombification - includes = %w( + includes = %w[ mutant morpher adamantium equalizer anima concord - ) + ] - INCLUDES = %r(\A#{Regexp.union(includes)}(?:/.*)?\z).freeze + INCLUDES = %r{\A#{Regexp.union(includes)}(?:/.*)?\z}.freeze # Initialize object # diff --git a/lib/mutant/zombifier/file.rb b/lib/mutant/zombifier/file.rb index 9cc97f60..33412d5e 100644 --- a/lib/mutant/zombifier/file.rb +++ b/lib/mutant/zombifier/file.rb @@ -11,7 +11,7 @@ module Mutant # @api private # def zombify(namespace) - $stderr.puts("Zombifying #{path.to_s}") + $stderr.puts("Zombifying #{path}") eval( Unparser.unparse(namespaced_node(namespace)), TOPLEVEL_BINDING, diff --git a/mutant-rspec.gemspec b/mutant-rspec.gemspec index 30d89d85..86b856ea 100644 --- a/mutant-rspec.gemspec +++ b/mutant-rspec.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.require_paths = %w[lib] - gem.files = `git ls-files -- lib/mutant{-,/}rspec.rb lib/mutant/rspec`.split("\n") + gem.files = `git ls-files -- lib/mutant/rspec.rb lib/mutant/rspec`.split("\n") gem.test_files = `git ls-files -- spec/{unit/mutant/rspec,integration/rspec}`.split("\n") gem.extra_rdoc_files = %w[TODO LICENSE] diff --git a/spec/integration/mutant/corpus_spec.rb b/spec/integration/mutant/corpus_spec.rb index efca235b..656630cf 100644 --- a/spec/integration/mutant/corpus_spec.rb +++ b/spec/integration/mutant/corpus_spec.rb @@ -23,13 +23,14 @@ describe 'Mutant on ruby corpus' do # @raise [Exception] # otherwise # + # rubocop:disable MethodLength def verify checkout total = 0 parse_errors = [] start = Time.now Pathname.glob(repo_path.join('**/*.rb')).sort.each do |path| - puts "Generating mutations for: #{path.to_s}" + puts "Generating mutations for: #{path}" begin node = Parser::CurrentRuby.parse(path.read) # Ignore known parser bugs @@ -39,7 +40,7 @@ describe 'Mutant on ruby corpus' do end next if node.nil? count = 0 - Mutant::Mutator::Node.each(node) do |mutant| + Mutant::Mutator::Node.each(node) do count += 1 if (count % 1000).zero? puts count @@ -49,9 +50,13 @@ describe 'Mutant on ruby corpus' do total += count end took = Time.now - start - puts "Total Mutations/Time/Parse-Errors: %s/%0.2fs/%i - %0.2f/s" % [ - total, took, parse_errors.size, total / took - ] + puts format( + 'Total Mutations/Time/Parse-Errors: %s/%0.2fs/%i - %0.2f/s', + total, + took, + parse_errors.size, + total / took + ) if parse_errors.any? puts 'Files with parse errors:' parse_errors.each(&method(:puts)) @@ -69,11 +74,11 @@ describe 'Mutant on ruby corpus' do TMP.mkdir unless TMP.directory? if repo_path.exist? Dir.chdir(repo_path) do - system(%w(git pull origin master)) - system(%w(git clean -f -d -x)) + system(%w[git pull origin master]) + system(%w[git clean -f -d -x]) end else - system(%W(git clone #{repo_uri} #{repo_path})) + system(%W[git clone #{repo_uri} #{repo_path}]) end self end diff --git a/spec/integration/mutant/zombie_spec.rb b/spec/integration/mutant/zombie_spec.rb index 97fffbcc..f7c84e1a 100644 --- a/spec/integration/mutant/zombie_spec.rb +++ b/spec/integration/mutant/zombie_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' describe 'as a zombie' do specify 'it allows to create zombie from mutant' do - expect { Mutant.zombify }.to change { !!defined?(Zombie) }.from(false).to(true) + expect { Mutant.zombify }.to change { defined?(Zombie) }.from(nil).to('constant') expect(Zombie.constants).to include(:Mutant) end end diff --git a/spec/unit/mutant/cli_new_spec.rb b/spec/unit/mutant/cli_new_spec.rb index b9005798..4b7a936f 100644 --- a/spec/unit/mutant/cli_new_spec.rb +++ b/spec/unit/mutant/cli_new_spec.rb @@ -15,7 +15,7 @@ shared_examples_for 'a cli parser' do it { expect(subject.strategy).to eql(expected_strategy) } it { expect(subject.reporter).to eql(expected_reporter) } - it { expect(subject.matcher).to eql(expected_matcher) } + it { expect(subject.matcher).to eql(expected_matcher) } end describe Mutant::CLI, '.new' do @@ -39,7 +39,7 @@ describe Mutant::CLI, '.new' do subject { cli } context 'with unknown flag' do - let(:arguments) { %w(--invalid) } + let(:arguments) { %w[--invalid] } let(:expected_message) { 'invalid option: --invalid' } @@ -47,7 +47,7 @@ describe Mutant::CLI, '.new' do end context 'with unknown option' do - let(:arguments) { %w(--invalid Foo) } + let(:arguments) { %w[--invalid Foo] } let(:expected_message) { 'invalid option: --invalid' } @@ -63,14 +63,14 @@ describe Mutant::CLI, '.new' do end context 'with code filter and missing argument' do - let(:arguments) { %w(--code) } + let(:arguments) { %w[--code] } let(:expected_message) { 'missing argument: --code' } it_should_behave_like 'an invalid cli run' end context 'with explicit method pattern' do - let(:arguments) { %w(TestApp::Literal#float) } + let(:arguments) { %w[TestApp::Literal#float] } let(:expected_matcher) do ns::Method::Instance.new(cache, TestApp::Literal, TestApp::Literal.instance_method(:float)) @@ -81,7 +81,7 @@ describe Mutant::CLI, '.new' do context 'with debug flag' do let(:pattern) { '::TestApp*' } - let(:arguments) { %W(--debug #{pattern}) } + let(:arguments) { %W[--debug #{pattern}] } let(:expected_matcher) { ns::Namespace.new(cache, TestApp) } it_should_behave_like 'a cli parser' @@ -93,7 +93,7 @@ describe Mutant::CLI, '.new' do context 'with zombie flag' do let(:pattern) { '::TestApp*' } - let(:arguments) { %W(--zombie #{pattern}) } + let(:arguments) { %W[--zombie #{pattern}] } let(:expected_matcher) { ns::Namespace.new(cache, TestApp) } it_should_behave_like 'a cli parser' @@ -104,8 +104,8 @@ describe Mutant::CLI, '.new' do end context 'with namespace pattern' do - let(:pattern) { '::TestApp*' } - let(:arguments) { %W(#{pattern}) } + let(:pattern) { '::TestApp*' } + let(:arguments) { [pattern] } let(:expected_matcher) { ns::Namespace.new(cache, TestApp) } it_should_behave_like 'a cli parser' @@ -113,7 +113,7 @@ describe Mutant::CLI, '.new' do context 'with subject code filter' do let(:pattern) { 'TestApp::Literal#float' } - let(:arguments) { %W(--code faa --code bbb #{pattern}) } + let(:arguments) { %W[--code faa --code bbb #{pattern}] } let(:expected_filter) do Morpher.evaluator( diff --git a/spec/unit/mutant/diff_spec.rb b/spec/unit/mutant/diff_spec.rb index eac09b3c..10759da3 100644 --- a/spec/unit/mutant/diff_spec.rb +++ b/spec/unit/mutant/diff_spec.rb @@ -12,7 +12,7 @@ describe Mutant::Diff do let(:old_string) { "foo\nbar" } let(:new_string) { "bar\nbaz" } - it { should eql(Mutant::Diff.new(%w(foo bar), %w(bar baz))) } + it { should eql(Mutant::Diff.new(%w[foo bar], %w[bar baz])) } end @@ -46,8 +46,8 @@ describe Mutant::Diff do subject { object.diff } context 'when there is a diff at begin of hunk' do - let(:old) { %w(foo bar) } - let(:new) { %w(baz bar) } + let(:old) { %w[foo bar] } + let(:new) { %w[baz bar] } let(:expectation) do strip_indent(<<-STR) @@ -64,8 +64,8 @@ describe Mutant::Diff do end context 'when there is a diff NOT at begin of hunk' do - let(:old) { %w(foo bar) } - let(:new) { %w(foo baz bar) } + let(:old) { %w[foo bar] } + let(:new) { %w[foo baz bar] } let(:expectation) do strip_indent(<<-STR) @@ -82,8 +82,8 @@ describe Mutant::Diff do end context 'when the diff has a long context at begin' do - let(:old) { %w(foo bar baz boz a b c) } - let(:new) { %w(foo bar baz boz a b c other) } + let(:old) { %w[foo bar baz boz a b c] } + let(:new) { %w[foo bar baz boz a b c other] } let(:expectation) do strip_indent(<<-STR) @@ -105,8 +105,8 @@ describe Mutant::Diff do end context 'when the diff has a long context at end, deleting' do - let(:old) { %w(other foo bar baz boz a b c) } - let(:new) { %w(foo bar baz boz a b c) } + let(:old) { %w[other foo bar baz boz a b c] } + let(:new) { %w[foo bar baz boz a b c] } let(:expectation) do strip_indent(<<-STR) @@ -128,8 +128,8 @@ describe Mutant::Diff do end context 'when the diff has a long context at end, inserting' do - let(:old) { %w(foo bar baz boz a b c) } - let(:new) { %w(other foo bar baz boz a b c) } + let(:old) { %w[foo bar baz boz a b c] } + let(:new) { %w[other foo bar baz boz a b c] } let(:expectation) do strip_indent(<<-STR) diff --git a/spec/unit/mutant/matcher/method/instance_spec.rb b/spec/unit/mutant/matcher/method/instance_spec.rb index b4e21d13..5cbe3a1a 100644 --- a/spec/unit/mutant/matcher/method/instance_spec.rb +++ b/spec/unit/mutant/matcher/method/instance_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' +# rubocop:disable ClassAndModuleChildren describe Mutant::Matcher::Method::Instance do let(:cache) { Fixtures::AST_CACHE } @@ -44,7 +45,7 @@ describe Mutant::Matcher::Method::Instance do def bar end - def bar(arg) + def bar(_arg) end end @@ -57,7 +58,7 @@ describe Mutant::Matcher::Method::Instance do context 'on the same line' do let(:base) { __LINE__ } class self::Foo - def bar; end; def bar(arg); end + def bar; end; def bar(_arg); end end let(:method_line) { 2 } @@ -69,7 +70,7 @@ describe Mutant::Matcher::Method::Instance do context 'on the same line with differend scope' do let(:base) { __LINE__ } class self::Foo - def self.bar; end; def bar(arg); end + def self.bar; end; def bar(_arg); end end let(:method_line) { 2 } diff --git a/spec/unit/mutant/matcher/method/singleton_spec.rb b/spec/unit/mutant/matcher/method/singleton_spec.rb index 940a049e..917ca1ad 100644 --- a/spec/unit/mutant/matcher/method/singleton_spec.rb +++ b/spec/unit/mutant/matcher/method/singleton_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' +# rubocop:disable ClassAndModuleChildren describe Mutant::Matcher::Method::Singleton, '#each' do subject { object.each { |subject| yields << subject } } @@ -80,7 +81,7 @@ describe Mutant::Matcher::Method::Singleton, '#each' do module Bar def self.baz end - def Foo.baz(arg) + def Foo.baz(_arg) end end end diff --git a/spec/unit/mutant/mutator/node/literal/boolean_spec.rb b/spec/unit/mutant/mutator/node/literal/boolean_spec.rb index 344e2bdb..4838923d 100644 --- a/spec/unit/mutant/mutator/node/literal/boolean_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/boolean_spec.rb @@ -7,7 +7,7 @@ describe Mutant::Mutator::Node::Literal, 'boolean' do let(:source) { 'true' } let(:mutations) do - %w(nil false) + %w[nil false] end it_should_behave_like 'a mutator' @@ -17,7 +17,7 @@ describe Mutant::Mutator::Node::Literal, 'boolean' do let(:source) { 'false' } let(:mutations) do - %w(nil true) + %w[nil true] end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb b/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb index bb199072..65577af4 100644 --- a/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb @@ -6,7 +6,7 @@ describe Mutant::Mutator::Node::Literal, 'fixnum' do let(:source) { '10' } let(:mutations) do - %W(nil 0 1 -10 9 11) + %w[nil 0 1 -10 9 11] end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/literal/string_spec.rb b/spec/unit/mutant/mutator/node/literal/string_spec.rb index 51ffd2fa..af2a41a5 100644 --- a/spec/unit/mutant/mutator/node/literal/string_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/string_spec.rb @@ -8,7 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'string' do let(:source) { '"foo"' } let(:mutations) do - %W(nil) + %w[nil] end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/literal/symbol_spec.rb b/spec/unit/mutant/mutator/node/literal/symbol_spec.rb index 31ced8fe..15ae73cd 100644 --- a/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/symbol_spec.rb @@ -8,7 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'symbol' do let(:source) { ':foo' } let(:mutations) do - %w(nil) << ':foo__mutant__' + %w[nil :foo__mutant__] end it_should_behave_like 'a mutator' diff --git a/test_app/lib/test_app/literal.rb b/test_app/lib/test_app/literal.rb index 691b3bca..0f54120a 100644 --- a/test_app/lib/test_app/literal.rb +++ b/test_app/lib/test_app/literal.rb @@ -7,7 +7,7 @@ module TestApp true end - def command(foo) + def command(_foo) self end From 7ea71b5f93541edfb633e781f0c027e5b48c8536 Mon Sep 17 00:00:00 2001 From: Federico Ravasio Date: Tue, 27 May 2014 17:15:01 +0200 Subject: [PATCH 2/2] Fixed running tests with Rubinius 2 on Travis. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c879bcd6..a9862d87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,10 @@ rvm: - 1.9.3 - 2.0.0 - 2.1.1 - - rbx + - rbx-2 matrix: allow_failures: - - rvm: rbx + - rvm: rbx-2 notifications: irc: channels: