Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

spec files and rakefile

  • Loading branch information...
commit 998d9cfce42e904e14f617155e80607167b41edd 1 parent eabcd4b
bry4n authored
Showing with 48 additions and 0 deletions.
  1. +21 −0 Rakefile
  2. +12 −0 spec/app_spec.rb
  3. +15 −0 spec/spec_helper.rb
View
21 Rakefile
@@ -0,0 +1,21 @@
+require 'spec/rake/spectask'
+
+task :default => :test
+task :test => :spec
+
+if !defined?(Spec)
+ puts "rspec is required! - rake gems:install"
+else
+ desc "do the test first"
+ Spec::Rake::SpecTask.new('spec') do |t|
+ t.spec_files = FileList['spec/**/*.rb']
+ t.spec_opts = ['-cfs']
+ end
+end
+
+namespace :gems do
+ desc "install gems"
+ task :install do
+ %w{ sinatra rspec rack-test }.each {|gem| system "sudo gem install #{gem}" }
+ end
+end
View
12 spec/app_spec.rb
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + "/spec_helper"
+
+describe "main app" do
+ include Rack::Test::Methods
+ def app
+ Sinatra::Application.new
+ end
+ specify 'should show the welcome page' do
+ get '/welcome/'
+ last_response.should be_ok
+ end
+end
View
15 spec/spec_helper.rb
@@ -0,0 +1,15 @@
+require 'rubygems'
+require 'sinatra'
+require 'spec'
+require 'spec/interop/test'
+require 'rack/test'
+
+Sinatra::Base.set :environment, :test
+Sinatra::Base.set :run, false
+Sinatra::Base.set :raise_errors, true
+Sinatra::Base.set :logging, true
+
+require 'app'
+
+Spec::Runner.configure do |c|
+end
Please sign in to comment.
Something went wrong with that request. Please try again.