Skip to content
Browse files

Started sorting out the testing environment, now to add tests to a te…

…sting app... shame on me, I know.
  • Loading branch information...
1 parent a16ef2f commit 7a692a965ececd3113e2819648b08eb46901bf86 @markcipolla committed Jun 7, 2010
View
2 .bundle/config
@@ -0,0 +1,2 @@
+---
+BUNDLE_WITHOUT: ""
View
7 .components
@@ -0,0 +1,7 @@
+---
+:test: cucumber
+:orm: activerecord
+:script: jquery
+:mock: none
+:renderer: erb
+:stylesheet: none
View
7 .gitignore
@@ -0,0 +1,7 @@
+.DS_Store
+log/**/*
+tmp/**/*
+bin/*
+vendor/gems/*
+!vendor/gems/cache/
+.sass-cache/*
View
17 Gemfile
@@ -9,11 +9,18 @@ gem 'thin' # or mongrel
gem 'activerecord', :require => "active_record"
gem 'sqlite3-ruby', :require => "sqlite3"
+
# Test requirements
-gem 'rspec', :require => "spec", :group => "test"
-gem 'capybara', :group => "test"
-gem 'cucumber', :group => "test"
-gem 'rack-test', :require => 'rack/test', :group => 'test'
+group :test do
+ # gem "database_cleaner"
+ gem 'rspec', :require => "spec"
+ gem 'capybara'
+ gem 'cucumber'
+ gem 'rack-test', :require => 'rack/test'
+end
+
+# Gizmo
+gem 'gizmo', "0.0.5"
# Padrino
-gem 'padrino', "0.9.9"
+gem 'padrino', "0.9.9"
View
11 features/add.feature
@@ -1,11 +0,0 @@
-Feature: Addition
- In order to avoid silly mistakes
- As a math idiot
- I want to be told the sum of two numbers
-
- Scenario: Add two numbers
- Given I visit the calculator page
- And I fill in '50' for 'first'
- And I fill in '70' for 'second'
- When I press 'Add'
- Then I should see 'Answer: 120'
View
6 features/displaying_builds.feature
@@ -0,0 +1,6 @@
+Feature: Displaying build information
+
+Scenario: Display a build with a single set of tests
+Given a user has already entered a single build into the admin panel
+When a user views the dashboard
+Then a user is shown information of a single build
View
15 features/step_definitions/add_steps.rb
@@ -1,15 +0,0 @@
-Given /^I visit the calculator page$/ do
- visit '/add'
-end
-
-Given /^I fill in '(.*)' for '(.*)'$/ do |value, field|
- fill_in(field, :with => value)
-end
-
-When /^I press '(.*)'$/ do |name|
- click_button(name)
-end
-
-Then /^I should see '(.*)'$/ do |text|
- response_body.should contain(/#{text}/m)
-end
View
11 features/step_definitions/displaying_builds_steps.rb
@@ -0,0 +1,11 @@
+Given /^a user has already entered a single build into the admin panel$/ do
+ pending # express the regexp above with the code you wish you had
+end
+
+When /^a user views the dashboard$/ do
+ pending # express the regexp above with the code you wish you had
+end
+
+Then /^a user is shown information of a single build$/ do
+ pending # express the regexp above with the code you wish you had
+end
View
18 features/support/env.rb
@@ -1,10 +1,22 @@
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
require File.expand_path(File.dirname(__FILE__) + "/../../config/boot")
-
-require 'capybara/cucumber'
require 'spec/expectations'
+require 'capybara/cucumber'
+
+require 'gizmo'
+require 'features/support/patches/capybara'
+#require 'ruby-debug'
+World(Gizmo::Helpers)
##
-# You can hanlde all padrino applications using instead:
+# You can handle all padrino applications using instead:
# Padrino.application
Capybara.app = HudsonDashboard.tap { |app| }
+
+Capybara.default_selector = :xpath
+
+Capybara.default_driver = :selenium
+
+Capybara.app_host = 'http://localhost:3000'
+
+Capybara.run_server = false
View
3 features/support/patches/capybara.rb
@@ -0,0 +1,3 @@
+module Capybara
+ alias :response :page
+end
View
20 lib/tasks/cucumber.rake
@@ -0,0 +1,20 @@
+require 'rake'
+require 'bundler'
+begin
+ Bundler.setup(:runtime, :test)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+
+begin
+ require 'cucumber/rake/task'
+ Cucumber::Rake::Task.new(:features)
+
+ # task :features => :check_dependencies
+rescue LoadError
+ task :features do
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
+ end
+end

0 comments on commit 7a692a9

Please sign in to comment.
Something went wrong with that request. Please try again.