When you use one-liner syntax like:
it { should have_something }
It is exactly like you wrote
it 'should have something' do
subject.should have_something
end
In your code you have declared your subject to be the class Performance
:
subject { Performance }
This means that your tests are actually:
it 'should respond to file_name' do
Performance.should respond_to(:file_name)
end
Which, of course, it doesn't.
When you set the subject to @performance
subject { @performance }
the test becomes:
it 'should respond to file_name' do
@performance.should respond_to(:file_name)
end
which should work as expected.