I’m using:
Rails 3.0.7 and
Rspec 2.5.0
via rvm
When I run this spec (using autotest or bundle exec autotest or bundle exec rspec spec/) below:
require 'spec_helper'
require 'yaml'
def twitter_feed(id=1)
ruby_object = YAML.load_file(::Rails.root.to_s + "/spec/fixtures/feeds/twitter_response_#{id}.yml")
end
I get this:
Failure/Error: ruby_object = YAML.load_file(::Rails.root.to_s + "/spec/fixtures/feeds/twitter_response_#{id}.yml")
TypeError:
invalid subclass
# ./spec/models/tweet_spec.rb:6:in `twitter_feed'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:133:in `transfer'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:133:in `node_import'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:133:in `load'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:133:in `load'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:144:in `load_file'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:143:in `open'
# /Users/natebean/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/yaml.rb:143:in `load_file'
# ./spec/models/tweet_spec.rb:5:in `twitter_feed'
# ./spec/models/tweet_spec.rb:58
This “was” working. I can’t find any other information on this error on the internet. I’ve moved from rails 3.0.3 to 3.0.7, but don’t remember it not working after the upgrade.
Any suggestions? Thanks.
The yaml file I was pulling was looking for Hashie::Mash to map the data to. Up to know I didn’t need to require ‘hashie’, but that has “fixed this problem”.
I added to this to my spec and it is now working.