diff --git a/app.rb b/app.rb new file mode 100644 index 0000000..c419b6d --- /dev/null +++ b/app.rb @@ -0,0 +1,8 @@ +require 'sinatra' +require 'haml' + +set :app_file, __FILE__ + +get '/' do + haml :home +end diff --git a/features/home.feature b/features/home.feature new file mode 100644 index 0000000..fef0631 --- /dev/null +++ b/features/home.feature @@ -0,0 +1,4 @@ +Feature: + Scenario: / returns the sinatra environment + When GET on / + Then body is "test!" diff --git a/features/steps/generic.rb b/features/steps/generic.rb new file mode 100644 index 0000000..f31d21c --- /dev/null +++ b/features/steps/generic.rb @@ -0,0 +1,7 @@ +When /GET on (.*)/ do |path| + get path +end + +Then /body is "(.*)"/ do |text| + last_response.body.strip.should == text +end diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000..937df5d --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,17 @@ +require 'sinatra' + +set :app_file, File.dirname(__FILE__) + "/../../app" +set :environment, :test + +require Sinatra::Application.app_file + +require 'spec' +require 'spec/expectations' +require 'rack/test' + +World do + def app + Sinatra::Application + end + include Rack::Test::Methods +end diff --git a/views/home.haml b/views/home.haml new file mode 100644 index 0000000..c747d04 --- /dev/null +++ b/views/home.haml @@ -0,0 +1 @@ +== #{Sinatra::Application.environment}! \ No newline at end of file