summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--spec/color_spec.rb6
-rw-r--r--spec/dsl_spec.rb29
2 files changed, 29 insertions, 6 deletions
diff --git a/spec/color_spec.rb b/spec/color_spec.rb
index 8a41864..deafe81 100644
--- a/spec/color_spec.rb
+++ b/spec/color_spec.rb
@@ -1,10 +1,8 @@
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
@@ -22,16 +20,12 @@ RSpec.describe Ruby2D::Color do
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
new file mode 100644
index 0000000..6d3d8b4
--- /dev/null
+++ b/spec/dsl_spec.rb
@@ -0,0 +1,29 @@
+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