Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- move modules to features/support - reorganize modules for greater consistency - reorganize steps in GWT order - put similar steps together, so its easier to spot inconsistencies features passing
- Loading branch information
Showing
6 changed files
with
86 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
module LocationSH | ||
def no_op; end | ||
|
||
def custom_location | ||
default_location+'.custom' | ||
end | ||
|
||
end | ||
World LocationSH | ||
|
||
Given(/^I have a custom location$/) do | ||
Given /^I have a custom location$/ do | ||
# hooks.rb setups a custom location, so we don't have to do anything here | ||
no_op | ||
end | ||
|
||
When(/^I add a task with a custom location$/) do | ||
When /^I add a task with a custom location$/ do | ||
add_task location: custom_location | ||
end | ||
|
||
Then(/^my task should be stored in the custom location$/) do | ||
Then "my task should be stored in the default location" do | ||
task_present | ||
end | ||
|
||
Then /^my task should be stored in the custom location$/ do | ||
task_present(location: custom_location) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module CommandSH | ||
def runc(command) | ||
@output = `#{command}` | ||
end | ||
|
||
def xec(attrs) | ||
"#{executable}#{global_options(attrs)}" | ||
end | ||
|
||
def executable | ||
# must end with a space | ||
"todo " | ||
end | ||
|
||
def global_options(attrs) | ||
# must end with a space | ||
"-f #{attrs[:location]} " if attrs[:location] | ||
end | ||
end | ||
World CommandSH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module LocationSH | ||
def default_location | ||
Todo.location | ||
end | ||
|
||
def custom_location | ||
"#{default_location}.custom" | ||
end | ||
|
||
end | ||
World LocationSH | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module MiscSH | ||
|
||
def no_op; end | ||
|
||
def some; 3; end | ||
|
||
end | ||
World MiscSH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module TaskSH | ||
def add_task(attrs={}) | ||
command = "#{xec(attrs)} new 'New todo item'" | ||
runc command | ||
end | ||
|
||
def list_tasks(attrs={}) | ||
command = "#{xec(attrs)} list" | ||
runc command | ||
end | ||
|
||
def task_count | ||
`todo list | wc -l`.chomp.to_i | ||
end | ||
|
||
def task_present(attrs={}) | ||
loc = attrs[:location] || default_location | ||
count = attrs[:count] || 1 | ||
|
||
File.exist?(loc).should be_true | ||
File.open(loc) do |f| | ||
f.each_line.count.should == count | ||
end | ||
end | ||
|
||
def should_see_some_tasks | ||
@output.each_line.count.should == some | ||
end | ||
end | ||
World TaskSH | ||
|