diff --git a/.ruby-version b/.ruby-version index 227cea2..437459c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0 +2.5.0 diff --git a/.travis.yml b/.travis.yml index 1b4120d..4d64889 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,11 @@ rvm: - 1.9.2 - 1.9.3 - 2.0.0 + - 2.1.0 + - 2.2.0 + - 2.3.6 + - 2.4.3 + - 2.5.0 branches: only: - master diff --git a/Gemfile.ci b/Gemfile.ci index d471303..2ef894e 100644 --- a/Gemfile.ci +++ b/Gemfile.ci @@ -1,6 +1,5 @@ # Gemfile for Travis. Doesn't require gosu which doesn't compile in Travis source 'https://rubygems.org' -gem 'rspec' -gem 'rspec-mocks' -gem 'configuration' +gem 'rspec', '~> 3.7.0' +gem 'configuration', '~> 1.3.4' diff --git a/README.md b/README.md index f3f8b91..db9060e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ RTanque is based on the Java project [Robocode](http://robocode.sourceforge.net/ ## Requirements * The [Gosu](https://github.com/jlnr/gosu) library used for rendering has some dependencies. Use the [Gosu getting started](https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux) to resolve any for your system. - * Ruby 2.0.0 or 1.9.3 (tested on 1.8.7 and 1.9.2) + * Ruby 2.2 or later (also tested on earlier versions) ## Quick Start diff --git a/bin/rtanque b/bin/rtanque index 0e74a13..cd690c3 100755 --- a/bin/rtanque +++ b/bin/rtanque @@ -103,7 +103,7 @@ LONGDESC puts set_color("Error! Gist #{gist_id} not found. Please ensure the gist id is correct.", :red) else gist.files.attrs.each do |name, gist_file| - gist_path = "#{BOT_DIR}/#{gist.user.login}.#{gist_id}/#{name}" + gist_path = "#{BOT_DIR}/#{gist.owner.login}.#{gist_id}/#{name}" create_file(gist_path, gist_file.content, options) end end diff --git a/lib/rtanque/version.rb b/lib/rtanque/version.rb index 20be797..e939f6e 100644 --- a/lib/rtanque/version.rb +++ b/lib/rtanque/version.rb @@ -1,3 +1,3 @@ module RTanque - VERSION = '0.1.2' + VERSION = '0.1.3' end diff --git a/rtanque.gemspec b/rtanque.gemspec index ac034c4..7704bb0 100644 --- a/rtanque.gemspec +++ b/rtanque.gemspec @@ -22,13 +22,12 @@ Have fun competing against friends' tanks or the sample ones included. Maybe you gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_dependency 'gosu', '~> 0.7.45' - gem.add_dependency 'configuration', '~> 1.3.2' - gem.add_dependency 'octokit', '~> 2.7.0' - gem.add_dependency 'thor', '~> 0.17.0' - gem.add_dependency 'texplay' + gem.add_dependency 'gosu', '~> 0.13.1' + gem.add_dependency 'configuration', '~> 1.3.4' + gem.add_dependency 'octokit', '~> 4.8.0' + gem.add_dependency 'thor', '~> 0.20.0' + gem.add_dependency 'texplay', '>= 0.4.4pre' gem.add_development_dependency 'pry' - gem.add_development_dependency 'rspec', '~> 2.13.0' - gem.add_development_dependency 'rspec-mocks', '~> 2.13.0' + gem.add_development_dependency 'rspec', '~> 3.7.0' end diff --git a/spec/rtanque/bot_spec.rb b/spec/rtanque/bot_spec.rb index b4b80ac..c82a457 100644 --- a/spec/rtanque/bot_spec.rb +++ b/spec/rtanque/bot_spec.rb @@ -6,12 +6,12 @@ context '#dead?' do it 'should not initially be dead' do - expect(bot.dead?).to be_false + expect(bot.dead?).to be_falsey end it 'should be true if health is below min' do bot.health = RTanque::Configuration.bot.health.min - 1 - expect(bot.dead?).to be_true + expect(bot.dead?).to be_truthy end end diff --git a/spec/rtanque/heading_spec.rb b/spec/rtanque/heading_spec.rb index 16a4397..eef117a 100644 --- a/spec/rtanque/heading_spec.rb +++ b/spec/rtanque/heading_spec.rb @@ -110,7 +110,7 @@ end it 'creates frozen object' do - expect(described_class.new(0).frozen?).to be_true + expect(described_class.new(0).frozen?).to be_truthy end end @@ -135,43 +135,43 @@ describe '#==' do it 'works like Numeric, ignoring type' do a = described_class.new(1.0) - expect(a == 1).to be_true + expect(a == 1).to be_truthy end it 'correctly compares two equal headings' do a = described_class.new(1.0) b = described_class.new(1.0) - expect(a == b).to be_true + expect(a == b).to be_truthy end it 'correctly compares two different headings' do a = described_class.new(0) b = described_class.new(1.0) - expect(a == b).to be_false + expect(a == b).to be_falsey end it 'compares to a numeric on LHS' do a = described_class.new(Math::PI) - expect(Math::PI == a).to be_true + expect(Math::PI == a).to be_truthy end end describe '#eql?' do it 'compares types like Numeric, comparing type' do a = described_class.new(1.0) - expect(a.eql?(1)).to be_false + expect(a.eql?(1)).to be_falsey end it 'correctly compares two equal headings' do a = described_class.new(1.0) b = described_class.new(1.0) - expect(a.eql?(b)).to be_true + expect(a.eql?(b)).to be_truthy end it 'correctly compares two different headings' do a = described_class.new(0) b = described_class.new(1.0) - expect(a.eql?(b)).to be_false + expect(a.eql?(b)).to be_falsey end end diff --git a/spec/rtanque/match_spec.rb b/spec/rtanque/match_spec.rb index f780888..a4c7ec4 100644 --- a/spec/rtanque/match_spec.rb +++ b/spec/rtanque/match_spec.rb @@ -12,19 +12,19 @@ it 'should allow adding bots' do bot = double('bot') @instance.add_bots(bot) - expect(@instance.bots.include?(bot)).to be_true + expect(@instance.bots.include?(bot)).to be_truthy end describe '#finished?' do it 'should be true if one or less bots left' do - expect(@instance.finished?).to be_true + expect(@instance.finished?).to be_truthy end it 'should be false if two or more bots left' do bot1 = double('bot', :name => "bot1") bot2 = double('bot', :name => "bot2") @instance.add_bots(bot1, bot2) - expect(@instance.finished?).to be_false + expect(@instance.finished?).to be_falsey end it 'should be true if two or more bots left w/ same name' do @@ -32,7 +32,7 @@ bot1 = double('bot', :name => "bot1") bot2 = double('bot', :name => "bot1") @instance.add_bots(bot1, bot2) - expect(@instance.finished?).to be_true + expect(@instance.finished?).to be_truthy end end diff --git a/spec/rtanque/normalized_attr_spec.rb b/spec/rtanque/normalized_attr_spec.rb index cb0ce28..d134717 100644 --- a/spec/rtanque/normalized_attr_spec.rb +++ b/spec/rtanque/normalized_attr_spec.rb @@ -8,7 +8,7 @@ described_class::AttrContainer.new(1..5) end let(:attached_instance) do - mock('some_object') + double('some_object') end it 'has -infinity as max_delta' do @@ -33,13 +33,11 @@ described_class::AttrContainer.new(0..5, lambda{ |attached| attached.max_delta }) end let(:attached_instance) do - mock('some_object', :max_delta => 0.1) + double('some_object', :max_delta => 0.1) end it 'should call block for max_delta' do - attached = mock('some_object') - attached.should_receive(:max_delta).and_return(0.1) - expect(instance.max_delta(attached)).to eq 0.1 + expect(instance.max_delta(attached_instance)).to eq 0.1 end it 'does not allow a change greater than given delta' do diff --git a/spec/rtanque/point_spec.rb b/spec/rtanque/point_spec.rb index 0dca760..9b24838 100644 --- a/spec/rtanque/point_spec.rb +++ b/spec/rtanque/point_spec.rb @@ -19,7 +19,7 @@ context '#initialize' do it 'should be frozen' do a = described_class.new(10, 10, @arena) - expect(a.frozen?).to be_true + expect(a.frozen?).to be_truthy end it 'should not allow modification' do @@ -83,15 +83,15 @@ it 'is true when x & y are equal' do a = described_class.new(1, 1, @arena) b = described_class.new(1, 1, @arena) - expect(a == b).to be_true - expect(b == a).to be_true + expect(a == b).to be_truthy + expect(b == a).to be_truthy end it 'is not true when x & y are equal' do a = described_class.new(2, 1, @arena) b = described_class.new(1, 1, @arena) - expect(a == b).to be_false - expect(b == a).to be_false + expect(a == b).to be_falsey + expect(b == a).to be_falsey end end @@ -165,32 +165,32 @@ it 'correctly detects equal points' do @b = @a.clone - expect(@a.within_radius?(@b, 1)).to be_true + expect(@a.within_radius?(@b, 1)).to be_truthy end it 'correctly detects point 1 to left' do @b = described_class.new(4, 5, @arena) - expect(@a.within_radius?(@b, 1)).to be_true + expect(@a.within_radius?(@b, 1)).to be_truthy end it 'correctly detects point 1 to right' do @b = described_class.new(6, 5, @arena) - expect(@a.within_radius?(@b, 1)).to be_true + expect(@a.within_radius?(@b, 1)).to be_truthy end it 'correctly detects point 1 above' do @b = described_class.new(5, 6, @arena) - expect(@a.within_radius?(@b, 1)).to be_true + expect(@a.within_radius?(@b, 1)).to be_truthy end it 'correctly detects point 1 below' do @b = described_class.new(5, 4, @arena) - expect(@a.within_radius?(@b, 1)).to be_true + expect(@a.within_radius?(@b, 1)).to be_truthy end it 'correctly detects point 1 NE' do @b = described_class.new(6, 6, @arena) - expect(@a.within_radius?(@b, 1)).to be_false + expect(@a.within_radius?(@b, 1)).to be_falsey end end end diff --git a/spec/rtanque/radar_spec.rb b/spec/rtanque/radar_spec.rb index beda49a..9f8cebe 100644 --- a/spec/rtanque/radar_spec.rb +++ b/spec/rtanque/radar_spec.rb @@ -15,12 +15,12 @@ def reflection(heading, distance, name) it 'should return an empty array' do radar.scan([]) - expect(radar.empty?).to be_true + expect(radar.empty?).to be_truthy end it 'should 1 Reflection' do radar.scan([mockbot(10, 20)]) - expect(radar).to have(1).reflections + expect(radar.instance_variable_get(:@reflections).size).to eq 1 expect(radar.first).to be_an_instance_of described_class::Reflection end @@ -32,7 +32,7 @@ def reflection(heading, distance, name) it 'should clear self' do radar.scan([mockbot(10, 20, 'otherbot')]) radar.scan([]) - expect(radar.empty?).to be_true + expect(radar.empty?).to be_truthy end it 'reflections should be correct' do @@ -57,7 +57,7 @@ def reflection(heading, distance, name) y = 10 + Math.cos(RTanque::Bot::Radar::VISION_RANGE.last) * 10 bots = [mockbot(x, y, 'border')] radar.scan(bots) - expect(radar.to_a).to have(1).reflections + expect(radar.instance_variable_get(:@reflections).size).to eq 1 end it 'should detect point on min vision range' do @@ -65,7 +65,7 @@ def reflection(heading, distance, name) y = 10 + Math.cos(RTanque::Bot::Radar::VISION_RANGE.first) * 10 bots = [mockbot(x, y, 'border')] radar.scan(bots) - expect(radar.to_a).to have(1).reflections + expect(radar.instance_variable_get(:@reflections).size).to eq 1 end it 'should not detect point outside max vision range' do @@ -73,7 +73,7 @@ def reflection(heading, distance, name) y = 10 + Math.cos(RTanque::Bot::Radar::VISION_RANGE.last) * 10 bots = [mockbot(x + 0.01, y, 'border')] radar.scan(bots) - expect(radar.to_a).to have(0).reflections + expect(radar.instance_variable_get(:@reflections).size).to eq 0 end it 'should not detect point outside max vision range' do @@ -81,7 +81,7 @@ def reflection(heading, distance, name) y = 10 + Math.cos(RTanque::Bot::Radar::VISION_RANGE.first) * 10 bots = [mockbot(x, y - 0.01, 'border')] radar.scan(bots) - expect(radar.to_a).to have(0).reflections + expect(radar.instance_variable_get(:@reflections).size).to eq 0 end end end diff --git a/spec/rtanque/shell_spec.rb b/spec/rtanque/shell_spec.rb index 15903c5..34c259b 100644 --- a/spec/rtanque/shell_spec.rb +++ b/spec/rtanque/shell_spec.rb @@ -17,9 +17,9 @@ it 'shell should be dead after hit' do bots = [mockbot(10, 10, 'deadbot')] - expect(shell.dead?).to be_false + expect(shell.dead?).to be_falsey shell.hits(bots) - expect(shell.dead?).to be_true + expect(shell.dead?).to be_truthy end it 'should hit shell on bot radius' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 31579ad..856cebb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,6 @@ require 'rtanque' RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true # Run specs in random order to surface order dependencies. If you find an