Created
May 2, 2020 16:44
-
-
Save Oceantidote/433077cb7eb08986c023a87a364fe510 to your computer and use it in GitHub Desktop.
This file contains hidden or 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_relative "../citizen" | |
describe Citizen do | |
# can vote? with a true and falsey condition | |
describe "#can_vote?" do | |
it "should return true for a ctitizen aged 20" do | |
citizen_20 = Citizen.new("bob", "hope", 20) | |
expect(citizen_20.can_vote?).to eq(true) | |
end | |
it "should return false for a citizen of 15" do | |
citizen_15 = Citizen.new("bob", "hope", 15) | |
expect(citizen_15.can_vote?).to eq(false) | |
end | |
end | |
# full_name method, returns a nicely capitalized string | |
describe "#full_name" do | |
it "should return a capitlaized string with the full name" do | |
citizen_20 = Citizen.new("bob", "hope", 20) | |
expect(citizen_20.full_name).to eq("Bob Hope") | |
end | |
it "should return a capitlaized string with the full name even for dirty inputs" do | |
citizen_15 = Citizen.new("terry ", " Venables", 15) | |
expect(citizen_15.full_name).to eq("Terry Venables") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment