how to I get a model statement to run within "test.rb" by the way?
For example to get the following to run:
RecurringType.create(:name => "TYPE_BASIC")
If I just stick this in I get:
extract--
Macintosh-2:myequity greg$ rake spec
(in /Users/greg/source/m
This is the same error that I get also. I'd love to get this working,
Glenn
On Oct 31, 2008, at 5:04 PM, Nick Hoffman wrote:
On 2008-10-31, at 17:52, Matt Darby wrote:
Same thing unfortunately. It also happens when I add --drb to spec/
spec.opts and run autotest/autospec as well.
G'day Mat
On Thu, Nov 6, 2008 at 2:53 AM, Joseph Wilk <[EMAIL PROTECTED]>wrote:
> I'm getting expected: "1"
>> got: "0"
>> on a simple should change(Model, :count).by(1)
>>
>> It follows the specific model around as well. If I change order of the
>> fit table or not (the fit table h
On Wed, Nov 5, 2008 at 1:32 PM, Stephen Eley <[EMAIL PROTECTED]> wrote:
>
> It's not sufficient for that scenario, however, because that meteor
> would probably take out your nearby external backup drive as well.
That's a good point, which is why I didn't boast about my 1 TB Time Capsule.
:)
I
On Wed, Nov 5, 2008 at 4:11 PM, Mark Wilden <[EMAIL PROTECTED]> wrote:
>
> Time Machine is especially cool because it backs up hourly.
>
> My criterion has always been, if a meteor annihilates my computer, how long
> would it take to get back to work? No meteors yet, but better safe than
> sorry.
On Wed, Nov 5, 2008 at 12:39 PM, Stephen Eley <[EMAIL PROTECTED]> wrote:
>
> My point is that it did not take me days to recover from all this
> screwiness. I was using Time Machine. I booted from the Leopard DVD,
> said "Make it Wednesday again," and let it recopy my whole hard drive.
>
Time M
> This expectation:
>@cart.should_receive(:amount=).with(50)
> is what you really want, because it's ensuring that Order#amount= is
> being called with the correct value.
>
> So, just remove the "should eql(50)" expectation, and you're all set!
> -Nick
You are perfectly right Nick, I had just
On 2008-11-05, at 15:23, Fernando Perez wrote:
Hmmm, I don't have this problem as I am using ruby-forum.com to browse
threads, it is x100 times more readable with basic color highlighting.
I'll do my best to include quotes for people who use regular mail
clients.
So here is my controller code:
-
On Wed, Nov 5, 2008 at 12:26 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote:
> On 2008-11-05, at 15:10, Mark Wilden wrote:
>
>> What I can't figure out is this:
>>
>> >> 1.day
>> => 1 day
>>
>> >> 1.day.class
>> => Fixnum
>>
>> I've no idea why 1.day.class returns Fixnum though..
>
Yeah, I'd looked a
On Wed, Nov 5, 2008 at 12:23 PM, Courtenay <[EMAIL PROTECTED]> wrote:
>
> Not sure if this is a python troll or not.. however, our biggest
> problem was the development environment, not production.
I hosed my development environment once. I did pair programming with
a VIM junkie, and foolishly le
On 2008-11-05, at 15:23, Fernando Perez wrote:
This throws the error: expected 50, got 0 (using .eql?)
This is because you told @cart to return 0 when #amount is called on it:
@cart = mock_model(Order, :id => 1, :amount => 0, :tax => 0)
I think maybe you're confusing what the arguments to #m
On 2008-11-05, at 15:10, Mark Wilden wrote:
What I can't figure out is this:
>> 1.day
=> 1 day
>> 1.day.class
=> Fixnum
Is 1.day an ActiveSupport::Duration or a Fixnum?
///ark
It's an ActiveSupport::Duration :
48 def days
49 ActiveSupport::Duration.new(self * 24.hours,
> Please make sure, when you ask a question, that you quote enough of
> the thread so that the readers can understand what you're asking.
Hmmm, I don't have this problem as I am using ruby-forum.com to browse
threads, it is x100 times more readable with basic color highlighting.
I'll do my best t
On 2008-11-05, at 15:02, Ben Mabey wrote:
Hey Nick,
It is generally a bad idea to stub/mock a method on the object you
are verifying the behaviour of. I would recommend a state-based
approach of testing this method as opposed to the interaction-based
one you are pursuing. The reason being
On Wed, Nov 5, 2008 at 2:08 PM, Fernando Perez <[EMAIL PROTECTED]> wrote:
>> @cart.should_receive(:amount=).with(50)
>>
>> amount and amount= are two different methods :)
>
> Thanks Dave!
>
> So now if I test for: @cart.amount.should eql(50)
>
> Why do I get this error: expected 50, got 0 (using .e
On 2008-11-05, at 14:55, Fernando Perez wrote:
And I get the following error message:
--
Mock 'Order_1' received unexpected message :amount= with (50)
--
Well I know that @cart.amount will be set to 50, but why is RSpec
complaining about that?
If I put @cart.should_receive(:amount).with(50), r
On Wed, Nov 5, 2008 at 11:42 AM, David Chelimsky <[EMAIL PROTECTED]>wrote:
> Looks like you can't stub anything on a Fixnum because of the way
> RSpec's mocking works.
>
> >> require 'spec/mocks'
> => true
> >> 1.stub!(:foo)
> TypeError: no virtual class for Fixnum
>
What I can't figure out is t
> @cart.should_receive(:amount=).with(50)
>
> amount and amount= are two different methods :)
Thanks Dave!
So now if I test for: @cart.amount.should eql(50)
Why do I get this error: expected 50, got 0 (using .eql?)
I have to add that the @cart is not saved in DB after its amount
attribute is
Nick Hoffman wrote:
I had a look around for how to stub Time.now , #from_now , etc, and
came across this, which was useful:
http://devblog.michaelgalero.com/2007/11/23/actioncontroller-rspec-stub-timenow/
Unfortunately, my situation is slightly different, and causes that
solution to not be a
On 2008-11-05, at 14:42, David Chelimsky wrote:
The problem is there is no Singleton Class for 1, probably an
efficiency in Ruby since 1 is, itself, a Singleton.
All of these frameworks try to manipulate methods on the object's
singleton class. So no mocking/stubbing on Fixnums. Apparently.
Not
On Wed, Nov 5, 2008 at 1:55 PM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> In have the following code:
>
> def index
> @items = Item.find_for_payment(session[:order_id], @site.id)
> @cart.amount = @items.sum { |item| item.price.to_i *
> item.quantity.to_i }
> end
>
> @cart is set by a before_fil
To make RSpec happy, I tried to test for the following:
--
@cart.amount.should eql(50)
--
And now I get:
--
FAILED
expected 50, got 0 (using .eql?)
--
So is @cart.amount being set to 50 or not in the spec? When I test
manually it works fine.
--
Posted via http://www.ruby-forum.com/.
__
In have the following code:
def index
@items = Item.find_for_payment(session[:order_id], @site.id)
@cart.amount = @items.sum { |item| item.price.to_i *
item.quantity.to_i }
end
@cart is set by a before_filter called find_cart which I stub.
find_for_payment is stubbed too.
In my spec I simply
"Mark Wilden" <[EMAIL PROTECTED]> writes:
> I'll just point out one more disadvantage of assuming the contents of the
> test database are
> correct (without 'rake db:test:prepare'). If you interrupt a test with Ctrl-C
> (especially when
> running autospec), it's possible for the transaction not
On Wed, Nov 5, 2008 at 12:51 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote:
> I had a look around for how to stub Time.now , #from_now , etc, and came
> across this, which was useful:
> http://devblog.michaelgalero.com/2007/11/23/actioncontroller-rspec-stub-timenow/
>
> Unfortunately, my situation is
I'll just point out one more disadvantage of assuming the contents of the
test database are correct (without 'rake db:test:prepare'). If you interrupt
a test with Ctrl-C (especially when running autospec), it's possible for the
transaction not to get rolled back. An uncommitted transaction should g
"Greg Hauptmann" <[EMAIL PROTECTED]> writes:
> so is the concept to build up all seed data creation in one
> place/method, & then for the rake spec case run this in via the "test"
> environment.rb file?
That sounds good. I typically put it in spec_helper.rb so all
test-related stuff is in one pl
My 2 cents
http://talklikeaduck.denhaven2.com/articles/2008/11/05/the-rspec-caboo-se-brouhaha
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/list
I had a look around for how to stub Time.now , #from_now , etc, and
came across this, which was useful:
http://devblog.michaelgalero.com/2007/11/23/actioncontroller-rspec-stub-timenow/
Unfortunately, my situation is slightly different, and causes that
solution to not be applicable. This is wh
Joseph Wilk wrote:
> We run Integration tests across multi browsers simultaneously using
> Selenium Grid. Perhaps you could use that (I believe it comes with ant
> tasks that do some of the magic).
Thanks Joseph i looked at selenium grid and it seems to be the answer to
all my problems!! thank y
On Wed, Nov 5, 2008 at 2:58 AM, Alex Satrapa <[EMAIL PROTECTED]> wrote:
> On 05/11/2008, at 01:37 , Steven Baker wrote:
>
>> Big difference between "haven't been able to" and "wouldn't learn the
>> tools". Ashley's post below sums it up best. This is a problem that's seen
>> regularly when workin
On 5 Nov 2008, at 14:28, Fernando Perez wrote:
Hmmm, could you make a helper module and mix that into all three
controllers? Then there'd be just one place to change it.
Can you be more descriptive?
Well I was just thinking out loud really. Something like
module SubscriptionStuff
def s
> You're allowed to disagree :)
>
> Does what we're saying make sense to you?
>
Yes, my model classes were starting to get hard to read with method
calling other methods calling other methods.
Yes, we can change ;-)
--
Posted via http://www.ruby-forum.com/.
_
I'm getting expected: "1"
got: "0"
on a simple should change(Model, :count).by(1)
It follows the specific model around as well. If I change order of
the fit table or not (the fit table has 20 rows of different models
all being exercised the same way, they are part
Thanks David
Just to confirm "up front" was not in any way meant to imply that the design
is fixed or should not be refactored, or even will not need refactoring.
Clarifying my point,
2) Use your tests/specs/stories/features combined with your experience
to ensure you design an initial api that
I feel the same as Andrew, generalizing all calls to the model methods
is bad, as you're making the simple (and common) complicated just to
have the uncommon as possible.
If you're making a big change as changing a method name and adding a
new parameter, you're doing something new, it isn't the sa
On Wed, Nov 5, 2008 at 9:42 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> Okay, I wanted to get some external point of views on an idea. Thanks
> for your input.
You're allowed to disagree :)
Does what we're saying make sense to you?
___
rspec-users m
On Wed, Nov 5, 2008 at 7:10 PM, Matt Wynne <[EMAIL PROTECTED]> wrote:
> On 5 Nov 2008, at 03:58, Mikel Lindsaar wrote:
>
> If I run rake features or cucumber features/* I get one failing FIT
>> scenario in one of my features.
>> If I then run that feature that contains the FIT table with the faili
Okay, I wanted to get some external point of views on an idea. Thanks
for your input.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On Wed, Nov 5, 2008 at 9:12 AM, Andrew Premdas <[EMAIL PROTECTED]> wrote:
> What you are suggesting here changing your api to make it easier to refactor
> your api. Your trying to do this by
>
> 1) Generalising the descriptivness of the api
> 2) Reducing the number of calls to your api
>
> Both of
Fernando Perez wrote:
I don't think this is a problem.
Pat
Don't you find it painful to go through each controller and/or each
controller spec to correct the name of the method that has just changed?
So you don't mind having to change in many different places
should_receive(:find_if_p
What you are suggesting here changing your api to make it easier to refactor
your api. Your trying to do this by
1) Generalising the descriptivness of the api
2) Reducing the number of calls to your api
Both of these are not particularly good ideas
1) Generalising your api, reduces it descriptiv
On Wed, Nov 5, 2008 at 8:53 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
>> I don't think this is a problem.
>>
>> Pat
>
> Don't you find it painful to go through each controller and/or each
> controller spec to correct the name of the method that has just changed?
>
> So you don't mind having to
On Wed, Nov 5, 2008 at 8:42 AM, Pat Maddox <[EMAIL PROTECTED]> wrote:
> Fernando Perez <[EMAIL PROTECTED]> writes:
>
>>> Hmmm, could you make a helper module and mix that into all three
>>> controllers? Then there'd be just one place to change it.
>>>
>> Can you be more descriptive?
>>
>> Let's sa
> I don't think this is a problem.
>
> Pat
Don't you find it painful to go through each controller and/or each
controller spec to correct the name of the method that has just changed?
So you don't mind having to change in many different places
should_receive(:find_if_purchased) to
should_rece
Fernando Perez <[EMAIL PROTECTED]> writes:
>> Hmmm, could you make a helper module and mix that into all three
>> controllers? Then there'd be just one place to change it.
>>
> Can you be more descriptive?
>
> Let's say I have:
>
> def show
> Subscription.find_if_purchased
> ...
> end
>
> de
On Wed, Nov 5, 2008 at 8:22 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> Thanks for the clarification. And from now on I will quote previous
> emails.
Sorry man, but I'm laughing my ass off over this.
Readers of this email will have no idea what I clarified for you
because you *didn't quote th
Alex Satrapa wrote:
> I can't understand why people who are serious about production
> environment stability would install multiple applications in the same
> environment. It's not healthy.
One very nice way to do this is to run each app with its own user, then
have a ~/.gems directory. Then you
Thanks for the clarification. And from now on I will quote previous
emails.
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
> Hmmm, could you make a helper module and mix that into all three
> controllers? Then there'd be just one place to change it.
>
Can you be more descriptive?
Let's say I have:
def show
Subscription.find_if_purchased
...
end
def update
Subscription.find_if_purchased
...
end
Now if I c
On Wed, Nov 5, 2008 at 8:06 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> Actually, in a before(:each) block, the stubbing works. So why doesn't
> it work with a before(:all)?
Please, please, please quote the information from the previous email
to which you are referring. I'll respond to your fi
On Wed, Nov 5, 2008 at 8:05 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> I'm also having problems stubbing current_user.
>
> I cannot put
> controller.stub!(:current_user).and_return(@current_user)
> in a before(:all) block. The stubbing doesn't happen.
Stubs and mocks get cleared out after ea
On 5 Nov 2008, at 13:17, Fernando Perez wrote:
Let's say I have a class method: Product.find_if_purchased(product_id,
user_id)
Let's say it is called in 3 different controllers.
Hmmm, could you make a helper module and mix that into all three
controllers? Then there'd be just one place to
Actually, in a before(:each) block, the stubbing works. So why doesn't
it work with a before(:all)?
--
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
I'm also having problems stubbing current_user.
I cannot put
controller.stub!(:current_user).and_return(@current_user)
in a before(:all) block. The stubbing doesn't happen.
However if I put it in the it "should..." block, then it works.
Why is that?
--
Posted via http://www.ruby-forum.com/.
_
On Wed, Nov 5, 2008 at 7:17 AM, Fernando Perez <[EMAIL PROTECTED]> wrote:
> The biggest problems I have when developing (beside stupid typos) are:
> 1) The name of a method which I often change to a supposedly more
> descriptive name, which I will eventually change to an even more
> supposedly des
The biggest problems I have when developing (beside stupid typos) are:
1) The name of a method which I often change to a supposedly more
descriptive name, which I will eventually change to an even more
supposedly descriptive name
2) The arguments a method takes
Let's say I have a class method: Pr
> I'm learning Django at the moment, which is kinda like a Python-on-
> Rails wannabe.
Just to clear things out. Django is absolutely not a Python-on-Rails
wannabe. See Rubies and Snakes conference for disambiguation.
--
Posted via http://www.ruby-forum.com/.
On Wed, Nov 5, 2008 at 6:07 AM, Rob Lacey <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I wonder if anyone can help, I've recently moved a project over from using
> an old version of the rspec and rspec-rails plugins to using the gems. This
> worked seamlessly for both myself and another colleague. Bu
Hi there,
I wonder if anyone can help, I've recently moved a project over from
using an old version of the rspec and rspec-rails plugins to using the
gems. This worked seamlessly for both myself and another colleague. But
another colleague is now getting this problem.
no such file "spec/rake
On 05/11/2008, at 01:37 , Steven Baker wrote:
Big difference between "haven't been able to" and "wouldn't learn
the tools". Ashley's post below sums it up best. This is a problem
that's seen regularly when working with new ideas. How many times
have you seen Agile blamed when a project f
On Tue, Nov 4, 2008 at 8:09 PM, Dr Nic <[EMAIL PROTECTED]> wrote:
> On Nov 5, 1:55 am, "Luis Lavena" <[EMAIL PROTECTED]> wrote:
>> Given a problem I have with RSpec
>> And I post to the mailing list
>> When noone answer my post
>> And has been N days since I posted
>> Then I start whining in my blo
On 5 Nov 2008, at 03:58, Mikel Lindsaar wrote:
Hi all.
If I run rake features or cucumber features/* I get one failing FIT
scenario in one of my features.
If I then run that feature that contains the FIT table with the
failing scenario manually, it passes.
I run it again with rake featu
63 matches
Mail list logo