Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2013 16:47
Show Gist options
  • Save anonymous/5699499 to your computer and use it in GitHub Desktop.
Save anonymous/5699499 to your computer and use it in GitHub Desktop.
rspec stub/mock
describe ".ldap_authenticate" do
describe "for invalid credentials" do
before :each do
conn = double("LDAP::SSLConn")
LDAP::SSLConn.any_instance.stub(:new).and_return conn
conn.should_receive(:bind)
end
it "returns false" do
User.ldap_authenticate "test", "test"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment