Ruby on Rails
Friday, January 27, 2012
I usually use Shoulda for this:
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. Seeif 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 mustacknowledge an error. Below is the code that is in the file test \ unit\ procedure_test.rb.require 'test_helper'class ProcedureTest < ActiveSupport::TestCaseshould belong_to :workflowshould has_many :tasks, :through => :workflow#should has_one :timeline#should has_many :timeline_items, :through => :timelineendThe 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 suiteDoes 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 rubyonrails-talk@googlegroups.com.To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment