Re: [rspec-users] Rspec beta8: helper methods issues

2010-05-07 Thread Jamie D
from: http://github.com/rspec/rspec-rails - no helper specs (yet) - no routing specs (yet) - only works with ActiveRecord (for now) On 7 May 2010 11:59, andrea longhi wrote: > Hello everybody, > > I am experiencing the following problems, I googled quickly but I > couldn't find any d

[rspec-users] rspec test for converting a hash to a URL string

2008-04-14 Thread Jamie D
Hi all, I've written an expectation for a method that converts a hash into a url string of name/value pairs. The problem is that the hash is not traversed in the same order as it is defined so I can not work out how to test for the correct returned string. The operation of the code does not require

Re: [rspec-users] rspec test for converting a hash to a URL string

2008-04-18 Thread Jamie D
Thanks Pat, I wrote my first custom matcher and its all working now. Jamie ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Stubbing class in controller

2008-04-18 Thread Jamie D
Hi, I am trying to stub a class in my controller and I can't get it to work, the controller code is: def show @server = Server.find(params[:id]) whm = Whm::Client.new @server @server_load = whm.loadavg end and my test code: before(:each) do @server = mock_model(Server)

Re: [rspec-users] Stubbing class in controller

2008-04-19 Thread Jamie D
Thanks Ivo, I was getting a bit confused with the stubs, thanks for the explanation. Jamie On 19/04/2008, Ivo Dancet <[EMAIL PROTECTED]> wrote: > Hi > > The 'loadavg' method is an instance method of 'whm', so the test > should be: > > @whm = mock_model(Whm::Client) > Whm::Client.stub!(:new).

[rspec-users] Mocking Net::SSH connections

2008-04-20 Thread Jamie D
Hi, So I'm stuck again with creating a mock for Net::SSH, I've managed to mock the call to Net::SSH.start and yield the Net::SSH mock but I am totally stuck with mocking the session.shell.sync call and will also need to mock the shell.send_command call also. Any help much appreciated. When I run

Re: [rspec-users] Mocking Net::SSH connections

2008-04-21 Thread Jamie D
Thanks for the info Aslak, I have rewritten my code like you suggest but have one issue with raising an exception. When I try the code in the console an exception is raised correctly but in my test code I get a message "command did not return expected result" # test describe Ssh, "Remote" do be

Re: [rspec-users] Mocking Net::SSH connections

2008-04-21 Thread Jamie D
Error, 'command did not return expected result') end On 21/04/2008, Jamie D <[EMAIL PROTECTED]> wrote: > Thanks for the info Aslak, I have rewritten my code like you suggest > but have one issue with raising an exception. When I try the code in > the console an exception