Skip to content

Commit

Permalink
Added initial steps and specs for our new FeatureFile class, which wi…
Browse files Browse the repository at this point in the history
…ll handle the manipulation of our cucumber features.
  • Loading branch information
baphled committed Jan 18, 2010
1 parent 7590da5 commit c058040
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
22 changes: 22 additions & 0 deletions features/plain/feature_files.feature
@@ -0,0 +1,22 @@
Feature: We need a way to handle out feature files
# Main goal of this project
In order to improve the way we handle feature imports
As Salad
I want to be able to read feature files and store its information

Scenario: A FeatureFile can gives an error if the file referenced is not a cucumber feature file
Given we create a FeatureFile from a none cucumber feature file
Then the object should be invalid

Scenario: A FeatureFile should be valid if the file references is a cucumber file
Given we create a FeatureFile from a cucumber feature file
Then the object should be valid

Scenario: A FeatureFile should store the 'Feature' heading
Given we create a FeatureFile from a cucumber feature file
Then the object should be valid
And the feature property should not be null

Scenario: A FeatureFile should store the 'In order' heading
Scenario: A FeatureFile should store the 'I want' heading
Scenario: A FeatureFile should store the feature files scenario's
19 changes: 19 additions & 0 deletions features/step_definitions/feature_file_steps.rb
@@ -0,0 +1,19 @@
Given /^we create a FeatureFile from a none cucumber feature file$/ do
@file = FeatureFile.new("#{RAILS_ROOT}/fixtures/project.yml")
end

Given /^we create a FeatureFile from a cucumber feature file$/ do
@file = FeatureFile.new("#{RAILS_ROOT}/fixtures/test.feature")
end

Then /^the object should be valid$/ do
@file.should_not be_invalid
end

Then /^the feature property should not be null$/ do
pending # express the regexp above with the code you wish you had
end

Then /^the object should be invalid$/ do
@file.should be_invalid
end
15 changes: 15 additions & 0 deletions lib/feature_file.rb
@@ -0,0 +1,15 @@
class FeatureFile < File
@file = nil

def initialize featureFile
@file = featureFile
end

def invalid?
if @file =~ /^(.*).feature$/
false
else
true
end
end
end

0 comments on commit c058040

Please sign in to comment.