Displaying 20 results from an estimated 7000 matches similar to: "assert_difference gives undefined method error in unit tests"
2007 May 08
3
assert_difference eval magic in [6693]
I just saw Marcel''s change to assert_difference that changes the
method API to take a string param that is evaled in a lambda.
http://dev.rubyonrails.org/changeset/6693
I much preferred the old API, since it''s simple enough to pass a
lambda. Passing a string means the lambda is in the wrong scope and
doesn''t have access to objects in the test case scope.
For an
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there
I''m in the process of developing an e-commerce Rails app but am
getting a little stuck on what models I should be working with on the
order/checkout side of things.
The app requires users to be registered and authenticated to checkout.
So I already have a User model and an Order model (which belongs to a
User). The Order model is largely similar to that used in the Agile
Rails
2006 Jul 21
3
Credit card processing through Australian gateways (eway etc)
Hi there
Has anyone out there embarked on credit card processing in a Rails app
through Australian gateways such as eway?
I''m aware of Payment and ActiveMerchant, but neither support
Australian gateways.
It''s a little beyond me right now to hack these to work with eway.
Any clues would be appreciated here.
Richard Sandilands
2007 Oct 17
1
Problem with assert_difference
Hello Friends,
I have problem with assert_difference, I want its syntax and
explantion in detail, Please help me, plz give me solution.
Regards,
Kiran Polawar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2009 Apr 30
1
error with test:functionals
Hello there,
I working on my tests but I getting this strange errror:
I can see on the database that the object was created but I still got
an failure on my test.
this is my test code:
test "should create artist" do
assert_difference(''Artist.count'', difference = 1) do
post :create, :artist => { }
end
assert_redirected_to
2012 May 22
0
functional tests assert_difference with array
given a new partner instance and a new admin instance are created,
what should be the difference number : +1 or +2
the doc is not so clear on it....
assert_difference [ ''Partner.count'', ''Admin.count'' ], +1 do...
thanks for feedback
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to
2006 Jun 12
2
Validating a non-object attribute in a form via checkbox?
Hi there
A user can place an ad with various attributes via a form; however, I
want the user to check a box signifying that they''ve read the terms
and conditions for use of the site.
So the ''terms'' is not an attribute of the Advertisement model. I
could check that the user has ticked the box in my controller but
would like to bundle this up with the validation
2006 Dec 04
5
should_be_different -- possible implementation
There is an assert_difference helper for Test::Unit (you can read
about it at http://blog.caboo.se/articles/2006/06/13/a-better-
assert_difference and to some it should look familiar -- you know who
you are :), so I took a shot at one for rSpec on Rails.
class Object
def should_be_different(method = nil, difference = nil)
return self.should_not_eql(yield) if method.nil?
2006 Jul 25
2
Shovel/TextDrive error: missing SSHAgent.socket
Hi there
When running the initial ''rake remote:exec ACTION=setup_lighty''
command I get this error:
''No such file or directory - /tmp/501/nl.uu.phil.SSHAgent.socket''
Any clues would be appreciated.
Richard Sandilands
2011 Aug 02
1
Rspec teting API.
Hi!
Guys, I wanna test an API built in Rails 3.0.3.
So, my question is... What''s the better way to test my own api?
I guess that a requests specs like these:
describe ''POST /client''
it ''works'' do
assert_difference post ''/clients'', :client => {...}
end
end
can be appropriate...
Someone just tested an API? I mean... simulate
2008 Jun 06
2
`exit?'': undefined method `run?'' for Test::Unit:Module (NoMethodError)?
Why am I getting this error if running from Netbeans or just from command
line with executing blah_spec.rb? If I run with spec bla blah blah_spec.rb
then it''s fine.
.
Finished in 0.264 seconds
1 example, 0 failures
c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in `exit?'':
undefined method `run?'' for Test::Unit:Module (NoMethodError)
from
2006 Nov 20
1
Getting started with ActiveMerchant & new Ecommerce book
Hi there
I''ve got a copy of the ''Beginning Ruby on Rails Ecommerce'' book and am
trying to integrate ActiveMerchant into my app.
My order.rb file has the line:
''include ActiveMerchant::Billing''
per the book.
My Order model also has, amongst other things, the following validation:
'' validates_inclusion_of :billing_country, :in =>
2006 Aug 08
4
Creating a child simultaneously with parent via form
Hi there
I''ve got a user model and an address model; a user has_many addresses.
A user object can be created via an html form which also allows for an
initial address to be created.
I''ve got a controller method working to save both objects via the
form, but I suspect I can achieve this in a more rails-esque manner.
Here is my controller method:
def signup
@user =
2006 Aug 10
6
Login Restfully
In DHH''s keynote, he alluded to doing logins with REST. Has anyone
implemented this, and if so, would you mind elaborating on how you did
it please?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
2007 Aug 15
3
unit testing active resource - mock or connect?
Hi all - there''s a patch I need to apply from a ticket:
http://dev.rubyonrails.org/ticket/8798
The ticket appears to be stalled on the lack of a test case. I figured
I''d just whip one up, but because it''s an Active Resource thing, and
the test case would need to do ModelName.find(:all), I''d need to
either mock the network connection or set one up.
In this
2005 Oct 20
5
Unit Test Error: `load_specification': undefined method `parse' for Time:Class
All,
I''ve come across a confusing problem when attempting to run unit tests
for an application on OSX (works on Windows).
I''m receiving the following error:
`load_specification'': undefined method `parse'' for Time:Class (NoMethodError)
This is also confusing because I can''t figure out how the error
appeared. When I revert back to previous revisions,
2006 Apr 06
7
[Fwd: Rails AR/Oracle Unit Test: [4185] failed]
So my automated script caught this issue, though I think my email
headers were bad, so rails-core has put the automated email on hold
pending "moderation".
I''ll fix that issue, and look at the one below as well.
-------- Original Message --------
Subject: Rails AR/Oracle Unit Test: [4185] failed
Date: Thu, 6 Apr 2006 08:32:04 -0700
From: Michael Schoen
2007 Jul 05
2
undefined method `original_filename' for "random.jpg":String
I have a problem getting attachments to work in a specific case...
I have the following data model (this is a relevant subset of it):
- a log can have many journals
- a journal belongs to a log and can have many attachments
- an attachment belongs to a journal
When adding on a new journal to an existing log the new journal form and
the corresponding controller handle the attachment as well and
2008 Jan 30
2
Stubbing controller methods vs model methods
I had an error that I couldn''t figure out, then when writing up a
question for the forum I figured it out. The thing is I don''t
understand why the change that was made works and why what existed
before didn''t.
Here is the initial post when I had the error:
----------------------------------
In the controllers/application.rb file
I have a method that finds the account
2007 May 29
12
questions rspec on rails
Hi, rather than flooding this list with separate emails, I''ve been
queueing up questions using rspec with rails. (an irc channel would
be nice too :) Here ya go...
- Is there a way to test named routes?
- Could I get an example how to test an ajax request
(link_to_remote)? would that go in view? and/or in controller spec?
- Can you assert which layout template is rendered in a