Skip to content

Commit

Permalink
add data type spec
Browse files Browse the repository at this point in the history
  • Loading branch information
decoch committed Sep 19, 2020
1 parent f517069 commit 09008a4
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions spec/basic/step03_data_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'spec_helper'
require 'date'
require 'bigdecimal'

describe 'Step03DataTypeSpec' do
context 'basic type' do
# What string is sea variable at the method end? <br>
# (メソッド終了時の変数 sea の中身は?)
it 'spec datatype basic type' do
sea = "mystic"
land = 416
piari = Date.new(2001, 9, 4)
bonvo = DateTime.new(2001, 9, 4, 12, 34, 56)
dstore = true
amba = BigDecimal("9.4")

piari = piari + 1
land = piari.year
bonvo = bonvo << 1
land = bonvo.month
land -= 1
if dstore
addedDecimal = amba + BigDecimal(land)
sea = addedDecimal.to_s
end
log(sea); # your answer? =>
end
end

context 'object' do
# Same as the previous method question. (前のメソッドの質問と同じ)
it 'spec datatype object' do
stage = St3ImmutableStage.new("hangar")
sea = stage.stage_name()
log(sea) # your answer? =>
end
end

class St3ImmutableStage
attr_reader :stage_name

def initialize(stage_name)
@stage_name = stage_name
end
end
end

0 comments on commit 09008a4

Please sign in to comment.