diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5be63fc --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--require spec_helper +--format documentation diff --git a/spec/basic/step01_variable_spec.rb b/spec/basic/step01_variable_spec.rb new file mode 100644 index 0000000..b808ace --- /dev/null +++ b/spec/basic/step01_variable_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..59ba7d0 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,9 @@ +module SpecHelper + def log(messages) + puts(messages) + end +end + +RSpec.configure do |config| + config.include SpecHelper +end