Skip to content
Browse files

Filling out more of the step definitions

  • Loading branch information...
1 parent da30a7e commit bf559dc33d6f7eff8fd22eb23dc015564178f788 @qrush qrush committed Jul 13, 2009
Showing with 43 additions and 32 deletions.
  1. +9 −13 features/grading_projects.feature
  2. +28 −11 features/step_definitions/report_card_steps.rb
  3. +6 −8 features/support/env.rb
View
22 features/grading_projects.feature
@@ -4,12 +4,10 @@ Feature: Grading projects
In order to improve it and make it awesome
Scenario: Grading public projects
- Given I have integrity setup in the "integrity" directory
- And I have a public integrity project called "factory_girl"
- And I have a public integrity project called "clearance"
- And I have a configuration file with "url" set to "http://metrics.thoughtbot.com"
- And I have a configuration file with "integrity_config" set to "integrity/config.yml"
- And I have a configuration file with "site" set to "_site"
+ Given I have integrity setup
+ And I have a public integrity project named "factory_girl"
+ And I have a public integrity project named "clearance"
+ And I have a basic site configuration
When I run "rake grade"
@@ -22,13 +20,11 @@ Feature: Grading projects
And the template files should exist in "_site"
Scenario: Grading public and private projects
- Given I have integrity setup in the "integrity" directory
- And I have a public integrity project called "factory_girl"
- And I have a public integrity project called "clearance"
- And I have a private integrity project called "paperclip"
- And I have a configuration file with "url" set to "http://metrics.thoughtbot.com"
- And I have a configuration file with "integrity_config" set to "integrity/config.yml"
- And I have a configuration file with "site" set to "_site"
+ Given I have integrity setup
+ And I have a public integrity project named "factory_girl"
+ And I have a public integrity project named "clearance"
+ And I have a private integrity project named "paperclip"
+ And I have a basic site configuration
When I run "rake grade"
View
39 features/step_definitions/report_card_steps.rb
@@ -1,32 +1,49 @@
-Given /^I have integrity setup in the "([^\"]*)" directory$/ do |dir|
- `integrity install #{File.join(TEST_DIR, dir)}`
- `integrity migrate_db #{File.join(TEST_DIR, dir, "config.yml")}`
+Given /^I have integrity setup/ do
+ `integrity install #{INTEGRITY_DIR}`
+ `integrity migrate_db #{INTEGRITY_CONFIG}`
end
-Given /^I have a (private|public) integrity project called "([^\"]*)"$/ do |access, name|
- pending
+Given /^I have a (private|public) integrity project named "([^\"]*)"$/ do |access, name|
+ Integrity.new(INTEGRITY_CONFIG)
+ project = Integrity::Project.create(:name => name,
+ :uri => "git://github.com/thoughtbot/#{name}",
+ :public => (access == "public"))
+ print project.build
end
Given /^I have a configuration file with "([^\"]*)" set to "([^\"]*)"$/ do |key, value|
- pending
+ File.open(File.join(TEST_DIR, 'config.yml'), 'a') do |f|
+ f.write("#{key}: #{value}\n")
+ f.close
+ end
end
+Given /^I have a basic site configuration$/ do
+ Given %{I have a configuration file with "url" set to "http://metrics.thoughtbot.com"}
+ And %{I have a configuration file with "integrity_config" set to "integrity/config.yml"}
+ And %{I have a configuration file with "site" set to "_site"}
+end
+
+
When /^I run "([^\"]*)"$/ do |command|
- pending
+ print `#{command} --trace`
end
Then /^the "([^\"]*)" file should exist$/ do |name|
- pending
+ assert File.file?(file)
end
Then /^I should see "([^\"]*)" in "([^\"]*)"$/ do |text, file|
- pending
+ assert_match Regexp.new(text), File.read(file)
end
Then /^the "([^\"]*)" directory should exist$/ do |name|
- pending
+ assert File.directory?(dir)
end
Then /^the template files should exist in "([^\"]*)"$/ do |dir|
- pending
+ Then %{the "_site/buttons.css" file should exist"}
+ And %{the "_site/reset.css" file should exist"}
+ And %{the "_site/integrity.css" file should exist"}
+ And %{the "_site/favicon.ico" file should exist"}
end
View
14 features/support/env.rb
@@ -1,18 +1,16 @@
require 'test/unit'
require 'report_card'
-TEST_DIR = File.join('/', 'tmp', 'report_card')
+TEST_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
+INTEGRITY_DIR = File.join(TEST_DIR, 'integrity')
+INTEGRITY_CONFIG = File.join(INTEGRITY_DIR, 'config.yml')
World do
include Test::Unit::Assertions
end
-Before do
- FileUtils.mkdir(TEST_DIR)
-# Dir.chdir(TEST_DIR)
-end
-
After do
-# Dir.chdir(TEST_DIR)
- FileUtils.rm_rf(TEST_DIR)
+ FileUtils.rm_rf(INTEGRITY_DIR)
+ FileUtils.rm_rf(File.join(TEST_DIR, '_site'))
+ FileUtils.rm_rf(File.join(TEST_DIR, 'config.yml'))
end

0 comments on commit bf559dc

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