乱翻字典
2008-Dec-17 07:01 UTC
My first rspec reports "undefined method `key?'' for #<String:0x46b1df0>"
this my first rspec test, it is very simple ----------------------------------------------------------------------------------------------------------------------------------------->require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') describe Doc do fixtures :docs before(:each) do @doc=docs(:yjn_bjy) end it "should create a new instance given valid attributes" do true end end <----------------------------------------------------------------------------------------------------------------------------------------- after run "spec -fs spec\models\doc_spec.rb" at cmd line,it report this error ----------------------------------------------------------------------------------------------------------------------------------------->1) NoMethodError in ''Doc should create a new instance given valid attributes'' undefined method `key?'' for #<String:0x46b1df0> <----------------------------------------------------------------------------------------------------------------------------------------- My environment: OS:Windows Rails:2.2.2 RSpec:1.1.11 rspec-rails:1.1.11 IDE:Netbeans6.5 Ruby:1.8.6 I use rspec_scaffold to generate these codes,and really confused about this problems. Hope for your suggestion! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Dec-17 07:10 UTC
Re: My first rspec reports "undefined method `key?'' for #<String:0x46b1df0>"
There''s probably a stack trace associated with that error, try looking in that. ----- Ryan Bigg Freelancer http://frozenplague.net On 17/12/2008, at 5:31 PM, 乱翻字典 wrote:> > this my first rspec test, it is very simple > ----------------------------------------------------------------------------------------------------------------------------------------- >> > require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') > > describe Doc do > fixtures :docs > before(:each) do > @doc=docs(:yjn_bjy) > end > > it "should create a new instance given valid attributes" do > true > end > end > < > ----------------------------------------------------------------------------------------------------------------------------------------- > after run "spec -fs spec\models\doc_spec.rb" at cmd line,it report > this error > ----------------------------------------------------------------------------------------------------------------------------------------- >> > 1) > NoMethodError in ''Doc should create a new instance given valid > attributes'' > undefined method `key?'' for #<String:0x46b1df0> > < > ----------------------------------------------------------------------------------------------------------------------------------------- > > My environment: > OS:Windows > Rails:2.2.2 > RSpec:1.1.11 > rspec-rails:1.1.11 > IDE:Netbeans6.5 > Ruby:1.8.6 > > I use rspec_scaffold to generate these codes,and really confused about > this problems. > Hope for your suggestion! > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---