From 05730269d4d2d690d871548ae3930d3ce20cdcad Mon Sep 17 00:00:00 2001 From: a14m Date: Thu, 3 Dec 2020 13:15:00 +0100 Subject: Randomize the order and stub constants used --- CLI/ruby/spec/game_of_life/generators/input_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'CLI/ruby/spec/game_of_life/generators/input_spec.rb') diff --git a/CLI/ruby/spec/game_of_life/generators/input_spec.rb b/CLI/ruby/spec/game_of_life/generators/input_spec.rb index cbf3958..e05dbfb 100644 --- a/CLI/ruby/spec/game_of_life/generators/input_spec.rb +++ b/CLI/ruby/spec/game_of_life/generators/input_spec.rb @@ -16,6 +16,8 @@ RSpec.describe GameOfLife::Generators::Input do options = { "input" => "Conway's Game of Life", "width" => 21, "height" => 1 } allow(URI).to receive(:open).and_return(file) allow(file).to receive(:read).and_return(options["input"]) + stub_const("GameOfLife::Cell::LIVE_CELL", "X") + stub_const("GameOfLife::Cell::DEAD_CELL", ".") # Conway's Game of Life expect(described_class.new(options).to_s).to eq "XXXXXX.X.XXXX.XX.XXXX" @@ -25,6 +27,8 @@ RSpec.describe GameOfLife::Generators::Input do options = { "input" => "Conway's Game of Life", "width" => 25, "height" => 2 } allow(URI).to receive(:open).and_return(file) allow(file).to receive(:read).and_return(options["input"]) + stub_const("GameOfLife::Cell::LIVE_CELL", "X") + stub_const("GameOfLife::Cell::DEAD_CELL", ".") # Conway's Game of Life universe = "XXXXXX.X.XXXX.XX.XXXX....\n" \ @@ -37,6 +41,8 @@ RSpec.describe GameOfLife::Generators::Input do options = { "input" => "Conway's Game of Life", "width" => 11, "height" => 3 } allow(URI).to receive(:open).and_return(file) allow(file).to receive(:read).and_return(options["input"]) + stub_const("GameOfLife::Cell::LIVE_CELL", "X") + stub_const("GameOfLife::Cell::DEAD_CELL", ".") # Conway's Ga universe = "XXXXXX.X.XX\n" \ -- cgit v1.2.3