Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Emma Lindsay
committed
Oct 28, 2010
1 parent
b036621
commit 70f6c08
Showing
3 changed files
with
64 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: Dates generated by instalover | ||
|
||
Scenario: Instalover generates dates for users | ||
Given the following users exist: | ||
| Phone Number | Male | Female | Looking For Male | Looking For Female | Dob | Looking For Minimum Age | Looking For Maximum Age | Description | Name | | ||
| 11111111111 | true | false | false | true | 11/06/1989 | 18 | 34 | red hair | Mike | | ||
| 12222222222 | true | false | false | true | 10/20/1989 | 18 | 34 | black shirt | Jason | | ||
| 18004688487 | false| true | true | false | 12/31/1977 | 14 | 22 | super hot | Emma | | ||
| 13333333333 | false| true | true | false | 12/32/1980 | 14 | 30 | super hot | Emma | | ||
And the day and time is "October 16, 2010 8:00pm edt" | ||
And the following date suggestions exist: | ||
| text | | ||
| Silvertone | | ||
| Mike's Apartment | | ||
When I run the rake task "instalover:ping_female_dates" | ||
Then "13333333333" should get a text whose message includes "Should we find you a date " | ||
Then "18004688487" should get a text whose message includes "Should we find you a date " | ||
|
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,38 @@ | ||
require 'rake' | ||
|
||
# Do not re-load the environment task | ||
class Rake::Task | ||
def invoke_prerequisites(task_args, invocation_chain) | ||
@prerequisites.reject{|n| n == "environment"}.each do |n| | ||
prereq = application[n, @scope] | ||
prereq_args = task_args.new_scope(prereq.arg_names) | ||
prereq.invoke_with_call_chain(prereq_args, invocation_chain) | ||
end | ||
end | ||
end | ||
|
||
When /^I run the rake task "([^\"]*)"$/ do |task_name| | ||
# Make sure you're in the RAILS_ROOT | ||
oldpwd = Dir.pwd | ||
Dir.chdir(RAILS_ROOT) | ||
old_args = ARGV.dup | ||
ARGV.clear | ||
|
||
# Get an instance of rake | ||
rake_app = Rake.application | ||
rake_app.options.silent = true | ||
|
||
# Back to where you were | ||
Dir.chdir(oldpwd) | ||
|
||
rake_app.init | ||
rake_app.load_rakefile | ||
|
||
task = rake_app.tasks.detect {|t| t.name == task_name} | ||
assert_not_nil task, "No rake task defined: #{task_name}" | ||
task.reenable | ||
task.invoke | ||
|
||
ARGV.unshift(*old_args) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace :instalover do | ||
desc "Ping women for dates to poke the pot" | ||
task :ping_female_dates => :environment do | ||
User.women.each do |w| | ||
Message.handle_new_date(w) | ||
end | ||
end | ||
end |