added the empty email spec
This commit is contained in:
parent
8bc857cf4d
commit
be57170bf9
3 changed files with 20 additions and 11 deletions
22
Gemfile.lock
22
Gemfile.lock
|
|
@ -46,7 +46,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/zhitomirskiyi/devise_invitable.git
|
remote: git://github.com/zhitomirskiyi/devise_invitable.git
|
||||||
revision: a52f9638f900c1af77855ec357a0c861fbb12e83
|
revision: 5f74da32a81a2332bac266316dab333a4eed9525
|
||||||
specs:
|
specs:
|
||||||
devise_invitable (0.4.rc)
|
devise_invitable (0.4.rc)
|
||||||
devise (~> 1.2.rc)
|
devise (~> 1.2.rc)
|
||||||
|
|
@ -128,7 +128,7 @@ GEM
|
||||||
uuidtools
|
uuidtools
|
||||||
childprocess (0.1.6)
|
childprocess (0.1.6)
|
||||||
ffi (~> 0.6.3)
|
ffi (~> 0.6.3)
|
||||||
closure-compiler (0.3.3)
|
closure-compiler (1.0.0)
|
||||||
cloudfiles (1.4.10)
|
cloudfiles (1.4.10)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
columnize (0.3.2)
|
columnize (0.3.2)
|
||||||
|
|
@ -142,7 +142,7 @@ GEM
|
||||||
term-ansicolor (~> 1.0.5)
|
term-ansicolor (~> 1.0.5)
|
||||||
cucumber-rails (0.3.2)
|
cucumber-rails (0.3.2)
|
||||||
cucumber (>= 0.8.0)
|
cucumber (>= 0.8.0)
|
||||||
culerity (0.2.14)
|
culerity (0.2.15)
|
||||||
daemons (1.1.0)
|
daemons (1.1.0)
|
||||||
database_cleaner (0.6.0)
|
database_cleaner (0.6.0)
|
||||||
devise (1.2.rc)
|
devise (1.2.rc)
|
||||||
|
|
@ -153,7 +153,7 @@ GEM
|
||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
eventmachine (0.12.10)
|
eventmachine (0.12.10)
|
||||||
excon (0.3.4)
|
excon (0.4.0)
|
||||||
extlib (0.9.15)
|
extlib (0.9.15)
|
||||||
factory_girl (1.3.3)
|
factory_girl (1.3.3)
|
||||||
factory_girl_rails (1.0.1)
|
factory_girl_rails (1.0.1)
|
||||||
|
|
@ -193,12 +193,12 @@ GEM
|
||||||
closure-compiler (>= 0.1.0)
|
closure-compiler (>= 0.1.0)
|
||||||
yui-compressor (>= 0.9.1)
|
yui-compressor (>= 0.9.1)
|
||||||
json (1.4.6)
|
json (1.4.6)
|
||||||
json_pure (1.4.6)
|
json_pure (1.5.1)
|
||||||
launchy (0.3.7)
|
launchy (0.3.7)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
linecache (0.43)
|
linecache (0.43)
|
||||||
mail (2.2.14)
|
mail (2.2.15)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
|
|
@ -222,7 +222,7 @@ GEM
|
||||||
multipart-post (1.1.0)
|
multipart-post (1.1.0)
|
||||||
mysql2 (0.2.6)
|
mysql2 (0.2.6)
|
||||||
net-ldap (0.1.1)
|
net-ldap (0.1.1)
|
||||||
net-ssh (2.0.23)
|
net-ssh (2.0.24)
|
||||||
nokogiri (1.4.3.1)
|
nokogiri (1.4.3.1)
|
||||||
oa-basic (0.1.6)
|
oa-basic (0.1.6)
|
||||||
multi_json (~> 0.0.2)
|
multi_json (~> 0.0.2)
|
||||||
|
|
@ -306,7 +306,7 @@ GEM
|
||||||
rspec-core (2.4.0)
|
rspec-core (2.4.0)
|
||||||
rspec-expectations (2.4.0)
|
rspec-expectations (2.4.0)
|
||||||
diff-lcs (~> 1.1.2)
|
diff-lcs (~> 1.1.2)
|
||||||
rspec-instafail (0.1.5)
|
rspec-instafail (0.1.6)
|
||||||
rspec-mocks (2.4.0)
|
rspec-mocks (2.4.0)
|
||||||
rspec-rails (2.4.1)
|
rspec-rails (2.4.1)
|
||||||
actionpack (~> 3.0)
|
actionpack (~> 3.0)
|
||||||
|
|
@ -344,7 +344,7 @@ GEM
|
||||||
eventmachine (>= 0.12.6)
|
eventmachine (>= 0.12.6)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
tilt (1.2.1)
|
tilt (1.2.2)
|
||||||
treetop (1.4.9)
|
treetop (1.4.9)
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.24)
|
tzinfo (0.3.24)
|
||||||
|
|
@ -357,8 +357,8 @@ GEM
|
||||||
addressable (>= 2.2.2)
|
addressable (>= 2.2.2)
|
||||||
crack (>= 0.1.7)
|
crack (>= 0.1.7)
|
||||||
will_paginate (3.0.pre2)
|
will_paginate (3.0.pre2)
|
||||||
xml-simple (1.0.12)
|
xml-simple (1.0.13)
|
||||||
yui-compressor (0.9.1)
|
yui-compressor (0.9.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ class Invitation < ActiveRecord::Base
|
||||||
opts[:from].save!
|
opts[:from].save!
|
||||||
invitee.reload
|
invitee.reload
|
||||||
end
|
end
|
||||||
|
pp opts[:service]
|
||||||
|
pp opts[:service] == 'email'
|
||||||
invitee.invite!(:email => (opts[:service] == 'email'))
|
invitee.invite!(:email => (opts[:service] == 'email'))
|
||||||
Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}")
|
Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}")
|
||||||
invitee
|
invitee
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,7 @@ describe Invitation do
|
||||||
|
|
||||||
it 'mails the optional message' do
|
it 'mails the optional message' do
|
||||||
new_user = Invitation.create_invitee(@valid_params)
|
new_user = Invitation.create_invitee(@valid_params)
|
||||||
|
pp Devise.mailer.deliveries
|
||||||
Devise.mailer.deliveries.first.to_s.include?(@message).should be_true
|
Devise.mailer.deliveries.first.to_s.include?(@message).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -252,6 +253,12 @@ describe Invitation do
|
||||||
new_user.should_not be_persisted
|
new_user.should_not be_persisted
|
||||||
new_user.should have(1).error_on(:email)
|
new_user.should have(1).error_on(:email)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not save a user with an empty string email' do
|
||||||
|
@valid_params[:service] = 'facebook'
|
||||||
|
@valid_params[:identifier] = '3423423'
|
||||||
|
Invitation.create_invitee(@valid_params).email.should_not == ''
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with no inviter' do
|
context 'with no inviter' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue