4info 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/4info.gemspec +1 -1
- data/README.markdown +2 -0
- data/VERSION +1 -1
- data/lib/contactable.rb +5 -0
- data/test/four_info_contactable_test.rb +10 -0
- metadata +1 -1
data/4info.gemspec
CHANGED
data/README.markdown
CHANGED
@@ -34,6 +34,8 @@ You can manage the user's SMS state like so:
|
|
34
34
|
@user.confirm_sms!
|
35
35
|
# then ask the user for the confirmation code and
|
36
36
|
# compare it to @user.sms_confirmation_code
|
37
|
+
# if they're the same, call
|
38
|
+
@user.sms_confirmed!
|
37
39
|
@user.update_attributes(:sms_confirmed_phone_number => @user.sms_phone_number)
|
38
40
|
@user.send_sms!("Hi! This is a text message.")
|
39
41
|
# Then maybe the user will reply with 'BLOCK' by accident
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/lib/contactable.rb
CHANGED
@@ -75,6 +75,11 @@ module FourInfo
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def sms_confirmed!
|
79
|
+
# save the phone number into the 'confirmed phone number' attribute
|
80
|
+
four_info_sms_confirmed_phone_number four_info_sms_phone_number
|
81
|
+
end
|
82
|
+
|
78
83
|
def unblock_sms!
|
79
84
|
return false unless four_info_sms_blocked?
|
80
85
|
|
@@ -97,6 +97,16 @@ class FourInfoContactableTest < ActiveSupport::TestCase
|
|
97
97
|
should "not have number confirmed yet" do
|
98
98
|
assert !@user.current_phone_number_confirmed_for_sms?
|
99
99
|
end
|
100
|
+
context "calling sms_confirmed!" do
|
101
|
+
setup { @user.sms_confirmed! }
|
102
|
+
should "save the phone number into the confirmed attribute" do
|
103
|
+
assert_equal @user.four_info_sms_confirmed_phone_number,
|
104
|
+
@user.four_info_sms_phone_number
|
105
|
+
end
|
106
|
+
should_change "confirmed phone number attribuet" do
|
107
|
+
@user.four_info_sms_confirmed_phone_number
|
108
|
+
end
|
109
|
+
end
|
100
110
|
end
|
101
111
|
context "confirming phone number when the confirmation fails for some reason" do
|
102
112
|
setup {
|