Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

switched testing to rspec. added small tests

  • Loading branch information...
commit 1e83e0f089e451ab97830c5fa43f29be27822d30 1 parent 5eedec2
@jwoertink authored
View
1  .rspec
@@ -0,0 +1 @@
+--colour --format nested
View
2  Gemfile
@@ -3,7 +3,7 @@ source "http://rubygems.org"
gem 'theseus', :git => "git://github.com/jwoertink/theseus.git"
group :development do
- gem "shoulda", ">= 0"
+ gem "rspec", "~> 2.3.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.4"
gem "rcov", ">= 0"
View
5 README.rdoc
@@ -14,7 +14,7 @@ Currently these are all samples from the jMonkeyEngine Hello tutorials re-writte
bundle
You should be good at this point.
-== Running
+== Running Waves
The main application can be run by
jruby bin/waves
@@ -23,6 +23,9 @@ You can view other samples by passing the sample number as an argument
Normal camera operations use W A S D to move. To exit just hit esc.
+== Running Maze Craze
+ jruby lib/maze.rb
+
== Requirements
OSX (Because I haven't tried this on anything else)
JRuby 1.6+
View
14 spec/sample1_spec.rb
@@ -0,0 +1,14 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+require 'sample1'
+
+describe "Sample1" do
+
+ before(:all) do
+ @app = Sample1.new
+ end
+
+ it "should respond to start" do
+ @app.should respond_to :start
+ end
+
+end
View
0  spec/sample2_spec.rb
No changes.
View
0  spec/sample3_spec.rb
No changes.
View
0  spec/sample4_spec.rb
No changes.
View
0  spec/sample5_spec.rb
No changes.
View
0  spec/sample6_spec.rb
No changes.
View
0  spec/sample7_spec.rb
No changes.
View
0  spec/sample8_spec.rb
No changes.
View
0  spec/sample9_spec.rb
No changes.
View
31 spec/spec_helper.rb
@@ -0,0 +1,31 @@
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'samples'))
+$:.unshift(File.dirname(__FILE__))
+require 'rspec'
+require 'waves'
+
+RSpec.configure do |config|
+ config.mock_with :rspec
+ def capture(stream)
+ begin
+ stream = stream.to_s
+ eval "$#{stream} = StringIO.new"
+ yield
+ result = eval("$#{stream}").string
+ ensure
+ eval("$#{stream} = #{stream.upcase}")
+ end
+
+ result
+ end
+
+end
View
27 spec/waves_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "Waves" do
+
+ let :options do
+ opts = ARGV.clear
+ end
+
+ it "should load sample 1 with no options passed" do
+ file = "1"
+ sample = "sample#{file}"
+ require "samples/#{sample}"
+ options.should be_empty
+ Object.const_get(sample.capitalize).should == Sample1
+ end
+
+ it "should load sample 1 with 1 passed as an argument" do
+ options[0] = "1"
+ file = options[0]
+ sample = "sample#{file}"
+ require "samples/#{sample}"
+ options.should_not be_empty
+ Object.const_get(sample.capitalize).should == Sample1
+ end
+
+
+end
View
18 test/helper.rb
@@ -1,18 +0,0 @@
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
-require 'test/unit'
-require 'shoulda'
-
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'waves'
-
-class Test::Unit::TestCase
-end
View
7 test/test_waves.rb
@@ -1,7 +0,0 @@
-require 'helper'
-
-class TestWaves < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.