RVM v1.9.2, ruby-1.8.7-p302, rspec-rails v2.7.0
I have a set of dynamic ERB fixtures. Here is a sample of what the fixture file looks like, edited for brevity:
<% controller_action_pairs = %w[
<% controller_action_pairs.each do |row| %>
<%= row %>:
controller: <%= row.split('#').first %>
action: <%= row.split('#').last %>
<% end %>
The fixture loads fine via "rake db:fixtures:load FIXTURE=pages" but RSpec chokes on it:
describe Page do
it 'should find pipes#index' do
Page.where(:controller=>:pipes, :action=>:index).count.should == 1
1) Page should find pipes#index
Failure/Error: Unable to find matching line from backtrace
`@pipes#update' is not allowed as an instance variable name
The important thing to note here is that if I manually load the fixture through rake, and run the same test in the console, it works
ruby-1.8.7-p302 :003 > Page.where(:controller=>:pipes, :action=>:index).count
So, this seems to be some kind of problem with RSpec magic. Since I'm not sure how (or why) it's being converted by RSpec into an instance variable, I'm not sure how to work around the issue.
rspec-rails provides an interface into Rails testing framework, but doesn't actually do anything with fixtures at all beyond telling Rails where to find them (based on what you configure in spec_helper.rb. I'd be very surprised if the problem were actually in RSpec. Please try the same example in a Rails test and let me know if you see any different behavior.
Actually, I just realized this is the rspec-1 tracker. Unfortunately github doesn't offer me a place to put a note at the top of the issues page to tell you that.
I'm going to close this issue, but if if you try it with a Rails test as I mentioned in the previous comment and it works fine (meaning the problem really is in rspec), please re-report it to https://github.com/rspec/rspec-rails/issues.