Re: [rspec-users] Can I use mocking in this way?

2010-04-04 Thread Matt Wynne
When I started programming Ruby and I wanted abstract classes I would raise an exception in the initialize method telling the client that they were trying to instantiate an abstract class. That was my best attempt at self-documenting code at the time. Nowadays, however, when I have behaviou

[rspec-users] Stub a class and instances

2010-04-04 Thread Marcelo de Moraes Serpa
For example, I have this scenario where a Directory model will only save if it can connect to the LDAP server. In a test I'm writting, though, connecting to the LDAP server is not relevant, so I tried doing this: context "LDAP is on" do before(:each) do Directory.stub!(:authent