Skip to content

Instantly share code, notes, and snippets.

@coreyhaines
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coreyhaines/db2257c18549b6f87c1e to your computer and use it in GitHub Desktop.
Save coreyhaines/db2257c18549b6f87c1e to your computer and use it in GitHub Desktop.
Using super() in rspec's subject
# Phew! Turns out this was generated by transpec, not by a human!
before do
@admin = User.create(username: "user", password: "password", password_confirmation: "password")
end
subject{ @admin }
describe '#remember_token' do
subject { super().remember_token }
it { is_expected.not_to be_blank }
end
@coreyhaines
Copy link
Author

Okay, turns out that this is a result of running transpec. I'm glad to hear nobody actually wrote this. :)

But, in general, my personal style hasn't evolved to using explicit subject / it. I'm pretty old school. :)

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