Sha256: 4f5048106b9391ad6cdf7fc3400fc87c75f942d49800ce9d6eafd8e03930b42d
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' module GameMachine describe Grid do let(:test_grid_config) do {:grid_size => 10, :cell_size => 10, :update_frequency => 1} end subject {Grid} before(:each) do Grid.reset_grids end describe "#update_freqency_for" do it "returns the update freqency for the named grid" do Grid.load_from_config expect(Grid.update_frequency_for('default')).to eq 1 end end describe "#load_from_config" do it "should create grids from config" do Grid.load_from_config expect(Grid.config.has_key?('default')).to be_truthy end end describe "#find_or_create" do before(:each) do expect(subject.config).to receive(:fetch).with('test'). and_return(test_grid_config) end it "creates a grid if none exists for the given name" do grid = subject.find_or_create('test') expect(grid).to be_instance_of(JavaLib::Grid) end it "returns the same instance if already created" do grid = subject.find_or_create('test') expect(subject.find_or_create('test')).to eql(grid) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
game_machine-1.0.4 | spec/grid_spec.rb |
game_machine-1.0.2 | spec/grid_spec.rb |
game_machine-0.0.11 | spec/grid_spec.rb |