mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 17:28:50 +01:00
add cucumber for integration testing and add a feature for statistics
refactor some stuff to support testing statistisc
This commit is contained in:
parent
058079a0a7
commit
43440eaf33
11 changed files with 286 additions and 5 deletions
31
features/step_definitions/todo_steps.rb
Normal file
31
features/step_definitions/todo_steps.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Given /^I have no todos$/ do
|
||||
Todo.delete_all
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) todos$/ do |count|
|
||||
context = @current_user.contexts.create!(:name => "context A")
|
||||
count.to_i.downto 1 do |i|
|
||||
@current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) deferred todos$/ do |count|
|
||||
context = @current_user.contexts.create!(:name => "context B")
|
||||
count.to_i.downto 1 do |i|
|
||||
@current_user.todos.create!(:context_id => context.id, :description => "todo #{i}", :show_from => @current_user.time + 1.week)
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos$/ do |count|
|
||||
context = @current_user.contexts.create!(:name => "context C")
|
||||
count.to_i.downto 1 do |i|
|
||||
todo = @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
|
||||
todo.complete!
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see ([0-9]+) todos$/ do |count|
|
||||
count.to_i.downto 1 do |i|
|
||||
match_xpath "div["
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue