Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
a54ad95e87
4 changed files with 29 additions and 24 deletions
2
Gemfile
2
Gemfile
|
|
@ -101,6 +101,8 @@ group :test, :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
gem 'mysql2', '0.2.6'
|
||||||
|
gem 'pg'
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
gem 'fixture_builder', '0.2.2'
|
gem 'fixture_builder', '0.2.2'
|
||||||
gem 'selenium-webdriver', '2.4'
|
gem 'selenium-webdriver', '2.4'
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,7 @@ GEM
|
||||||
oa-openid (= 0.2.6)
|
oa-openid (= 0.2.6)
|
||||||
open4 (1.1.0)
|
open4 (1.1.0)
|
||||||
orm_adapter (0.0.5)
|
orm_adapter (0.0.5)
|
||||||
|
pg (0.11.0)
|
||||||
polyglot (0.3.2)
|
polyglot (0.3.2)
|
||||||
pyu-ruby-sasl (0.0.3.3)
|
pyu-ruby-sasl (0.0.3.3)
|
||||||
rack (1.2.3)
|
rack (1.2.3)
|
||||||
|
|
@ -498,6 +499,7 @@ DEPENDENCIES
|
||||||
oauth2-provider (= 0.0.16)
|
oauth2-provider (= 0.0.16)
|
||||||
ohai (= 0.5.8)
|
ohai (= 0.5.8)
|
||||||
omniauth (= 0.2.6)
|
omniauth (= 0.2.6)
|
||||||
|
pg
|
||||||
rails (= 3.0.9)
|
rails (= 3.0.9)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rcov
|
rcov
|
||||||
|
|
|
||||||
|
|
@ -233,10 +233,10 @@ describe 'a user receives a post' do
|
||||||
receive_with_zord(bob, alice.person, xml)
|
receive_with_zord(bob, alice.person, xml)
|
||||||
receive_with_zord(eve, alice.person, xml)
|
receive_with_zord(eve, alice.person, xml)
|
||||||
|
|
||||||
@comment = eve.comment('tada',:post => @post)
|
comment = eve.comment('tada',:post => @post)
|
||||||
@comment.parent_author_signature = @comment.sign_with_key(alice.encryption_key)
|
comment.parent_author_signature = comment.sign_with_key(alice.encryption_key)
|
||||||
@xml = @comment.to_diaspora_xml
|
@xml = comment.to_diaspora_xml
|
||||||
@comment.delete
|
comment.delete
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should correctly attach the user already on the pod' do
|
it 'should correctly attach the user already on the pod' do
|
||||||
|
|
@ -254,17 +254,14 @@ describe 'a user receives a post' do
|
||||||
eve.delete
|
eve.delete
|
||||||
Person.where(:id => remote_person.id).delete_all
|
Person.where(:id => remote_person.id).delete_all
|
||||||
Profile.where(:person_id => remote_person.id).delete_all
|
Profile.where(:person_id => remote_person.id).delete_all
|
||||||
remote_person.id = nil
|
remote_person.attributes.delete(:id) # leaving a nil id causes it to try to save with id set to NULL in postgres
|
||||||
|
|
||||||
Person.should_receive(:by_account_identifier).twice.and_return{ |handle|
|
m = mock()
|
||||||
if handle == alice.person.diaspora_handle
|
Webfinger.should_receive(:new).twice.with(eve.person.diaspora_handle).and_return(m)
|
||||||
alice.person.save
|
m.should_receive(:fetch).twice.and_return{
|
||||||
alice.person
|
remote_person.save(:validate => false)
|
||||||
else
|
remote_person.profile = Factory(:profile, :person => remote_person)
|
||||||
remote_person.save(:validate => false)
|
remote_person
|
||||||
remote_person.profile = Factory(:profile, :person => remote_person)
|
|
||||||
remote_person
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bob.reload.visible_posts.size.should == 1
|
bob.reload.visible_posts.size.should == 1
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ describe User do
|
||||||
addr = '12345@alice.com'
|
addr = '12345@alice.com'
|
||||||
alice.invitation_service = 'email'
|
alice.invitation_service = 'email'
|
||||||
alice.invitation_identifier = addr
|
alice.invitation_identifier = addr
|
||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
alice.infer_email_from_invitation_provider
|
alice.infer_email_from_invitation_provider
|
||||||
}.should change(alice, :email)
|
}.should change(alice, :email)
|
||||||
|
|
@ -49,7 +49,7 @@ describe User do
|
||||||
addr = '1233123'
|
addr = '1233123'
|
||||||
alice.invitation_service = 'facebook'
|
alice.invitation_service = 'facebook'
|
||||||
alice.invitation_identifier = addr
|
alice.invitation_identifier = addr
|
||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
alice.infer_email_from_invitation_provider
|
alice.infer_email_from_invitation_provider
|
||||||
}.should_not change(alice, :email)
|
}.should_not change(alice, :email)
|
||||||
|
|
@ -359,7 +359,7 @@ describe User do
|
||||||
context 'not on server (not yet invited)' do
|
context 'not on server (not yet invited)' do
|
||||||
it 'returns nil' do
|
it 'returns nil' do
|
||||||
@recipient = nil
|
@recipient = nil
|
||||||
@identifier = 'foo@bar.com'
|
@identifier = 'foo@bar.com'
|
||||||
@type = 'email'
|
@type = 'email'
|
||||||
invited_user.should be_nil
|
invited_user.should be_nil
|
||||||
end
|
end
|
||||||
|
|
@ -368,14 +368,14 @@ describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.find_or_create_by_invitation' do
|
describe '.find_or_create_by_invitation' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create_from_invitation!' do
|
describe '.create_from_invitation!' do
|
||||||
before do
|
before do
|
||||||
@identifier = 'max@foobar.com'
|
@identifier = 'max@foobar.com'
|
||||||
@inv = Factory.build(:invitation, :admin => true, :service => 'email', :identifier => @identifier)
|
@inv = Factory.build(:invitation, :admin => true, :service => 'email', :identifier => @identifier)
|
||||||
@user = User.create_from_invitation!(@inv)
|
@user = User.create_from_invitation!(@inv)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates a persisted user' do
|
it 'creates a persisted user' do
|
||||||
|
|
@ -409,18 +409,22 @@ describe User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".find_for_authentication" do
|
describe ".find_for_database_authentication" do
|
||||||
it 'finds a user' do
|
it 'finds a user' do
|
||||||
User.find_for_authentication(:username => alice.username).should == alice
|
User.find_for_database_authentication(:username => alice.username).should == alice
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'finds a user by email' do
|
||||||
|
User.find_for_database_authentication(:username => alice.email).should == alice
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not preserve case" do
|
it "does not preserve case" do
|
||||||
User.find_for_authentication(:username => alice.username.upcase).should == alice
|
User.find_for_database_authentication(:username => alice.username.upcase).should == alice
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'errors out when passed a non-hash' do
|
it 'errors out when passed a non-hash' do
|
||||||
lambda {
|
lambda {
|
||||||
User.find_for_authentication(alice.username)
|
User.find_for_database_authentication(alice.username)
|
||||||
}.should raise_error
|
}.should raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -892,7 +896,7 @@ describe User do
|
||||||
:password => "secret",
|
:password => "secret",
|
||||||
:password_confirmation => "secret",
|
:password_confirmation => "secret",
|
||||||
:person => {:profile => {:first_name => "Bob",
|
:person => {:profile => {:first_name => "Bob",
|
||||||
:last_name => "Smith"}}}
|
:last_name => "Smith"}}}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue