[rspec-users] feedback on feature request

34 views
Skip to first unread message

David Chelimsky

unread,
Jan 31, 2011, 9:31:20 AM1/31/11
to rspec-users
Hey all,

There is a feature request for rspec-core that I'd like to see some opinions about. The idea is to be able to reference subjects and methods defined with let() in parent groups from within the subject() and let() methods in a child group. Two approaches are to use super or a block argument:

describe "outer" do
subject { "outer thing" }
describe "inner with super" do
subject { super.gsub("outer","inner") }
end
describe "inner with block arg" do
subject { |outer_outer| outer_subject.gsub("outer","inner") }
end
end

The same would apply to let:

describe "outer" do
let(:thing) { "outer thing" }
describe "inner with super" do
let(:thing) { super.gsub("outer","inner") }
end
describe "inner with block arg" do
let(:thing) { |outer_thing| outer_thing.gsub("outer","inner") }
end
end

Please comment in the github issue: https://github.com/rspec/rspec-core/issues/294 rather than in this thread.

Cheers,
David

_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply all
Reply to author
Forward
0 new messages