Displaying 20 results from an estimated 900 matches similar to: "redirection doesn''t get detected well?"
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec
for a few weeks. I found that for my controller specs, my setup
methods were getting very long building mocks/stubs for all the model
objects I needed to work with.
I''ve started creating helpers like the following for each of my
models. The "min_" methods are short for "minimum", and
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my
application, but I''m having some trouble asserting a replace_html with
a partial.
I''ve created a pastie (http://pastie.caboo.se/60694) which contains
the RJS I want to spec, the spec which I already wrote and its failure
message.
I''m currently using RSpec-0.9.2
2007 Jan 05
2
Using RESTful routes in controller tests
Why can''t I use the RESTful route helpers in my specs?
In my controller I''m doing a redirect: redirect_to list_path(:id =>
@item.list_id)
Now when I write: controller.should_redirect_to list_path(:id => 2)
I''m getting the following error:
NoMethodError in ''POST on /lists/2/items should redirect to index on
succesful POST''
You have a nil object
2007 May 03
6
RSpec 0.9.2
Behind every great release is a maintenance release.
Go get it while it''s hot.
We''ve also reworked the website a little - trying to scare off fewer people.
Aslak
2006 Mar 21
11
Stuck on ActiveRecord
Hi,
I''m having great fun developing with Rails but I''ve come to a problem
that I can''t quite figure out.
I have an Order object that "has_many" order_lines. This works perfectly
and I can see all the lines.
The OrderLine object has an order_id field as well as product_id and
amount.
Now ideally I would want to do :
order.orderline[0].product.name
for
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to:
- Create a new PayjunctionOrder
- Create some LineItem objects and assign them to the PayjunctionOrder
- Save everything
I''m using Rails Edge.
----
class PayjunctionOrder < ActiveRecord::Base
has_many :line_items
end
------------------
----
class LineItem < ActiveRecord::Base
belongs_to :order,
2006 Jun 24
2
Migrations problem with Agile Rails book
I am following the instructions on Agile Web Development with Rails book "Iteratio E1: Capturing
an Order" section. When I run the migrations I get the following error.
rake db:migrate
(in /Users/balaparanj/work/depot)
-- execute("alter table line_items \n
add constraint fk_line_item_products \n
foreign key (product_id) references products(id)")
rake
2007 Sep 29
4
How to write the very first example?
Many posts on this list are about using RSpec with Rails and that''s the way
I''m also using RSpec all the time.
Unfortunately there isn''t that much info about using RSpec for standalone
Ruby projects.
I must admit I''m really having a hard time writing the very first example(s)
for a fresh standalone Ruby project. I haven''t really got a clue where to
2007 Apr 27
3
Problem at the start
Hi,
I''m new to rspec and wanted to translate some of my unit tests into rspecs.
Unfortunately my first test fails with "Mysql not loaded". My application is
running fine and can access the database.
I''d appreciate any help, so I can get started.
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Mar 01
2
active_record postgresql adapter problem
Instead of using numeric I created the field "unit_price" as PostgreSQL
type money. Now when I try and add a row I get the following. How do I
override AR default behaviour to cast numeric post data to money, or am
I forced to only support database types that active_record knows about?
RuntimeError: ERROR C42804 Mcolumn "unit_price" is of type money but
expression is of
2007 Feb 16
4
Ideas for rails
Here are a few suggestions, wondering what others thought:
When you generate a model for a DB table, it would be nice if the
model.rb contained the DB schema (kind of like # commented out schema)
right in the model file. This would make reference WAY easier and put
all of the DB stuff in one easy file. Thanks.
also nice, of course, woudl be for rails to try and ''guess'' the
2008 Mar 04
9
What is your workflow? Or how to use the story runner the right way.
I really would like to know how people are using the Story and Example
runner to write their software.It would be great to get some direction on
it, because I think I''m missing some points.
Taking the outside-in approach in thought:
At first we write a high-level customer-facing story, this story fails.
Then we start using mocks at object level to use them as a design tool,
and so we
2006 Jan 06
6
HABTM problem not saving all associations
Hello all,
I have an Order object that has and belongs to many Products and has
and belongs to many Loan Types. This is so I can select multiples of
each in my order entry screen via checkbox groups.
I''m having some trouble with saving multiple HABTM associations for a
single model object; only the first HABTM association declared in the
model will save during the initial @order.save
2006 Mar 13
6
JobsOnRails
Announcing... JobsOnRails!
I''m creating on a Ruby on Rails oriented job site and will be launching
in the next few weeks. It''s a Rails-centric place for developers and
employers to get in touch with a minimum of hassle.
For now, I have a short outline of my ideas and an email signup form on
the live site at http://www.jobsonrails.com.
The site is coming along nicely and
2007 Dec 30
6
Restful-Authentication Rspec Failure Rails 2.0.2
I am trying the Restful-Authentication (latest version, downloaded
today) and upon running the generator, doing the migration, prepping
the test system and putting the resources in routes.rb I get a Rspec
test failure:
''SessionsController logins and redirects'' FAILED
expected not nil, got nil
routes.rb has:
map.resources :users
map.resources :sessions
nothing else was
2006 Mar 29
2
Rake Migrations for Rails 1.1
Hi all. I keep having the following error when I invoke the rake
db:migrate command for Rails 1.1 (Ruby 1.8.2 -- Windows 2000)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Realtorex: migrating
=======================================================
-- create()
rake aborted!
undefined method `create'' for
2006 May 26
4
Using ''validates_inclusion_of'' to validate foreign key
I seem to be missing something trying to use ''validates_inclusion_of'' to
validate a foreign key and was hoping some one could piont out my
mistake?
The problem seems to be that Order.find_all.collect is not returning an
array that contains the order_id, if I replace it with a hardcoded array
everything works as expected.
The model:
class OrderItem < ActiveRecord::Base
2007 Jan 21
35
Collection proxies need to be stubbed ?
Hi all !
I just started writing specs on a new project. I would just like to
validate that this is the way you would write it. I know about mocks,
stubs and expectations. I don''t think this is a problem for me.
My question really boils down to:
def index
@projects = current_user.projects.active
end
My spec needs to return the proxy, no ? Here''s my code:
context "A
2009 Jan 16
2
Predictions with GAM
Dear,
I am trying to get a prediction of my GAM on a response type. So that I
eventually get plots with the correct values on my ylab.
I have been able to get some of my GAM's working with the example shown
below:
*
model1<-gam(nsdall ~ s(jdaylitr2), data=datansd)
newd1 <- data.frame(jdaylitr2=(244:304))
pred1 <- predict.gam(model1,newd1,type="response")*
The problem I am
2006 Jan 12
5
Question about using DISTINCT in ActiveRecord find method.
Hi,
Am relatively new to the RoR world. My question is quite simple.
I have a query like such:
shipmentNumbers = Order.find_by_sql(["select distinct s.id from orders
o, line_items li, shipment_lines sl, shipments s where o.number=? and
o.id = li.order_id and li.id = sl.line_item_id and sl.shipment_id =
s.id", number])
The above query works fine. I wanted to do the same query using