Skip to content

Instantly share code, notes, and snippets.

@moro
Created November 19, 2010 01:28
Show Gist options
  • Save moro/705995 to your computer and use it in GitHub Desktop.
Save moro/705995 to your computer and use it in GitHub Desktop.
require 'rspec'
require 'active_support/core_ext/array'
describe do
def parent_subject
self.class.ancestors[1].instance_variable_get('@explicit_subject_block').call
end
subject { [:one, :two, :three] }
its(:first) { should == :one }
its(:second) { should == :two }
describe 'its third' do
subject { parent_subject[2] }
it{ should == :three }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment