Forum: Ruby on Rails My first rspec reports "undefined method `key?' for #<String:0x46b1df0>"

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
46d6f38464a6462eb23fe7e117dcfb9b?d=identicon&s=25 乱翻字典 (Guest)
on 2008-12-17 08:02
(Received via mailing list)
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!
9a2a53db8e9b4476038c94a64b32833f?d=identicon&s=25 Ryan Bigg (ryan-bigg)
on 2008-12-17 08:10
(Received via mailing list)
There's probably a stack trace associated with that error, try looking
in that.
-----
Ryan Bigg
Freelancer
http://frozenplague.net
This topic is locked and can not be replied to.