Permalink
Browse files

got first spec passing

  • Loading branch information...
1 parent 63820aa commit 0ff573a9f56ce3d64fddf077c73a5d91c9641d5b @remi committed Nov 21, 2009
Showing with 50 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 app.js → db-testing.js
  3. +11 −0 spec/rack/app.js
  4. +11 −0 spec/rack/rack_spec.rb
  5. +24 −0 spec/spec_helper.rb
View
@@ -1 +1,2 @@
*.sw?
+./app.js
View
@@ -53,6 +53,9 @@ get('/db', function(){
each(db.columns("dogs"), function(i, column){
write("<ul>");
write(n("<li>name: {name}</li>", column));
+ each(column, function(key, value){
+ write(n("<li>{k}: {v}</li>", { k: key, v: value }));
+ });
write("</ul>");
});
View
@@ -0,0 +1,11 @@
+req(uire('rack/rack'));
+
+function rack_app(env) {
+ return [
+ 200,
+ {'Content-Type': 'text/plain'},
+ ["Hello World"]
+ ];
+}
+
+run(rack_app);
View
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe 'Rack' do
+
+ before(:all){ setup :rack }
+
+ it 'should be able to hit the server' do
+ get('/').body.should include('Hello World')
+ end
+
+end
View
@@ -0,0 +1,24 @@
+%w( rubygems spec httparty fileutils ).each {|lib| require lib }
+
+def asp_server
+ 'http://10.5.5.107/'
+end
+
+def get uri
+ HTTParty.get File.join(asp_server, uri)
+end
+
+def setup directory
+ FileUtils.cp path('spec', directory.to_s, 'app.js'), path('app.js')
+end
+
+def path *args
+ File.join root, *args.map {|arg| arg.to_s }
+end
+
+def root
+ File.join File.dirname(__FILE__), '..'
+end
+
+Spec::Runner.configure do |config|
+end

0 comments on commit 0ff573a

Please sign in to comment.