battle 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c438f9982d66971b78a5695443b14e59c3c30fe4
4
- data.tar.gz: a6bec87dde2f34c2779619b467717bf71a8c842e
3
+ metadata.gz: ca74368fc020b4596625df1b3f649171458cfe86
4
+ data.tar.gz: 192c1857512a923e7ef56f9c03b0ccd9f17a50b2
5
5
  SHA512:
6
- metadata.gz: 25d92626cdf8adbaff5927caa1b5803aebe83e7877c56eb27668b00ecb261c280527eb370f2ab107c31522d18511a855ceb09f05b86ef95bd19452d76ac7fbea
7
- data.tar.gz: 21b4f39ba4763e2a838543814733569e72bd02607efa30d6b9accf27874326b618d0add8dbe91c6d4ce7fefde2bb4d51ea816e4251f35d02f3c3630584b11087
6
+ metadata.gz: 4486d64d0251772bfd01a6211095236f617c026500db8f372b0f8ae551ef8c46ed4eaf41c8a5532b4cffb9b4ecc6fde19d84b79a875984c2a52d59151834b73b
7
+ data.tar.gz: 475089aee99c2b9e6e6d74f0b042e1d564087eacc7700edf36f46fe5eb518e9fd8a8284e3f427986b87788e13ccf0a6f585cdb7f939dc56d4fdf162262c3ba29
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+
6
+ script:
7
+ - rspec spec/
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Battle
2
+ [![Build Status](https://travis-ci.org/ck3g/battle.png?branch=master)](https://travis-ci.org/ck3g/battle)
3
+ [![Code Climate](https://codeclimate.com/github/ck3g/battle.png)](https://codeclimate.com/github/ck3g/battle)
2
4
 
3
5
  This gem is extraction from my [Battle45](https://github.com/ck3g/battle45) project
4
6
 
data/lib/battle/game.rb CHANGED
@@ -5,11 +5,12 @@ module Battle
5
5
 
6
6
  STATUSES = %w[start victory defeat]
7
7
 
8
- def initialize(name, email)
8
+ def initialize(name = nil, email = nil, id: nil)
9
9
  @name = name
10
10
  @email = email
11
+ @id = id
11
12
  @coords = [nil, nil]
12
- @status = "init"
13
+ @status = id ? 'start': 'init'
13
14
  @ships = []
14
15
  @response = {}
15
16
  Battle.ships.each { |name| @ships << Ship.new(name) }
@@ -1,3 +1,3 @@
1
1
  module Battle
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -12,20 +12,18 @@ describe Battle::Game do
12
12
  end
13
13
  let(:register_response_body) { load_fixture "register" }
14
14
 
15
- it "stores player name" do
16
- expect(game.name).to eq "Bob"
17
- end
18
-
19
- it "stores player email" do
20
- expect(game.email).to eq "bob@example.com"
21
- end
15
+ subject { game }
16
+ its(:name) { should eq 'Bob' }
17
+ its(:email) { should eq 'bob@example.com' }
18
+ its(:status) { should eq 'init' }
22
19
 
23
20
  it 'stores the ships' do
24
21
  expect(game.ships.count).to eq 7
25
22
  end
26
23
 
27
- it "init the game" do
28
- expect(game.status).to eq "init"
24
+ context 'when init game with remote id' do
25
+ subject { Battle::Game.new id: 503 }
26
+ its(:status) { should eq 'start' }
29
27
  end
30
28
 
31
29
  describe "#register!" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Tatarintsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-27 00:00:00.000000000 Z
11
+ date: 2013-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - .gitignore
105
+ - .travis.yml
105
106
  - Gemfile
106
107
  - LICENSE.txt
107
108
  - README.md
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  requirements: []
142
143
  rubyforge_project:
143
- rubygems_version: 2.0.0
144
+ rubygems_version: 2.0.3
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: Wrapper to Platform45 developer challenge API http://battle.platform45.com/