Create a gist now

Instantly share code, notes, and snippets.

describe Article do
def article;; end
it "validates presence of :title" do
article.should validate_presence_of(:title)

FWIW, you can already do this:

describe Article do
  let(:article) { }
  subject { article }

This gives you the subject/named-thing duality you're looking for, and requires less "magic" than the above (which would need a method_added hook, right?). And it already works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment