Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# Old way, assumes that since this is a User test
# it should look for @user and use it in the
# macros if it's set. Otherwise it instantiates a
# User and uses that in the macro.
class UserTest < Whatever::TestCase
context "A user that is an admin" do
setup do
@user = User.new
@user.admin = true
end
should_validate_presence_of :name
end
end
# New way, specify what instance the macros
# should use.
class UserTest < Whatever::TestCase
context "A user that is an admin" do
setup do
@user = User.new
@user.admin = true
end
subject { @user }
should_validate_presence_of :name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.