Displaying 20 results from an estimated 5000 matches similar to: "Fixtures in ActionController::TestCase"
2009 Apr 06
9
setup method in functional tests and instance variables
I have the following in my functional test file.
class UserControllerTest < ActionController::TestCase
fixtures :users
def setup
@controller = UserController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@invalid_user = user(:invalid_user)
@valid_user = users(:valid_user)
end
def test_login_success
2005 Dec 23
1
Salted Login Error
Anyone know what''s causing this?
------------------------------------------------------------------------
1) Error:
test_delete(UserControllerTest):
NoMethodError: undefined method `advance_by_days='' for Time:Class
./test/functional/user_controller_test.rb:132:in `test_delete''
2) Error:
test_signup(UserControllerTest):
NoMethodError: undefined method
2006 May 03
0
Accessing the params hash in a functional test not working
I am having problems reading params in a functional test (Rails 1.1.2). My
test looks like this:
fixtures :users
def test_auth_bob
@request.session[:return_to] = "/bogus/location"
post :login, :user => { :email => "bob@example.com", :password => "test"
}
assert_session_has :user
assert_equal @bob, @response.session[:user]
2005 Jul 05
2
Salted hash login generator (verification problem?)
Hi all,
I hope someone can help with what is probably a simple newb
installation mistake on my part. I''m having a couple of problems with
the salted hash login generator. I installed it following the
quickstart guide, and the unit tests work like a charm. There are two
errors and a failure on the function tests, though; the verified field
seems to be involved in at least one of
2006 Jun 17
3
What is this failure trying to tell me?
Here is my unit test code.
post :login, :user=>{ :login => "bob", :password => "test"}
assert_response :redirect
assert_session_has :user
assert_redirected_to :action => ''welcome''
Here is the failure I''m getting when I run my tests.
2) Failure:
test_login_required(UserControllerTest)
2006 Feb 27
1
Functional test problem with environments variables
Hi guys,
i have been experiencing this problem once i put in some constant
declarations in /config/environments/development.rb. I declared it very
normally like this :
USER_DETAILS = {
:name => ''abc'',
:password => ''123''}
it works in the controller and when i run the application, i managed to
get the values out from the development.rb by using some
2007 Mar 22
1
Functional test and flash with an error
I''m getting this error thats moaning about expected tag, but no tag
found matching {:content=>"User James Apps was successfully created.",
:attributes=>{:id=>"notice"}, :tag=>"div"} in the file application.rb.
I tried using a regular expression - /#{user.first_name}/ , but that
wouldn''t work either
user_controller_test.rb
1) Failure:
2006 Jul 11
0
assert_redirected_to not recognizing routes
I''m getting a weird error in a call to assert_redirected_to in one of
my functional tests. Here is the test:
def test_signin
admin = users(:adminuser)
post :signin, {:login => admin.email, :realpass => @password}
assert_redirected_to :action => ''list'' # failure happens on this line
assert_equal admin.id, session[:user].id
end
The error
2007 Dec 17
14
Change in isolation behaviour 1.08 - 1.10 ?
Hi,
I just moved from 1.08 to 1.10 and now have one example failing, which,
under 1.08, passed. Is the due to a change in behaviour?
Here''s my spec (removed some passing examples)
require File.dirname(__FILE__) + ''/../spec_helper''
describe "A user" do
before(:each) do
@user = User.new
@valid_user = User.new(
:email =>
2008 Jan 21
1
ActionController majic gone bad
Overriding method missing in ActionController destroys magic even when
passed back
ie.
def method_missing(method, *args)
if some_condition
do_something
else
#let rails handle it normally
super(method,args)
end
end
if I don''t over ride method missing then i can call a view without an
action
with the override i get a method missing error.
MAJIC
--
Posted via
2006 Apr 22
2
Question about functional tests and log/test.log
Here''s something a bit weird:
After running functional tests, my test log contains many lines,
including many like these:
> Processing UserController#attempt_login (for 0.0.0.0 at 2006-04-22
> 02:38:08) [POST]
> Session ID:
> Parameters: {"user"=>{"password"=>"bogus",
> "email"=>"tmornini@bogus.com"},
2007 Apr 17
3
using rake db:fixtures:load with rspec fixtures
Hi, I''m new to rspec. I have some fixtures in /spec/fixtures. If they
were in /test/fixtures they could be loaded with rake db:fixtures:load.
Is there any way other than a symlink to load my rspec fixtures into
the database with rake? Or, can I cause rspec to load the fixtures
from /test/fixtures?
Thanks,
Paul
2006 Jul 10
1
rake db:fixtures:load FIXTURES=xyz
I am attempting to do selective fixture loading against my test
database.
When I run
rake db:fixtures:load FIXTURES=DataSetInfo
I get no output. (A full trace is below). I''m trying to figure out why
nothing happens.
1) Does the command above attempt to operate against my test database?
2) DataSetInfo is the name of my table and the name of my yml file
I generated these YAML
2011 Aug 10
1
How to stop Rspec loading my Cucumber fixtures
I have a bunch of fixtures designed to populate the database for my Cucumber
integration tests.
But at this stage I want my database to be empty when using Rspec.
So, I moved the fixtures from `/spec/fixtures` to
`features/support/fixtures`, and updated `features/support/env.rb` to read:
Fixtures.reset_cache
fixtures_folder = File.join(RAILS_ROOT, ''features'',
2011 Dec 25
1
Fixtures vs Fixture class, what is the intended purpose?
Hello,
i am trying to fix the code for fixtures in rails because it is buggy
and internal variable names are confusing, could somebody please explain
to me what is the intended purpose of Fixture and Fixtures classes
respectively?
For example, why do we need both `Fixtures.initialize`and
`Fixture.initialize`? They both "initialize" a single fixture, and in
fact `Fixture.initialize`
2007 Aug 08
1
Transactional fixtures not working as expected
Hi!
I am quite new to BDD and I just wrote my first tests. Suddenly I
received unexpected results because in a model test I load only
users-fixtures but when the views-fixtures in which I load the
posts-fixtures, are run before this model-test, the posts-fixtures are
loaded too. I test for example if there is one record in the posts-table
after creating one post. But when there are fixtures
2008 Jun 19
0
Error loading fixtures with classes that set_table_name
Hi all,
I just hit a big wall involving a legacy database. I''ve got an active
record class called "School" that uses "set_table_name ''old_school''" to
map to a legacy database table:
class School < ActiveRecord::Base
set_table_name ''old_school''
end
It works great, until I''m testing and I want to use fixtures.
2008 Jun 23
0
Error loading fixtures for classes that set_table_name
Hi all,
I just hit a big wall involving a legacy database. I''ve got an active
record class called "School" that uses "set_table_name ''old_school''" to
map to a legacy database table:
class School < ActiveRecord::Base
set_table_name ''old_school''
end
It works great, until I''m testing and I want to use fixtures.
2006 Jan 24
0
Fixtures subdirectories
Hi,
[This is a repost, I can?t find where went my previous post,
]
I wanted to create subdirectories in the fixtures directory in order to be
able to manage many different initial states for my system (or to sort
fixtures / corresponding model subpackages).
I came up with the idea of writing:
Test::Unit::TestCase.fixture_path = RAILS_ROOT + "/test/fixtures/selling"
2005 Dec 12
2
Using a lib in YAML fixtures
I''m using the runt library [1] to do some temporal expression
matching. I want to keep the expression in a binary field in my db.
I figured that then in order to do the fixtures, I''d need to do some
erb in the yaml file. So I came up with this:
onetime:
id: 1
name: One Time
description: This event occurs only one time.
timex: <%= REYear.new(7) & REMonth.new(24)