leonardo-bridge 0.4.3 → 0.6.5

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.
@@ -7,7 +7,7 @@ describe Hand do
7
7
  hand
8
8
  }
9
9
 
10
- it { subject.size.should eq(12) }
10
+ it { expect(subject.size).to eq(12) }
11
11
 
12
12
  describe '#sort!' do
13
13
  before {
@@ -15,7 +15,7 @@ describe Hand do
15
15
  subject.sort! unless subject.cards.map {|c| c.suit}.uniq.size == 4
16
16
  }
17
17
 
18
- it { subject.cards.first.suit.should eq('C') }
19
- it { subject.cards.last.suit.should eq('S') }
18
+ it { expect(subject.cards.first.suit).to eq('C') }
19
+ it { expect(subject.cards.last.suit).to eq('S') }
20
20
  end
21
21
  end
@@ -14,9 +14,9 @@ describe Player do
14
14
  expect { subject.start_next_game }.to raise_error(GameError, 'Not ready to start game')
15
15
  end
16
16
 
17
- it "should be able to start a game if available" do
18
- subject.send(:game).stub(:next_game_ready?) { true }
19
- subject.start_next_game.should eq(true)
17
+ it ").to be able to start a game if available" do
18
+ allow(subject.send(:game)).to receive(:next_game_ready?).and_return(true)
19
+ expect(subject.start_next_game).to eq(true)
20
20
  end
21
21
  end
22
22
  end
@@ -32,16 +32,16 @@ describe Result do
32
32
  end
33
33
 
34
34
  while not game.play.complete?
35
- game.state.should eq(:playing)
35
+ expect(game.state).to eq(:playing)
36
36
  turn = game.get_turn
37
37
 
38
38
  # Find a valid card.
39
39
  board.deal[turn].each do |card|
40
40
  if game.play.valid_play?(card, turn, board.deal[turn])
41
41
  if turn == game.play.dummy
42
- players[game.play.declarer].play_card(card).should eq(true)
42
+ expect(players[game.play.declarer].play_card(card)).to eq(true)
43
43
  else
44
- players[turn].play_card(card).should eq(true)
44
+ expect(players[turn].play_card(card)).to eq(true)
45
45
  end
46
46
  break
47
47
  end
@@ -51,14 +51,14 @@ describe Result do
51
51
  game
52
52
  }
53
53
  subject { game.results.first }
54
- xit { subject.is_major.should eq(true) }
54
+ xit { expect(subject.is_major).to eq(true) }
55
55
 
56
56
  describe 'score tests' do
57
57
  let(:calls) {[Bid.new(Level.one, Strain.no_trump), Pass.new, Pass.new, Pass.new]}
58
58
 
59
59
  it 'should score a 1NT+3 game correctly' do
60
60
  r = DuplicateResult.new(game.board, game.contract, 10)
61
- r.score.should eq(180)
61
+ expect(r.score).to eq(180)
62
62
  end
63
63
  end
64
64
  end
@@ -7,15 +7,8 @@ root = File.dirname(__FILE__)
7
7
  Dir[File.join(root,'support', '**','*.rb')].each { |f| require f }
8
8
 
9
9
  RSpec.configure do |config|
10
- config.color_enabled = true
11
10
  config.mock_with :rspec
12
11
  config.order = "random"
13
-
14
- # set up test redis db
15
- config.before(:suite) { $redis = Bridge::DB.new(:db => 15) }
16
-
17
- # flush test redis db
18
- config.after(:each) { $redis.flushdb }
19
12
  end
20
13
 
21
14
  include Bridge
@@ -2,8 +2,8 @@ module AuctionHelper
2
2
  # expects an array of calls
3
3
  def assert_current_calls(calls)
4
4
  calls.map { |c| subject.make_call(c) unless c.nil? }
5
- subject.current_bid.should eq(calls[0])
6
- subject.current_double.should eq(calls[1])
7
- subject.current_redouble.should eq(calls[2])
5
+ expect(subject.current_bid).to eq(calls[0])
6
+ expect(subject.current_double).to eq(calls[1])
7
+ expect(subject.current_redouble).to eq(calls[2])
8
8
  end
9
9
  end
@@ -12,16 +12,16 @@ describe TrickPlay do
12
12
  }
13
13
 
14
14
 
