I usually use Shoulda for this:

http://rubydoc.info/gems/shoulda/frames

should belong_to(:user) should have_many(:tags).through(:taggings)  


Dheeraj Kumar


On Friday 27 January 2012 at 4:51 PM, Guilherme R. wrote:

> Good morning,
>  
> I'm new to rails and am having some basic questions in development. See
> if anyone can help me with a test problem. I need to test if my model
> "Procedure" is linked to the workflow. If not, the system must
> acknowledge an error. Below is the code that is in the file test \ unit
> \ procedure_test.rb.
>  
> require 'test_helper'
>  
> class ProcedureTest < ActiveSupport::TestCase
> should belong_to :workflow
> should has_many :tasks, :through => :workflow
> #should has_one :timeline
> #should has_many :timeline_items, :through => :timeline
> end
>  
> The shoul "belong_to" is working normally but when running "rake test"
> appears the following error:
>  
> $ Rake test
> / home / guilhermec / iba_jornais / test / unit / procedure_test.rb: 5:
> in `‘: undefined method `has_many’ for ProcedureTest:Class
> (NoMethodError)
> from /home/guilhermec/iba_jornais/test/unit/procedure_test.rb:3:in `<top
> (required)>’
> from
> /home/guilhermec/.rvm/gems/ruby-1.9.2-p180@iba-jornais/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
> `require’
> from
> /home/guilhermec/.rvm/gems/ruby-1.9.2-p180@iba-jornais/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
> `block in require’
> from
> /home/guilhermec/.rvm/gems/ruby-1.9.2-p180@iba-jornais/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in
> `load_dependency’
> from
> /home/guilhermec/.rvm/gems/ruby-1.9.2-p180@iba-jornais/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
> `require’
> from
> /home/guilhermec/.rvm/gems/ruby-1.9.2-p180@iba-jornais/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in
> `block (2 levels) in '
> from `Each '
> from `Block in'
> from `Select '
> from `'
> Loaded suite
>  
>  
> Does anyone know what I should do to fix this?
>  
> --  
> Posted via http://www.ruby-forum.com/.
>  
> --  
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]).
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>  
>  


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to