Skip to content

Instantly share code, notes, and snippets.

@easonhan007
Created September 8, 2013 02:33
Show Gist options
  • Save easonhan007/6481397 to your computer and use it in GitHub Desktop.
Save easonhan007/6481397 to your computer and use it in GitHub Desktop.
test case of Phone
#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