Displaying 20 results from an estimated 700 matches similar to: "Testing a Rails plugin"
2008 Feb 18
5
uh... fixtures?
RSpec-ers:
I''m aware this is quite the FAQ. I have probably asked it myself, but I just
can''t Google up anything but others asking it.
I grabbed the source to Beast, to use as a Rails project uninfluenced by me, or
RSpec. Then I installed the CURRENT version of RSpec and rspec_on_rails, and set
up a model spec on Post.
Here''s the spec_helper.rb lines:
2011 Aug 09
0
Devise, RSpec and Webrat
My app is builded with rails 2.3.12, rspec-rails 1.3.2, webrat 0.7.3.
My spec_helper.rb
ENV["RAILS_ENV"] ||= ''test''
require
File.expand_path(File.join(File.dirname(__FILE__),''..'',''config'',''environment''))
require ''spec/autorun''
require ''spec/rails''
require
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'',
2006 Nov 24
13
rSpec on Rails 1.2?
I just updated my Rails install to the most current Edge and my
controller specs fail:
1)
TypeError in ''The User Controller should be a user controller''
can''t convert nil into String
Each spec fails the same way.
<context string> <spec string>
can''t convert nil into String
Any ideas what''s up with this?
Thanks,
s.ross
2008 Feb 12
4
Funny behavior with Fixtures... on Ubuntu..
Hey Guys,
I''ve got a test class that loads a bunch of fixtures. My understanding
is that fixtures are reloaded between each test... and I even have the
following two method calls at the top of my test class to make doubly
sure...
class TaskTest < Test::Unit::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
When I run my tests
2007 Jul 09
12
Mocking User.find( :all, :limit => 10 )
Hi,
I''m trying to setup a mock for my controller test but I can''t get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
).and_return([@user])
do_get
end
and in the controller
@users = User.find(:all, :limit => 10 )
But this does not work. It gives me
User expected :find with (:all)
2007 Apr 30
7
Migrating spec_helper with modifications
Hello,
After moving into the HEAD of rspec, I am greeted with a mountain of errors,
which I expected, due to my specs not being migrated.
I use hpricot for a lot of my view tests, as it is extremely simple to
traverse the DOM with it. I used to include HpricotSpecHelper in
spec_helper.rb, like so:
require ''hpricot_spec_helper''
module Spec
module Rails
module Runner
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.
2007 Mar 15
5
rake spec:views no transaction error
Hello,
I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving
the following message with each view spec execution:
WARNING: there is no transaction in progress
I have upgraded the rspec_on_rails plugin as well, and both the model and
controller tests are working flawlessly. Is there some simple step I
missed? thanks for the input.
-Chris
-------------- next part
2006 Mar 01
1
maddening intermittent failures in unit tests with "working" code
Hi all,
This testing problem has been a sink for time today, and is still unresolved.
Basically I have some unit tests that test simple functions (example below)
that depend on join operations in a habtm relationship, and I suspect I am
getting "false" failures, i.e ones that do not logically make any sense. I
need fresh sets of eyes to take a look and see if I''m mising
2008 Mar 14
2
Lib Specs and config.use_transactional_fixtures = true
Hi
We have specs in our rails project other than model/view/controller ..
we have interests and lib ...
using use_transactional_fixtures = true seems fine in a spec in the m/
v/c and interests directories but not in lib
Just wondered if anyone had any quick thoughts as to why that may be???
Shane Mingins
ELC Technologies (TM)
1921 State Street
Santa Barbara, CA 93101
Phone: +64 4 568
2006 Apr 16
7
Problem running unit tests
I am running Rails 1.1.2 with Ruby 1.82-15. My database is Postgresql. I
haven''t had any problems generating models, migrations, using scaffolds, and
generally building and using my application, but I haven''t been able to get
testing to work. I initially just ignored the problem and kept developing,
but would like to add proper testing from here on out.
Currently when I type
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"
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" #
2007 Aug 31
2
Can module spec "behave like" controller spec?
Hello everyone:
Right now I am writing spec on modules, which are provided by my
colleagues. Some of the modules actually contain action methods. I tried
very hard to spec those action methods in modules. But it seems that the
rspec does not allow module spec to ''get'' action like controller does. After
I saw the documentation, I then used :behaviour_type=>:controller.
2007 Aug 31
3
Setting use_transactional_fixtures=false for a single spec - a bad idea?
Hi!
I would really like to find a way to allow me to write RSpec
specifications for code that use database transactions. I know I can set
config.use_transactional_fixtures = false
in my spec_helper.rb. That works, and that''s great, but it will (I
think) slow down my specs quite a bit. I would like to turn off
transactional fixtures for just a single spec (describe), or even
2009 Aug 29
2
Users, Roles and Permissions
Hello,
I''m currently working on a text-based roleplay browser game, and i''m trying
to figure out what the best approach would be in order to create a system
that allows me to assign roles to a user, and permissions based upon the
role a user has.
I''ve been thinking about creating a model User, which has_many :roles, and
with the Role model which has_many :permissions.
2011 Aug 23
2
Where is WillPaginate::Finders ???
Hi All!
It''s been a while since I had to ask for help, but I''m back!
I''ve finished beta testing my big app and started the transition to
production. Everything went fine and the production version was working
till I was asked to add another model :-( (Almost a year of beta
testing and they only come up with it after moving to production :-D )
I successfully
2008 Apr 02
18
Setting up PuppetShow - Puppet's Web Interface
Hello puppeters;
I want to set/test the PuppetShow "Puppet''s Web Interface" with Ruby on
Rails (ROR). If somebody has setup such show, please share your experiece
with EXAMPLES...I''m not the programmer.so please share your STEPS....I have
setup the ROR environment, currently learning Rails with different
frameworks....HOBO (http://hobocentral.net/) is great for starter