Browse files

Add sinatra demo

  • Loading branch information...
1 parent 5844698 commit a889c77bcf9229be19df29db8ab8b8943b72a5af @josepjaume josepjaume committed Sep 26, 2011
Showing with 101 additions and 0 deletions.
  1. +1 −0 .rvmrc
  2. +8 −0 Gemfile
  3. +48 −0 Gemfile.lock
  4. +10 −0 app.rb
  5. +19 −0 features/steps/test.rb
  6. +5 −0 features/support/env.rb
  7. +10 −0 features/test_feature.feature
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use --create 1.9.2@sinatra_test
View
8 Gemfile
@@ -0,0 +1,8 @@
+source :rubygems
+
+gem 'sinatra'
+
+group :test do
+ gem 'capybara'
+ gem 'spinach'
+end
View
48 Gemfile.lock
@@ -0,0 +1,48 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ capybara (1.1.1)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.2.2)
+ ffi (~> 1.0.6)
+ colorize (0.5.8)
+ ffi (1.0.9)
+ gherkin (2.5.1)
+ json (>= 1.4.6)
+ json (1.6.1)
+ json_pure (1.6.1)
+ mime-types (1.16)
+ minitest (2.6.0)
+ nokogiri (1.5.0)
+ rack (1.3.3)
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rubyzip (0.9.4)
+ selenium-webdriver (2.7.0)
+ childprocess (>= 0.2.1)
+ ffi (>= 1.0.7)
+ json_pure
+ rubyzip
+ sinatra (1.2.6)
+ rack (~> 1.1)
+ tilt (< 2.0, >= 1.2.2)
+ spinach (0.0.2)
+ colorize
+ gherkin
+ minitest
+ tilt (1.3.3)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capybara
+ sinatra
+ spinach
View
10 app.rb
@@ -0,0 +1,10 @@
+require 'bundler/setup'
+require 'sinatra'
+
+get '/' do
+ '<p>Hello world!</p><a href="/goodbye">goodbye</a>'
+end
+
+get '/goodbye' do
+ 'Goodbye!'
+end
View
19 features/steps/test.rb
@@ -0,0 +1,19 @@
+class Test < Spinach::Feature
+ feature "Application test"
+
+ Given "I am on the front page" do
+ visit '/'
+ end
+
+ Then "I should see a salutation" do
+ page.has_content?("Hello").must_equal true
+ end
+
+ When "I click on the first link" do
+ page.find("a:first").click
+ end
+
+ Then "I should see goodbye" do
+ page.has_content?("Goodbye").must_equal true
+ end
+end
View
5 features/support/env.rb
@@ -0,0 +1,5 @@
+require 'spinach/capybara'
+
+require_relative '../../app'
+
+Capybara.app = Sinatra::Application
View
10 features/test_feature.feature
@@ -0,0 +1,10 @@
+Feature: Application test
+
+ Scenario: Hello world
+ Given I am on the front page
+ Then I should see a salutation
+
+ Scenario: Goodbye
+ Given I am on the front page
+ When I click on the first link
+ Then I should see goodbye

0 comments on commit a889c77

Please sign in to comment.