Created
September 8, 2013 02:33
-
-
Save easonhan007/6481397 to your computer and use it in GitHub Desktop.
test case of Phone
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
#encoding: utf-8 | |
class Phone | |
attr_reader :type, :has_keyboard | |
def initialize(type, has_keyboard) | |
# 型号 | |
@type = type | |
# 键盘 | |
@has_keyboard = has_keyboard | |
end | |
end | |
describe Phone do | |
# example | |
it 'should have type' do | |
p = Phone.new('AH', true) | |
p.type.should eql('AH') | |
# if p.type.eql?('AH') then pass | |
# else fail | |
end | |
it 'has_keyboard should be true' do | |
p = Phone.new('AH', true) | |
p.has_keyboard.should be_true | |
end | |
it 'has_keyboard should be false' do | |
p = Phone.new('AH', false) | |
p.has_keyboard.should be_false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment