Browse files

people now default to opt-out instead of opt-in

  • Loading branch information...
1 parent 0cc5726 commit e4761b426ab263e1f307b696222b37d647754e36 @needfeed needfeed committed Jul 7, 2011
Showing with 13 additions and 13 deletions.
  1. +4 −5 app/views/notifier/remind.html.haml
  2. +2 −2 db/schema.rb
  3. +1 −1 lib/lottery.rb
  4. +3 −3 spec/lib/lottery_spec.rb
  5. +1 −0 spec/mailers/notifier_spec.rb
  6. +2 −2 spec/spec_helper.rb
View
9 app/views/notifier/remind.html.haml
@@ -5,10 +5,9 @@
%ul
%li
<b>Yes!</b>
- Cool. You'll get an email tomorrow with your lunch mates.
+ Click
+ = link_to "here", person_token_url(@person.authentication_token, :person => {:opt_in => true})
+ to opt in for this week's lunch.
%li
- <b>No, I'm busy.</b>
- Ok, click
- = link_to "here", person_token_url(@person.authentication_token, :person => {:opt_in => false})
- to opt out for this week only.
+ <b>No, I'm busy and will be sad instead.</b>
View
4 db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110628032726) do
+ActiveRecord::Schema.define(:version => 20110707223322) do
create_table "locations", :force => true do |t|
t.string "name"
@@ -24,7 +24,7 @@
t.datetime "created_at"
t.datetime "updated_at"
t.string "authentication_token"
- t.boolean "opt_in", :default => true, :null => false
+ t.boolean "opt_in", :default => false, :null => false
t.integer "location_id"
end
View
2 lib/lottery.rb
@@ -8,7 +8,7 @@ def self.send_invitations!
end
end
- Person.update_all :opt_in => true
+ Person.update_all :opt_in => false
end
def self.send_reminders!
View
6 spec/lib/lottery_spec.rb
@@ -4,12 +4,12 @@
describe ".send_invitations!" do
before do
@pivotal = Location.create!(:name => "pivotal")
- @pivotal_people = new_people(7, @pivotal)
+ @pivotal_people = new_people(7, @pivotal, true)
@pivotal_people.first.opt_in = false
@pivotal_people.each(&:save!)
@storek = Location.create!(:name => "storek")
- @storek_people = new_people(3, @storek)
+ @storek_people = new_people(3, @storek, true)
@storek_people.each(&:save!)
Lottery.send_invitations!
@@ -27,7 +27,7 @@
end
it "resets the opt-in flag" do
- Person.opted_in.length.should == 10
+ Person.opted_in.length.should == 0
end
end
View
1 spec/mailers/notifier_spec.rb
@@ -15,6 +15,7 @@
message.to.should == [@person.email]
message.from.should == ["dine@lunchlottery.com"]
message.body.to_s.should match /Hello/
+ message.body.to_s.should include person_token_url(@person.authentication_token, :person => {:opt_in => true})
message.body.to_s.should match /http:\/\/lunchlottery\.com\/people/
end
end
View
4 spec/spec_helper.rb
@@ -36,9 +36,9 @@
ActionMailer::Base.deliveries = []
end
- def new_people(count = 8, location = Location.new)
+ def new_people(count = 8, location = Location.new, opt_in = false)
(1..count).map do |i|
- Person.new(:email => "#{location.name}_#{i}@example.com", :location => location)
+ Person.new(:email => "#{location.name}_#{i}@example.com", :location => location, :opt_in => opt_in)
end
end

0 comments on commit e4761b4

Please sign in to comment.