Displaying 20 results from an estimated 4000 matches similar to: "unit testing with model inheritence"
2005 Dec 30
1
Need serious help - unit testing without a database
I''ve created a model, let''s just call it Person
class Person
attr_accessor :first_name, :lastname
def full_name
@first_name + " " + @last_name
end
end
I''m using this in my Rails application. My Rails application does not
use a database of any kind, and this model is obviously not a subclass
of ActiveRecord::Base. I can''t unit test this
2005 Dec 27
4
Migrations & Unit Testing: Possible Bug in Rails?
I recently started using migrations to create the schema of a Rails
project I am working on. The database I am using for this project is
MySQL. The initial migration creates the table and also includes a
number of execute statements (to do some things like setting primary
keys, autoincrement on some columns and other messy voodoo).
Running "rake migrate" creates the database with no
2006 Jun 06
5
ruby mathematical expression parser
Hi,
Has anyone come across a Ruby mathematical expression parser, capable
of parsing out token, replacing them with values then executing the
mathematical formula? Nothing too heavy, A * (44/12) * ... etc. where
A is can be replaced with a value.
In Java there are serveral, like JEP, but I''d prefer it we could get a
Ruby one now we have moved over to Rails, otherwise we will have to
2006 Jun 17
4
Textmate Madness
Has anyone come across this problem... I created some Ruby files in Textmate
on my Mac - and everything works fine. However, when I run those files on a
Windows machine I get e.g.
compile error
./script/../config/../app/views/station/consumption/new.rhtml:2:
Invalid char `\002'' in expression
./script/../config/../app/views/station/consumption/new.rhtml:4: parse
error, unexpected
2006 Jan 02
3
rake test_units not loading any fixtures
Hello All,
If I run my unit tests individually using Ruby, they all work correctly.
However, if I try to run them using "rake test_units", I get a bunch of
error messages.
The error messages appear to be caused by rake not loading any of the
fixtures into the test database.
I am using PostgreSQL on Windows.
Does anyone have any suggestions?
Many thanks,
Bruce.
--
Posted via
2006 Aug 08
2
Testing Inconsistencies - ruby works rake fails
I''m getting some very weird results when testing my system. If I run my
unit tests using => ruby \test\unit\<filename.rb> each of the tests
pass. If I run => rake test_units I get several failures, and they all
have to deal with the same issue. For instance I''m getting =>
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42P01
Mrelation
2006 Apr 02
5
PostgreSQL and unit tests
After upgrading to 1.1, I can''t run any unit tests. Apparently when I
run rake test_units, it uses a migration to set up the database.
Unfortunately when it runs the migration, it''s adding not null
constraints to every field, even though I haven''t got that set up.
I''m using the ruby-postgres (0.7.1.2005.12.21) adapter with PostgreSQL
8.1.0.
I''m
2006 Mar 28
7
Is Ruby stable for production use?
Hi,
I realise that Windows is a poor platform and that Webrick is a development,
not production, server. However, we have started seeing this crop up when
perfectly simple page to page links are invoked...
[2006-03-28 08:32:21] ERROR Errno::ECONNABORTED: Software caused connection
abort
/usr/lib/ruby/1.8/webrick/httpresponse.rb:324:in `write''
2007 Nov 23
1
what''s the best way to deal with class/inheritence
sorry to cross post to dev/users. -dev was not the best option ;-)
Hi
to all puppet masters:
functionnality I need is quite simple:
classes/
one .pp file per class, example: class mail-gateway { ...service/host/templates... definitions }
-> this should set all that''s needed to setup a given system "rĂ´le" in the system (installing packages, config files with variables
2006 Feb 08
8
Strategies for Unit testing 2 databases
Hi,
My application spans 2 (or more) databases for some very specific
reasons... My models are working fine, even dynamically establishing
connections as needed at runtime, and spanning relationships across the
databases (which really impressed me). The problem is, I can''t seem to
force Units for these models (that use a secondary db) to load their
fixtures into and use the
2006 Mar 02
2
Unit tests, salted hash login
Hello,
I am having some trouble running the unit tests for the salted has login
generator. I am a bit new to both ruby and rails so I am having a little
trouble deciphering the error message I get when running ''rake
test_units''. Up till the point where I try to run the unit tests I have
followed the quick start guide for the salted hash login generator
2006 Jun 02
3
Wierdness with rake test_units and schema.rb
I have just migrated to use Rail 1.1 from 1.0.
In the progress of fixing and cleaning up the unit tests. I found the
following problem. I am not sure if this is a bug or it is my
environment.
When I run "rake test_units, some of the index in association tables is
not created, this leads to failures for some unit test cases.
Thinking that may be because I didn''t setup the
2006 Mar 28
2
plural to singular blunder
I just got this error:
uninitialized constant PriceCurf
After much head scratching I remembered the Rails plural to singular
mapping rules. My table is price_curves, my object is PriceCurve ...
whereas I am guessing Rails thinks the singular ought to br PriceCurf
?!
I''m sure there is a simple way around this linguistic blunder that
doesn''t involve the use of pigeon English.
2012 Jul 24
3
Adding resource parameters in inheritence
Hello,
On some machines being managed by Puppet I would like to perform targetted
audit runs with "puppet -t --noop --tags audit"
For better or for worse I am trying to do this with a separate module
"audit" rather than add the audit => to the resources and use inheritence.
i.e.
class audit::resolver inherits resolver::config {
notify{"Running audit on
2006 Apr 11
1
Mixins?
As is often the case when I tackle a new platform/language, I get the big
picture very quickly (because frameworks are frameworks are frameworks) but
its the nitty-gritty of the language that bogs me down...
So I have some similar methods on a few of my model classes that I wanted to
push into a helper. Now I reckoned that the Ruby way was to create a module
and mix it in with include. However, I
2010 Oct 13
2
acts_as_list issue in single table inheritence
Hello Rails experts,
Need your help in following issue with the acts_as_list and single
table inheritence
Code details :
http://pastie.org/1214846
Hello Rails experts,
Need your help in following issue with the acts_as_list and single
table inheritence
Code details :
http://pastie.org/1214846
But here I need create those entries with the scope on Relater only and
not on RelaterFeed or
2006 Mar 05
1
Help with Self-Referential HABTM
With the help of the Rails Recipes have got a self-referential HABTM
relationship working, but I''m really struggling with getting a new entry
from a form accepted. i should say here that the form is also submitting
info for the join table too.
So in my model I have:
class Type < ActiveRecord::Base
has_and_belongs_to_many :subtypes,
:class_name => ''Type'',
2005 Dec 28
6
coverage does not work
Hi,
I''ve installed coverage (gem install coverage) and try to run tests with
-rcoverage option on, but following error occurs:
ruby: No such file to load -- coverage (LoadError)
I try:
ruby -rcoverage mytest.rb
1. I have rubygems in evn var RUBYOPT
2. Gem seems to be installed properly (I can read doc via gems, the files
exist in the ../gem/... dirs)
Does anyone know what is the
2006 Jun 12
2
dom id on form_remote_tag
I want to make use of a form_remote_tag to submit a form
asynchronously. Easy done. However, we also want to add an
observe_form tag to check for some value changes while the form is
being entered.
The observe_form tag needs a dom id to work on but I can''t see how to
enter an html option for the dom id of the form on the
form_remote_tag.
Any ideas?
Here is the form tag so far...
2005 Dec 12
0
Is this a good use for Single Table Inheritence?
Hi everyone,
Where I work, there are several standards (heh) for position codes for
staff and faculty. For instance, a Dean could be listed as DEA or
DEN. An Assistant Professor could be AST or ASO. There are some
cases where typos have crepts into the system, and AS0 (zero) could
have meant ASO.
Now, beyond getting those responsible to clean up their data (we are),
I need to deal with this