15
- it { subject.declarer.should eq(Direction.east) }
16
- it { subject.lho.should eq(Direction.south) }
17
- it { subject.rho.should eq(Direction.north) }
18
- it { subject.dummy.should eq(Direction.west) }
19
- it { subject.trumps.should eq(Suit.club) }
20
- it { subject.played.size.should eq(4) }
21
- it { subject.winners.size.should eq(0) }
22
- it { subject.complete?.should eq(false) }
23
- it { subject.whose_turn.should eq(Direction.south) }
24
- it { subject.get_current_trick.cards.size.should eq(0) }
15
+ it { expect(subject.declarer).to eq(Direction.east) }
16
+ it { expect(subject.lho).to eq(Direction.south) }
17
+ it { expect(subject.rho).to eq(Direction.north) }
18
+ it { expect(subject.dummy).to eq(Direction.west) }
19
+ it { expect(subject.trumps).to eq(Suit.club) }
20
+ it { expect(subject.played.size).to eq(4) }
21
+ it { expect(subject.winners.size).to eq(0) }
22
+ it { expect(subject.complete?).to eq(false) }
23
+ it { expect(subject.whose_turn).to eq(Direction.south) }
24
+ it { expect(subject.get_current_trick.cards.size).to eq(0) }
25
25
 
26
26
  describe '#play_card' do
27
27
  let(:card1) { Card.from_string('JC') }
@@ -32,56 +32,55 @@ describe TrickPlay do
32
32
 
33
33
  before { subject.play_card(card1,nil) }
34
34
 
35
- it { subject.get_trick_count.should eq([0,0]) }
36
- it { subject.get_current_trick.cards.compact.size.should eq(1) }
37
- xit { subject.get_current_trick.cards.size.should eq(3) }
38
- it { subject.winning_card(subject.get_current_trick).should eq(false) }
39
- it { subject.whose_turn.should eq(Direction.west) }
40
- it { subject.played[Direction.south].size.should eq(1) }
41
- it { subject.history.size.should eq(1) }
42
- it { subject.who_played?(card1).should eq(Direction.south) }
35
+ it { expect(subject.get_trick_count).to eq([0,0]) }
36
+ it { expect(subject.get_current_trick.cards.compact.size).to eq(1) }
37
+ it { expect(subject.winning_card(subject.get_current_trick)).to eq(false) }
38
+ it { expect(subject.whose_turn).to eq(Direction.west) }
39
+ it { expect(subject.played[Direction.south].size).to eq(1) }
40
+ it { expect(subject.history.size).to eq(1) }
41
+ it { expect(subject.who_played?(card1)).to eq(Direction.south) }
43
42
 
44
43
  describe '2 times' do
45
44
  before { subject.play_card(card2,nil) }
46
45
 
47
- it { subject.get_trick_count.should eq([0,0]) }
48
- it { subject.get_current_trick.cards.compact.size.should eq(2) }
49
- it { subject.get_current_trick.cards.size.should eq(4) }
50
- it { subject.winning_card(subject.get_current_trick).should eq(false) }
51
- it { subject.whose_turn.should eq(Direction.north) }
52
- it { subject.played[Direction.west].size.should eq(1) }
53
- it { subject.who_played?(card2).should eq(Direction.west) }
46
+ it { expect(subject.get_trick_count).to eq([0,0]) }
47
+ it { expect(subject.get_current_trick.cards.compact.size).to eq(2) }
48
+ it { expect(subject.get_current_trick.cards.size).to eq(4) }
49
+ it { expect(subject.winning_card(subject.get_current_trick)).to eq(false) }
50
+ it { expect(subject.whose_turn).to eq(Direction.north) }
51
+ it { expect(subject.played[Direction.west].size).to eq(1) }
52
+ it { expect(subject.who_played?(card2)).to eq(Direction.west) }
54
53
 
55
54
  describe '3 times' do
56
55
  before { subject.play_card(card3,nil) }
57
56
 
58
- it { subject.get_trick_count.should eq([0,0]) }
59
- it { subject.get_current_trick.cards.compact.size.should eq(3) }
60
- it { subject.get_current_trick.cards.size.should eq(4) }
61
- it { subject.winning_card(subject.get_current_trick).should eq(false) }
62
- it { subject.whose_turn.should eq(Direction.east) }
63
- it { subject.played[Direction.north].size.should eq(1) }
64
- it { subject.who_played?(card3).should eq(Direction.north) }
57
+ it { expect(subject.get_trick_count).to eq([0,0]) }
58
+ it { expect(subject.get_current_trick.cards.compact.size).to eq(3) }
59
+ it { expect(subject.get_current_trick.cards.size).to eq(4) }
60
+ it { expect(subject.winning_card(subject.get_current_trick)).to eq(false) }
61
+ it { expect(subject.whose_turn).to eq(Direction.east) }
62
+ it { expect(subject.played[Direction.north].size).to eq(1) }
63
+ it { expect(subject.who_played?(card3)).to eq(Direction.north) }
65
64
 
