diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb index 9eaf5c38..db121238 100644 --- a/features/step_definitions/todo_create_steps.rb +++ b/features/step_definitions/todo_create_steps.rb @@ -100,9 +100,13 @@ Given /^I have ([0-9]+) deferred todos$/ do |count| end Given /^I have a deferred todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name| + step "I have a deferred todo \"#{description}\" in the context \"#{context_name}\" deferred by 7 days" +end + +Given /^I have a (?:deferred )todo "([^"]*)" in the context "([^"]*)" deferred by (\d+) day(?:s)?$/ do |description, context_name, deferred_by_days| context = @current_user.contexts.where(:name => context_name).first_or_create todo = @current_user.todos.create!(:context_id => context.id, :description => description) - todo.show_from = UserTime.new(@current_user).time + 1.week + todo.show_from = UserTime.new(@current_user).time + deferred_by_days.to_i.day todo.save! end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index f3e8a091..e55029a3 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -110,6 +110,12 @@ Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| end end +Then /^(?:|I )should see "([^"]*)" before "([^"]*)"$/ do |earlier_content, later_content| + expect(page).to have_content(earlier_content) + expect(page).to have_content(later_content) + page.body.index(earlier_content).should < page.body.index(later_content) +end + Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| regexp = Regexp.new(regexp) with_scope(selector) do