public
Created

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8
describe Article do
subject
def article; Article.new; end
 
it "validates presence of :title" do
article.should validate_presence_of(:title)
end
end

FWIW, you can already do this:

describe Article do
  let(:article) { Article.new }
  subject { article }
end

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!

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.