Skip to content

Commit

Permalink
Add sinatra demo
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Sep 26, 2011
1 parent 5844698 commit a889c77
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rvmrc
@@ -0,0 +1 @@
rvm use --create 1.9.2@sinatra_test
8 changes: 8 additions & 0 deletions Gemfile
@@ -0,0 +1,8 @@
source :rubygems

gem 'sinatra'

group :test do
gem 'capybara'
gem 'spinach'
end
48 changes: 48 additions & 0 deletions 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
10 changes: 10 additions & 0 deletions 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
19 changes: 19 additions & 0 deletions 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
5 changes: 5 additions & 0 deletions features/support/env.rb
@@ -0,0 +1,5 @@
require 'spinach/capybara'

require_relative '../../app'

Capybara.app = Sinatra::Application
10 changes: 10 additions & 0 deletions 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.