> > describe "count_by_params" do
> > it "should pass all the params and options to #scope_by_params" do
> > params = { :foo => 1, :bar => 2 }
> > options = { :foo => 3, :bar => 4 }
> >
> > @base = ActiveRecord::Base
> > @result = mock("query results", :count => 1)
>
2009/3/20 Jeroen van Dijk :
> Huray, got it solved! Hopefully you'll agree with this solution (thanks to
> mocha sorry)
>
>
> describe "count_by_params" do
> it "should pass all the params and options to #scope_by_params" do
> params = { :foo => 1, :bar => 2 }
> options = { :foo
Huray, got it solved! Hopefully you'll agree with this solution (thanks to
mocha sorry)
describe "count_by_params" do
it "should pass all the params and options to #scope_by_params" do
params = { :foo => 1, :bar => 2 }
options = { :foo => 3, :bar => 4 }
@base = ActiveRec
Hi all,
I'm having the same problem as Tobi and I wanted to try Tobi mock solution
but unfortunately it does not work for me.
Here is a trivial example I want to test:
module ActiveRecord
class Base
def self.count_by_params(params = {}, options = {})
scoped_by_params(params).co
Zach Dennis wrote:
> +1 to composition over inheritance here. Mocking at different layers
> of an inheritance hierarchy sounds like trouble and screams to pull
> that thing apart.
Good point! I've already tried the composition approach. It solves the
testabilitiy problems, but it doesn't feel rig
On Sat, Feb 21, 2009 at 6:31 AM, Tobi wrote:
> Hi!
>
> I need to write some wrapper classes, that derive from SWIG generated
> proxy classes for some C/C++ extensions.
>
> The Ruby wrapper classes need to do a lot of 'super' calls to the base
> classes generated by SWIG.
>
> The question is: Is th
Hi!
I need to write some wrapper classes, that derive from SWIG generated
proxy classes for some C/C++ extensions.
The Ruby wrapper classes need to do a lot of 'super' calls to the base
classes generated by SWIG.
The question is: Is there any way to make RSpec mock a base class and
record/verify