Re: [rspec-users] rspect weird problem

2011-12-05 Thread Patrick J. Collins
> Motrocicle.create I don't know if this helps, but I am pretty sure "Motrocicle.create" isn't what you intended to call. Also, I'd like to point out that: > def self.find (name) > found = nil > ObjectSpace.each_object(Motorcycle) { |o| > found = o if o.name =

[rspec-users] rspect weird problem

2011-12-05 Thread Andres M.
Hello everyone, this is really urgent so ill be quick, here is some ruby code that i know works: require 'csv' class Motorcycle attr_reader :name, :weight @@count = 0 def self.find (name) found = nil ObjectSpace.each_object(Motorcycle) { |o| fo

Re: [rspec-users] How to extend common helper methods to view specs?

2011-12-05 Thread Justin Ko
On Dec 5, 2011, at 3:53 PM, Gordon wrote: > Hi, there, > > I have some methods which I have written as helpers. > They are in spec/support/controller_macros.rb (yes, I will change the > name soon). > > The 2 methods, login_user and login_admin_user works in the > controller specs BUT fail to wo

[rspec-users] How to extend common helper methods to view specs?

2011-12-05 Thread Gordon
Hi, there, I have some methods which I have written as helpers. They are in spec/support/controller_macros.rb (yes, I will change the name soon). The 2 methods, login_user and login_admin_user works in the controller specs BUT fail to work in the view specs when I call them in the view specs.

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread David Chelimsky
On Mon, Dec 5, 2011 at 9:13 AM, Morten Møller Riis wrote: > Hi Matt > > Thank you for your reply! > > I mock things like FileUtils for the following reasons: to avoid testing > FileUtils which I reckon has its own test suite and to avoid doing > potentially harmful things locally or having specs f

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
Hi Matt Thank you for your reply! I mock things like FileUtils for the following reasons: to avoid testing FileUtils which I reckon has its own test suite and to avoid doing potentially harmful things locally or having specs fail because of insufficient permissions etc. I know the last bit cou

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Matt Wynne
On 5 Dec 2011, at 12:04, Morten Møller Riis wrote: > Hi folks > > How would you spec something like this: > >as_user username do > FileUtils.chmod_R 0755, "#{directory}/*" >end > > Where as_user fires off a new process (and set uid to username). > > It seems that this won't catch

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
For the moment I have done this: def Process.fork(&block) block.call end So that Process.fork doesn't actually spawn a new process but just runs it in the current one. But any better suggestions are welcome :) Mvh Morten Møller Riis On Dec 5, 2011, at 1:04 PM, Morten Møller Riis wrote:

[rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
Hi folks How would you spec something like this: as_user username do FileUtils.chmod_R 0755, "#{directory}/*" end Where as_user fires off a new process (and set uid to username). It seems that this won't catch FileUtils.chmod_R: FileUtils.should_receive(:chmod_R).with(0755, "#{@d