diff options
| author | Tom Black <[email protected]> | 2016-12-24 22:17:34 -0600 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2016-12-24 22:17:34 -0600 |
| commit | e81d32b470cdead1c114b6d1b5b6bda958d6b1ad (patch) | |
| tree | 3d61e376c8f460b2ff932cb9f9104f2e0cf5b72e /spec | |
| parent | 326b74d485ce81c0a4e1da0e5158a2c83e028915 (diff) | |
| download | ruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.tar.gz ruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.zip | |
Merge all tests into `test/` directory
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/color_spec.rb | 37 | ||||
| -rw-r--r-- | spec/dsl_spec.rb | 29 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 23 | ||||
| -rw-r--r-- | spec/sprite_spec.rb | 11 |
4 files changed, 0 insertions, 100 deletions
diff --git a/spec/color_spec.rb b/spec/color_spec.rb deleted file mode 100644 index ed23712..0000000 --- a/spec/color_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'ruby2d' - -RSpec.describe Ruby2D::Color do - - describe '#is_valid?' do - it 'determines if a color string is valid' do - expect(Ruby2D::Color.is_valid? 'red').to eq true - expect(Ruby2D::Color.is_valid? 'balloons').to eq false - end - - it 'determines if a color string is valid hex value: # follow by 6 letters/numbers' do - expect(Ruby2D::Color.is_valid? '#c0c0c0').to eq true - expect(Ruby2D::Color.is_valid? '#00000').to eq false - expect(Ruby2D::Color.is_valid? '123456').to eq false - end - - it 'determines if an array is a valid color' do - expect(Ruby2D::Color.is_valid? [1.0, 0, 0, 1.0]).to eq true - expect(Ruby2D::Color.is_valid? [1.0, 0, 0]).to eq false - end - - it 'prevents allow color values out of range' do - expect(Ruby2D::Color.is_valid? [1.0, 0, 0.0, 255]).to eq true - expect(Ruby2D::Color.is_valid? [1.2, 0, 0, 0]).to eq false - expect(Ruby2D::Color.is_valid? [-0.1, 0, 0, 0]).to eq false - expect(Ruby2D::Color.is_valid? [255, 255, 256, 255]).to eq false - expect(Ruby2D::Color.is_valid? [-1, 0, 127, 255]).to eq false - end - end - - describe '#new' do - it 'raises error on bad color' do - expect { Ruby2D::Color.new 42 }.to raise_error Ruby2D::Error - end - end - -end diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb deleted file mode 100644 index 6d3d8b4..0000000 --- a/spec/dsl_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'ruby2d' - -RSpec.describe Ruby2D::DSL do - - describe '#get' do - it 'gets the default window attributes' do - expect(get :width).to eq 640 - expect(get :height).to eq 480 - expect(get :title).to eq "Ruby 2D" - end - end - - describe '#set' do - it 'sets a single window attribute' do - set width: 300 - expect(get :width).to eq 300 - expect(get :height).to eq 480 - expect(get :title).to eq "Ruby 2D" - end - - it 'sets multiple window attributes at a time' do - set width: 800, height: 600, title: "Hello tests!" - expect(get :width).to eq 800 - expect(get :height).to eq 600 - expect(get :title).to eq "Hello tests!" - end - end - -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index d93bff8..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,23 +0,0 @@ -RSpec.configure do |config| - config.expect_with :rspec do |expectations| - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - config.mock_with :rspec do |mocks| - mocks.verify_partial_doubles = true - end - - # Silence output when running tests - original_stderr = $stderr - original_stdout = $stdout - config.before(:all) do - # Redirect stderr and stdout - $stderr = File.open(File::NULL, "w") - $stdout = File.open(File::NULL, "w") - end - config.after(:all) do - # Restore - $stderr = original_stderr - $stdout = original_stdout - end -end diff --git a/spec/sprite_spec.rb b/spec/sprite_spec.rb deleted file mode 100644 index 42268be..0000000 --- a/spec/sprite_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'ruby2d' - -RSpec.describe Ruby2D::Sprite do - - describe '#new' do - it 'creates a new sprite' do - Ruby2D::Sprite.new(0, 0, "tests/media/sprite_sheet.png") - end - end - -end |
