Skip to content

Commit 09a34b0

Browse files
committed
Rspec test examples
1 parent b0cb09f commit 09a34b0

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.3-p392
1+
jruby-1.7.4

rakefile.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'rspec/core/rake_task'
2+
task :rspec => :spec
3+
RSpec::Core::RakeTask.new

simple_live_coding.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def setup
3333
no_loop
3434
#smooth
3535
#frameRate 25
36+
37+
#initial drawing for testing:
38+
"rect 20 30 30 40".chars.each{ |c| @parser.update_line(c, 0) }
3639
end
3740

3841
def draw

spec/simple_live_coding_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require 'spec_helper'
2+
3+
describe RubyDraw do
4+
let(:app) { RubyDraw.new :title => "app" }
5+
6+
describe "app" do
7+
it "should open window" do
8+
$app.width.should == 700
9+
end
10+
end
11+
12+
end

spec/spec_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'rspec'
2+
require './simple_live_coding'
3+
require './main/string_object'

spec/string_object_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'spec_helper'
2+
3+
describe StringObject do
4+
let(:app) { RubyDraw.new :title => "app" }
5+
6+
describe "#append" do
7+
it "appends key to @content" do
8+
s_object = StringObject.new("")
9+
s_object.append("S")
10+
s_object.content.should == "S"
11+
end
12+
end
13+
14+
end

0 commit comments

Comments
 (0)