extra test sometimes generated when attr_reader used in nested describe
Reported by Chris Didyk | April 12th, 2008 @ 03:55 AM | in No-Milestone-Assigned
Ok, this seems pretty obscure so far, and likely confined to rspec_on_rails, as the same scenario in straight-up ruby didn't cause any trouble.
I have something like the following:
describe MyClass do
attr_accessor :test
before :all do
@test = Class.new do
#whatever...
end
end
describe "when doing something special" do
attr_reader :test_instance
before :each do
@test_instance = test.new
end
it "should be magical"
end
end
The problem is that when I run the specs (using rake spec, script/spec, or spec), the test_instance reader method appears to be treated as a spec itself, so it counts in the spec count and displays in the spec report.
I'll continue to dig, but I figured I'd create this ticket in case someone more familiar with the RSpec source immediately understands where the problem might be and can fix it easily.
BTW, if it matters, I'm doing all this in Kubuntu.
Best,
Chris
Comments and changes to this ticket
-

Chris Didyk April 15th, 2008 @ 06:19 PM
UPDATE: There was no reason to dynamically create a class with Class.new. I extracted that out and everything's fine. My apologies.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