66
65
  describe '4 times' do
67
66
  before { subject.play_card(card4,nil) }
68
67
 
69
- it { subject.get_trick_count.should eq([0,1]) } # south won
70
- it { subject.get_current_trick.cards.compact.size.should eq(4) }
71
- it { subject.get_current_trick.cards.size.should eq(4) }
72
- it { subject.winning_card(subject.get_current_trick).should eq(card1) }
73
- it { subject.whose_turn.should eq(Direction.south) }
74
- it { subject.played[Direction.east].size.should eq(1) }
75
- it { subject.who_played?(card4).should eq(Direction.east) }
68
+ it { expect(subject.get_trick_count).to eq([0,1]) } # south won
69
+ it { expect(subject.get_current_trick.cards.compact.size).to eq(4) }
70
+ it { expect(subject.get_current_trick.cards.size).to eq(4) }
71
+ it { expect(subject.winning_card(subject.get_current_trick)).to eq(card1) }
72
+ it { expect(subject.whose_turn).to eq(Direction.south) }
73
+ it { expect(subject.played[Direction.east].size).to eq(1) }
74
+ it { expect(subject.who_played?(card4)).to eq(Direction.east) }
76
75
 
77
76
  describe '5 times' do
78
77
  before { subject.play_card(card5,nil) }
79
- it { subject.get_trick_count.should eq([0,1]) } # south won
80
- it { subject.get_current_trick.cards.compact.size.should eq(1) }
81
- it { subject.winning_card(subject.get_current_trick).should eq(false) }
82
- it { subject.whose_turn.should eq(Direction.west) }
83
- it { subject.played[Direction.south].size.should eq(2) }
84
- it { subject.who_played?(card5).should eq(Direction.south) }
78
+ it { expect(subject.get_trick_count).to eq([0,1]) } # south won
79
+ it { expect(subject.get_current_trick.cards.compact.size).to eq(1) }
80
+ it { expect(subject.winning_card(subject.get_current_trick)).to eq(false) }
81
+ it { expect(subject.whose_turn).to eq(Direction.west) }
82
+ it { expect(subject.played[Direction.south].size).to eq(2) }
83
+ it { expect(subject.who_played?(card5)).to eq(Direction.south) }
85
84
  end
86
85
  end
87
86
  end
@@ -3,13 +3,13 @@ require 'spec_helper'
3
3
  describe Trick do
4
4
  subject { Trick.new }
5
5
 
6
- it { subject.done?.should eq(false) }
7
- it { subject.leader.should eq(nil) }
8
- it { subject.cards.should eq([]) }
6
+ it { expect(subject.done?).to eq(false) }
7
+ it { expect(subject.leader).to eq(nil) }
8
+ it { expect(subject.cards).to eq([]) }
9
9
 
10
10
  describe 'with 4 cards' do
11
11
  before { Deck.new.first(4).each { |c| subject << c } }
12
12
 
13
- it { subject.done?.should eq(true) }
13
+ it { expect(subject.done?).to eq(true) }
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,151 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leonardo-bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Achilles Charmpilas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-06 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: redis
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: nutrun-string
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - ! '>='
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
19
  version: '0'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - ! '>='
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ~>
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
33
  version: '1.3'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ~>
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.3'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: fuubar
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: geminabox
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ! '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: gem-release
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ! '>='
45
+ - - ">="
102
46
  - !ruby/object:Gem::Version
103
47
  version: '0'
104
48
  type: :development
105
49
  prerelease: false
106
50
  version_requirements: !ruby/object:Gem::Requirement
107
51
  requirements:
108
- - - ! '>='
52
+ - - ">="
109
53
  - !ruby/object:Gem::Version
110
54
  version: '0'
111
55
  - !ruby/object:Gem::Dependency
112
56
  name: rake
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
- - - ! '>='
59
+ - - ">="
116
60
  - !ruby/object:Gem::Version
117
61
  version: '0'
118
62
  type: :development
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
- - - ! '>='
66
+ - - ">="
123
67
  - !ruby/object:Gem::Version
