Skip to content

Instantly share code, notes, and snippets.

@camelpunch
Last active December 16, 2015 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camelpunch/5449597 to your computer and use it in GitHub Desktop.
Save camelpunch/5449597 to your computer and use it in GitHub Desktop.
describe "some group" do
example "example 1" do
expect(@triangle).to have(2).sides
end
describe "some sub group" do
it "has another example, using the 'it' alias" do
expect(@circle).to be_square
end
end
example "example 2" do
expect(@square).to have(3).sides
end
end
require 'minitest/autorun'
class User
def self.login(username, password)
if username == 'fred' && password == '123'
@logged_in = true
end
end
def self.logged_in?
@logged_in == true
end
end
class UserTest < MiniTest::Unit::TestCase
def test_logs_in_if_correct_credentials_used
User.login('fred', '123')
assert User.logged_in?
end
def test_doesnt_log_in_if_incorrect_credentials_used
User.login('bill', '321')
refute User.logged_in?, "User was logged in, but expected not to be"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment