summaryrefslogtreecommitdiffstats
path: root/CLI/ruby/spec/game_of_life/cell_spec.rb
diff options
context:
space:
mode:
authora14m <[email protected]>2020-12-03 13:15:00 +0100
committera14m <[email protected]>2020-12-03 13:15:00 +0100
commit05730269d4d2d690d871548ae3930d3ce20cdcad (patch)
tree91017414194247100352b76d2288fb5da2aeece4 /CLI/ruby/spec/game_of_life/cell_spec.rb
parent187b189044b19482879eac3ed63772f3d8d2e000 (diff)
Randomize the order and stub constants used
Diffstat (limited to 'CLI/ruby/spec/game_of_life/cell_spec.rb')
-rw-r--r--CLI/ruby/spec/game_of_life/cell_spec.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/CLI/ruby/spec/game_of_life/cell_spec.rb b/CLI/ruby/spec/game_of_life/cell_spec.rb
index 063fd06..00f55b3 100644
--- a/CLI/ruby/spec/game_of_life/cell_spec.rb
+++ b/CLI/ruby/spec/game_of_life/cell_spec.rb
@@ -5,19 +5,16 @@ RSpec.describe GameOfLife::Cell do
subject(:dead_cell) { described_class.new(x: nil, y: nil, alive: false) }
describe "#to_s" do
- before(:all) do
- described_class.const_set(:LIVE_CELL, "X")
- described_class.const_set(:DEAD_CELL, ".")
- end
-
context "when alive" do
it "returns LIVE_CELL representation" do
+ stub_const("LIVE_CELL", "X")
expect(living_cell.to_s).to eq "X"
end
end
context "when dead" do
it "returns DEAD_CELL representation" do
+ stub_const("DEAD_CELL", ".")
expect(dead_cell.to_s).to eq "."
end
end