124
68
  version: '0'
125
69
  - !ruby/object:Gem::Dependency
126
70
  name: simplecov
127
71
  requirement: !ruby/object:Gem::Requirement
128
72
  requirements:
129
- - - ! '>='
73
+ - - ">="
130
74
  - !ruby/object:Gem::Version
131
75
  version: '0'
132
76
  type: :development
133
77
  prerelease: false
134
78
  version_requirements: !ruby/object:Gem::Requirement
135
79
  requirements:
136
- - - ! '>='
80
+ - - ">="
137
81
  - !ruby/object:Gem::Version
138
82
  version: '0'
139
83
  description: A lean mean bridge playing machine
140
84
  email:
141
- - ac@humbuckercode.co.uk
85
+ - achilles@clickitmedia.eu
142
86
  executables:
143
87
  - leo-console
144
88
  - leo-play
145
89
  extensions: []
146
90
  extra_rdoc_files: []
147
91
  files:
148
- - .gitignore
92
+ - ".gitignore"
149
93
  - Gemfile
150
94
  - LICENSE.txt
151
95
  - README.md
@@ -160,7 +104,6 @@ files:
160
104
  - lib/bridge/call.rb
161
105
  - lib/bridge/card.rb
162
106
  - lib/bridge/contract.rb
163
- - lib/bridge/db.rb
164
107
  - lib/bridge/deal.rb
165
108
  - lib/bridge/deck.rb
166
109
  - lib/bridge/game.rb
@@ -172,28 +115,23 @@ files:
172
115
  - lib/bridge/trick_play.rb
173
116
  - lib/bridge/version.rb
174
117
  - lib/enum.rb
175
- - lib/redis_model.rb
176
- - lib/uuid.rb
177
118
  - spec/auction_spec.rb
178
119
  - spec/board_spec.rb
179
120
  - spec/bridge_spec.rb
180
121
  - spec/call_spec.rb
181
122
  - spec/card_spec.rb
182
- - spec/db_spec.rb
183
123
  - spec/deck_spec.rb
184
124
  - spec/enum_spec.rb
185
125
  - spec/game_spec.rb
186
126
  - spec/hand_spec.rb
187
127
  - spec/player_spec.rb
188
- - spec/redis_model_spec.rb
189
128
  - spec/result_spec.rb
190
129
  - spec/spec_helper.rb
191
130
  - spec/support/auction_helper.rb
192
131
  - spec/support/test_enum.rb
193
- - spec/support/test_model.rb
194
132
  - spec/trick_play_spec.rb
195
133
  - spec/trick_spec.rb
196
- homepage: http://bridge.leonardogames.net/
134
+ homepage: https://leobridge.net
197
135
  licenses:
198
136
  - MIT
199
137
  metadata: {}
@@ -203,17 +141,17 @@ require_paths:
203
141
  - lib
204
142
  required_ruby_version: !ruby/object:Gem::Requirement
205
143
  requirements:
206
- - - ! '>='
144
+ - - ">="
207
145
  - !ruby/object:Gem::Version
208
146
  version: '0'
209
147
  required_rubygems_version: !ruby/object:Gem::Requirement
210
148
  requirements:
211
- - - ! '>='
149
+ - - ">="
212
150
  - !ruby/object:Gem::Version
213
151
  version: '0'
214
152
  requirements: []
215
153
  rubyforge_project:
216
- rubygems_version: 2.1.11
154
+ rubygems_version: 2.6.10
217
155
  signing_key:
218
156
  specification_version: 4
219
157
  summary: Encapsulates all the necessary logic that allows 4 players to play a bridge
@@ -224,17 +162,14 @@ test_files:
224
162
  - spec/bridge_spec.rb
225
163
  - spec/call_spec.rb
226
164
  - spec/card_spec.rb
227
- - spec/db_spec.rb
228
165
  - spec/deck_spec.rb
229
166
  - spec/enum_spec.rb
230
167
  - spec/game_spec.rb
231
168
  - spec/hand_spec.rb
232
169
  - spec/player_spec.rb
233
- - spec/redis_model_spec.rb
234
170
  - spec/result_spec.rb
235
171
  - spec/spec_helper.rb
236
172
  - spec/support/auction_helper.rb
237
173
  - spec/support/test_enum.rb
238
- - spec/support/test_model.rb
239
174
  - spec/trick_play_spec.rb
240
175
  - spec/trick_spec.rb