Skip to content

Commit

Permalink
add local variable spec
Browse files Browse the repository at this point in the history
  • Loading branch information
decoch committed Oct 27, 2019
1 parent f0fba17 commit 619dce9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--format documentation
40 changes: 40 additions & 0 deletions spec/basic/step01_variable_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'spec_helper'

describe 'Step01VariableTest' do
context 'local variable' do
# What string is sea variable at the method end?
# メソッド終了時の変数 sea の中身は?
it 'variable basic' do
sea = 'mystic'
log(sea) # your answer? => mystic
end

# Same as the previous method question. (前のメソッドの質問と同じ)
it 'variable initial' do
sea = 'mystic'
land = 8.to_s
piari = nil.to_s
dstore = 'mal'
sea = sea + land + piari + ':' + dstore
log(sea) # your answer? =>
end

# Same as the previous method question. (前のメソッドの質問と同じ)
it 'variable reassigned basic' do
sea = 'mystic'
land = 'oneman'
sea = land
land = land + "'s dreams"
log(sea) # your answer? =>
end

# Same as the previous method question. (前のメソッドの質問と同じ)
it 'variable reassigned int' do
sea = 94
land = 415
sea = land
land += 1
log(sea) # your answer? =>
end
end
end
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module SpecHelper
def log(messages)
puts(messages)
end
end

RSpec.configure do |config|
config.include SpecHelper
end

0 comments on commit 619dce9

Please sign in to comment.