Some basic cucumber features and a hello world sinatra app

This commit is contained in:
R. Tyler Croy 2011-10-31 21:54:35 -07:00
parent be03d1fb50
commit 3b849d88c3
5 changed files with 84 additions and 0 deletions

6
Rakefile Normal file
View File

@ -0,0 +1,6 @@
require 'rubygems'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format pretty"
end

8
app.rb Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
get '/' do
"Hello, world!"
end

View File

@ -0,0 +1,22 @@
Feature: Convert a git repository to RCS
Scenario: Convert a non-imported repo
Given a repository that has never been converted
When I ask for it to be imported
Then I should see a convert job enqueued
And I should see a worker spin up
And I should be given the RCS repo
Scenario: Re-use an existing imported repo
Given a repository that has been converted already
When I ask for it to be imported
Then I should see no jobs enqueued
And I should be given the RCS repo
Scenario: Update an existing but out of date imported repo
Given a repository that has been converted already
And the repository is out of date
When I ask for it to be imported
Then I should see an update job enqueued
And I should see a worker spin up
And I should be given the RCS repo

21
features/profile.feature Normal file
View File

@ -0,0 +1,21 @@
Feature: Generate a user's RCSHub profile
Scenario: View a profile with no repos
Given a user with 0 repositories
When I visit the user's profile
Then I should see 0 repositories
Scenario: View a profile with a single repo
Given a user with 1 repositories
When I visit the user's profile
Then I should see 1 repositories
Scenario: View a profile with an empty timeline
Given a user with 0 timeline events
When I visit the user's profile
Then I should see 0 timeline events
Scenario: View a profile with a populated timeline
Given a user with 1 timeline events
When I visit the user's profile
Then I should see 1 timeline events

27
features/support/env.rb Normal file
View File

@ -0,0 +1,27 @@
app_file = File.join(File.dirname(__FILE__), *%w[.. .. app.rb])
require app_file
# Force the application name because polyglot breaks the auto-detection logic.
Sinatra::Application.app_file = app_file
require 'rubygems'
require 'spec/expectations'
require 'rack/test'
require 'webrat'
Webrat.configure do |config|
config.mode = :rack
end
class MyWorld
include Rack::Test::Methods
include Webrat::Methods
include Webrat::Matchers
Webrat::Methods.delegate_to_session :response_code, :response_body
def app
Sinatra::Application
end
end
World{MyWorld.new}