-
Notifications
You must be signed in to change notification settings - Fork 441
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
Showing
9 changed files
with
72 additions
and
78 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
web: bin/rails server -b 0.0.0.0 | ||
delayed: bundle exec script/delayed_job.api.rb run | ||
clock: bin/clockworkd --log-dir=log -l -c config/clock.rb run | ||
# delayed: bundle exec script/delayed_job.api.rb run | ||
# clock: bin/clockworkd --log-dir=log -l -c config/clock.rb run | ||
search: bin/rails sphinx:start_for_development |
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
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
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
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
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 |
---|---|---|
@@ -1,34 +1,13 @@ | ||
RSpec.shared_examples 'a ldap connection' do | ||
context 'when a connection can be established' do | ||
before do | ||
allow(ldap_mock).to receive(:bind).with('tux', 'tux_password') | ||
allow(ldap_mock).to receive(:bound?).and_return(true) | ||
end | ||
let(:user_tux) { 'cn=tux,ou=people,dc=example,dc=org' } | ||
|
||
context 'when a connection can be established' do | ||
it 'returns the connection object' do | ||
expect(UserLdapStrategy.send(:initialize_ldap_con, 'tux', 'tux_password')).to be(ldap_mock) | ||
end | ||
end | ||
|
||
context 'when no connection can be established' do | ||
before do | ||
allow(ldap_mock).to receive(:bind).with('tux', 'tux_password') | ||
allow(ldap_mock).to receive(:bound?).and_return(false) | ||
expect(UserLdapStrategy.send(:initialize_ldap_con, user_tux, 'tux_password')).to be_bound | ||
end | ||
|
||
it { expect(UserLdapStrategy.send(:initialize_ldap_con, 'tux', 'tux_password')).to be_nil } | ||
end | ||
|
||
context 'when establishing a connection fails with an error' do | ||
let(:err_object) { double(error: 'something happened') } | ||
|
||
before do | ||
allow(ldap_mock).to receive(:bound?) | ||
allow(ldap_mock).to receive(:bind).with('tux', 'tux_password').and_raise(LDAP::ResultError) | ||
allow(ldap_mock).to receive(:err).and_return(err_object) | ||
allow(ldap_mock).to receive(:err2string).with(err_object).and_return('something happened') | ||
end | ||
|
||
it { expect(UserLdapStrategy.send(:initialize_ldap_con, 'tux', 'tux_password')).to be_nil } | ||
context 'when a connection can not be established' do | ||
it { expect(UserLdapStrategy.send(:initialize_ldap_con, user_tux, 'WRONG_password')).to be_nil } | ||
end | ||
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