Last active
December 16, 2015 14:29
-
-
Save camelpunch/5449597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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