Skip to content

Instantly share code, notes, and snippets.

@jasonkarns
Created October 25, 2011 19:19
Show Gist options
  • Save jasonkarns/1313912 to your computer and use it in GitHub Desktop.
Save jasonkarns/1313912 to your computer and use it in GitHub Desktop.
each_subjects
describe ArModel do
context "when active" do
subject { ArModel.active }
each_subjects(:status_code) { should eql('ACTIVE') }
end
end
module RSpec::Core::Subject::ClassMethods
def each_subjects(attribute, &block)
@explicit_subject_block.call.each do |sub|
subject {sub}
its(attribute, &block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment