[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help! w/ these simple tests!

Clem Rock

1/30/2007 9:22:00 PM

Ok - yes - I'm a desperate newbie and I am not sure why these test don't
pass.

Here's the rundown:

#### the method ###############
def show_space
@space = Space.find(:all, :conditions => ["id=?", params[:id]])
end

#### the test #################
def test_show_space
get :show_space, :id => 1
assert_response :success
assert_template 'show_space'
assert_not_nil assigns(:space)
assert_equal assigns(:space), spaces(:first_space)
end

#### and the YAML file: spaces.yml ###############
first_space:
id: 1
title: My first space
subdomain: first-space
domain: functionalalcoholism.org
home_page_id: 57
user_id: 1
owner_id: 1
created_at: 2005-05-21 00:00:00
updated_at: 2005-05-21 00:00:00
wikiwords_enabled: 1
country_code: US
timezone_identifier: US/Eastern
####################################################

#### the method ####################################
def show
@accounts = Account.find (:all, :include => {'owned_spaces' =>
:memberships}, :conditions => ["accounts.id=?", params[:id]])
end

#### the test ######################################
def test_show
get :show,:id => 1
assert_response :success
assert_template 'show'
assert_equal assigns(:account), accounts(:blake_account)
end

#### and the YAML file: accounts.yml ###############
blake_account:
id: 1
user_id: 1
first_name: Blake
street: none
expire_on: <%= Date.today + 32 %>
recurring: false
country_code: US

--
Posted via http://www.ruby-....

2 Answers

Eric Hodel

1/30/2007 11:19:00 PM

0

On Jan 30, 2007, at 13:21, Clem Rock wrote:

> Ok - yes - I'm a desperate newbie and I am not sure why these test
> don't
> pass.

These all look like Rails functional tests, so I think you want the
Rails mailing list.

Gavin Kistner

1/30/2007 11:30:00 PM

0

On Jan 30, 4:18 pm, Eric Hodel <drbr...@segment7.net> wrote:
> On Jan 30, 2007, at 13:21, Clem Rock wrote:
>
> > Ok - yes - I'm a desperate newbie and I am not sure why these test
> > don't
> > pass.
>
> These all look like Rails functional tests, so I think you want the
> Rails mailing list.

....which can be found at: http://groups.google.com/group/ru...
talk

(I'd encourage those who helpfully point people in the right direction
to, time permitting, more helpfully aim their pointing finger at a
specific target.)