ray 0.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ describe Ray do
2
+ describe "#create_window" do
3
+ context "when given an unappropriate configuration" do
4
+ it "should raise runtime error" do
5
+ Ray.init
6
+
7
+ lambda {
8
+ Ray.create_window(:w => 100, :h => 100, :bpp => 1)
9
+ }.should raise_exception(RuntimeError)
10
+
11
+ Ray.stop
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,74 @@
1
+ describe Ray::Rect do
2
+ [:x, :y, :width, :height].each do |meth|
3
+ describe "##{meth}=" do
4
+ it "should set a new value to #{meth}" do
5
+ rect = Ray::Rect.new(0, 0)
6
+ lambda {
7
+ rect.send("#{meth}=", 30)
8
+ }.should change(rect, meth).from(0).to(30)
9
+ end
10
+
11
+ it "should only allow numerics" do
12
+ rect = Ray::Rect.new(0, 0)
13
+
14
+ ["1.0", "5.d", Ray, Ray::Rect, rect].each do |obj|
15
+ lambda {
16
+ rect.send("#{meth}=", obj)
17
+ }.should raise_exception(TypeError)
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ describe "#initialize" do
24
+ context "with a hash" do
25
+ it "should not allow to pass x but not y" do
26
+ lambda {
27
+ Ray::Rect.new(:x => 10)
28
+ }.should raise_exception(ArgumentError)
29
+ end
30
+
31
+ it "should not allow to pass width but not height" do
32
+ lambda {
33
+ Ray::Rect.new(:x => 10, :y => 200, :width => 300)
34
+ }.should raise_exception(ArgumentError)
35
+ end
36
+
37
+ it "should require x and y to be present" do
38
+ lambda {
39
+ Ray::Rect.new(:width => 400, :height => 300)
40
+ }.should raise_exception(ArgumentError)
41
+ end
42
+
43
+ it "should only work with numerics" do
44
+ ["1.0", "5.d", Ray, Ray::Rect].each do |obj|
45
+ lambda {
46
+ Ray::Rect.new(:x => obj, :y => 30)
47
+ }.should raise_exception(TypeError)
48
+ end
49
+ end
50
+ end
51
+
52
+ context "with separated arguments" do
53
+ it "should not work with one integer" do
54
+ lambda {
55
+ Ray::Rect.new(10)
56
+ }.should raise_exception(ArgumentError)
57
+ end
58
+
59
+ it "should not work with 3 integers" do
60
+ lambda {
61
+ Ray::Rect.new(10, 30, 40)
62
+ }.should raise_exception(ArgumentError)
63
+ end
64
+
65
+ it "should only work with numerics" do
66
+ ["1.0", "5.d", Ray, Ray::Rect].each do |obj|
67
+ lambda {
68
+ Ray::Rect.new(obj, 30)
69
+ }.should raise_exception(TypeError)
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
data/spec_runner.rb ADDED
@@ -0,0 +1,23 @@
1
+ $: << "./ext/" << "./lib/"
2
+ path = File.expand_path(File.join(File.dirname(__FILE__), "ext/ray"))
3
+ our_path = File.expand_path(File.join(File.dirname(__FILE__), "spec_runner.rb"))
4
+
5
+ unless defined? Ray
6
+ unless RUBY_PLATFORM =~ /darwin/
7
+ require 'ray_ext'
8
+ else
9
+ if File.exist? path
10
+ system "#{path} #{our_path}"
11
+ exit $?.exitstatus
12
+ else
13
+ $stderr.puts "please build ray (rake ext)"
14
+ exit 1
15
+ end
16
+ end
17
+ end
18
+
19
+ require 'ray'
20
+
21
+ require 'spec'
22
+ require 'spec/autorun'
23
+ Dir["spec/**/*_spec.rb"].each { |file| load file }
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ray
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ - pre1
10
+ version: 0.0.0.pre1
11
+ platform: ruby
12
+ authors:
13
+ - "Mon ou\xC3\xAFe"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-17 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: mon.ouie@gmail.com
24
+ executables:
25
+ - ray
26
+ - ray_irb
27
+ - ray
28
+ - ray_irb
29
+ extensions:
30
+ - ext/extconf.rb
31
+ - ext/extconf.rb
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - .gitignore
36
+ - Rakefile
37
+ - VERSION
38
+ - bin/ray
39
+ - bin/ray_irb
40
+ - ext/Makefile
41
+ - ext/SDLMain.h
42
+ - ext/SDLMain.m
43
+ - ext/color.c
44
+ - ext/extconf.rb
45
+ - ext/image.c
46
+ - ext/ray
47
+ - ext/ray.bundle
48
+ - ext/ray.c
49
+ - ext/ray.h
50
+ - ext/ray_ext.bundle
51
+ - ext/ray_ext.so
52
+ - ext/rect.c
53
+ - ext/test.rb
54
+ - lib/ray.rb
55
+ - lib/ray/color.rb
56
+ - lib/ray/ray.rb
57
+ - lib/ray/rect.rb
58
+ - spec/ray/color_spec.rb
59
+ - spec/ray/image_spec.rb
60
+ - spec/ray/ray_spec.rb
61
+ - spec/ray/rect_spec.rb
62
+ - spec_runner.rb
63
+ has_rdoc: true
64
+ homepage: http://github.com/Mon-Ouie/ray
65
+ licenses: []
66
+
67
+ post_install_message:
68
+ rdoc_options:
69
+ - --charset=UTF-8
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">"
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 1
87
+ - 3
88
+ - 1
89
+ version: 1.3.1
90
+ requirements: []
91
+
92
+ rubyforge_project:
93
+ rubygems_version: 1.3.7
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: ""
97
+ test_files:
98
+ - spec/ray/color_spec.rb
99
+ - spec/ray/image_spec.rb
100
+ - spec/ray/ray_spec.rb
101
+ - spec/ray/rect_spec.rb