ruby_learner 1.1.11 → 1.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b758a70837556ede0711af48116828391de4e15e
4
- data.tar.gz: 0f7ba7df2afcc732276911d04af17bc5e857da53
3
+ metadata.gz: a211a07e2c7f31b1ace1ff9bc17bc628787df2a8
4
+ data.tar.gz: 1f013089aef7f67c771a356d39a4775208e02f9b
5
5
  SHA512:
6
- metadata.gz: 20f686d46c02b5cd72360f86c8cda3e6ffdf251876f819273e6155e1673f3a33df30deaf8b82dd9eed99b69e6ee4dcf1a3cef722f5ed7edd7aa73a4359eaf712
7
- data.tar.gz: 9f8b65afd8d4b31134db0229976d21dbab7f1f9c7eb3468192086660336780245ef4551b811e5910309ba5ddf9422a29f9ecb10626117ba173c7985a3b3dfa2b
6
+ metadata.gz: 57a37a03f505b27a5846ab88dabfa80cb27d10a07318e1750c6adc306743e68c1750e9ab4ae45e8ea26bad17b7545d7625df791cd586d0289a5a39f214373f12
7
+ data.tar.gz: 7bf3612f92c5b834518fdb70542854d1b4f470bf6c182b2018362d352a1c75743ad82a8fa8426b02b99b593f7fb82099e1677533239dedfe37ec574007be6c9c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_learner (1.1.10)
4
+ ruby_learner (1.1.12)
5
5
  rspec (~> 3.8)
6
6
  rubocop (~> 0.55.0)
7
7
  thor (~> 0.20.0)
@@ -30,23 +30,36 @@ module RubyLearner
30
30
  option :next, aliases: :n, type: :boolean
31
31
  option :drill, aliases: :d, type: :boolean
32
32
  def sequential_check(*args)
33
- sequential_main = SequentialMain.new(@gem_dir, @workshop_dir)
34
- if options[:drill]
35
- sequential_main.drill_contents
36
- elsif options[:next]
37
- final_sec, final_par = sequential_main.get_final_history(@gem_dir)
38
- next_sec, next_par = sequential_main.get_next_question(final_sec, final_par)
39
- sequential_main.action(next_sec, next_par)
40
- else
41
- sequential_main.action(args[0], args[1]) if args.empty? == false
33
+ begin
34
+ sequential_main = SequentialMain.new(@gem_dir, @workshop_dir)
35
+ if options[:drill]
36
+ sequential_main.drill_contents
37
+ elsif options[:next]
38
+ final_sec, final_par = sequential_main.get_final_history(@gem_dir)
39
+ next_sec, next_par = sequential_main.get_next_question(final_sec, final_par)
40
+ sequential_main.action(next_sec, next_par)
41
+ else
42
+ sequential_main.action(args[0], args[1])
43
+ end
44
+ rescue => error
45
+ puts "Error.message: #{error.message}"
46
+ puts 'sequential_check has 3-modes'
47
+ puts 'mode-1: $ sequential_check [section:1~11] [part:1~] ,ex) sequential_check 1 3'
48
+ puts 'mode-2: $ sequential_check -d, check drill contents'
49
+ puts 'mode-3: $ sequential_check -n, learn next to your last-question'
42
50
  end
43
51
  end
44
52
 
45
53
  desc 'restore','check your restore'
54
+ option :refresh, aliases: :r, type: :boolean
46
55
  def restore(*args)
47
- if args.empty? == true then
56
+ if options[:refresh]
57
+ system("rm -rf #{@workshop_dir}/restore/")
58
+ system("mkdir #{@workshop_dir}/restore")
59
+ elsif args.empty? == true then
48
60
  system("ls #{@workshop_dir}/restore")
49
61
  print("\n If you want to open a restore_file, you execute 'ruby_learner restore [file_name]'")
62
+ print("\n If you want to remove all restore_files, you execute 'ruby_learner restore -r'")
50
63
  else
51
64
  system("emacs #{@workshop_dir}/restore/#{args[0]}")
52
65
  end
@@ -31,7 +31,7 @@ class SequentialMain
31
31
 
32
32
  def drill_contents
33
33
  puts "section_1 1~3"
34
- puts "section_2 1~2"
34
+ puts "section_2 1~3"
35
35
  puts "section_3 1"
36
36
  puts "section_4 1"
37
37
  puts "section_5 1~2"
@@ -60,20 +60,23 @@ class SequentialMain
60
60
 
61
61
  def get_next_question(final_sec, final_par)
62
62
  if final_sec == 1
63
- if final_par == 1
64
- next_sec = 1
65
- next_par = 2
66
- elsif final_par == 2
67
- next_sec = 1
68
- next_par = 3
69
- else
70
- next_sec = 2
71
- next_par = 1
72
- end
63
+ if final_par == 1
64
+ next_sec = 1
65
+ next_par = 2
66
+ elsif final_par == 2
67
+ next_sec = 1
68
+ next_par = 3
69
+ else
70
+ next_sec = 2
71
+ next_par = 1
72
+ end
73
73
  elsif final_sec == 2
74
74
  if final_par == 1
75
75
  next_sec = 2
76
76
  next_par = 2
77
+ elsif final_par == 2
78
+ next_sec = 2
79
+ next_par = 3
77
80
  else
78
81
  next_sec = 3
79
82
  next_par = 1
@@ -1,3 +1,3 @@
1
1
  module RubyLearner
2
- VERSION = "1.1.11"
2
+ VERSION = "1.1.13"
3
3
  end
@@ -1,19 +1,33 @@
1
-
2
- 「Hello, Ruby.」という文字列を表示するプログラムを作成せよ。文字列の終わりは改行すること。
3
-
4
-
5
- - オブジェクト
6
-
7
- Rubyにおいて、文字列、数値、時刻など、様々なデータを表現するための用語。
8
-
9
-
10
- - print, puts
11
-
12
- print 引数
13
- puts 引数
14
-
15
- 引数として与えられた文字列を出力するメソッド。
16
- putsメソッドはprintメソッドの処理に加え、与えられた文字列の末尾で改行を行う。
17
-
18
- 文字列は「"(ダブルクォート)」で囲われた文字の集合を指す。
19
- 改行は特殊文字「\n」を用いる。
1
+ -課題-
2
+ 「Hello, Ruby.」という文字列を標準出力に表示するプログラムを作成せよ。
3
+
4
+ * オブジェクトについて
5
+ - ここでは詳しいことは説明しませんが以下のことは覚えておいてください.
6
+ - Rubyでは文字列や配列,数値等の全てがオブジェクトです.
7
+
8
+ * 文字列について
9
+ - 文字列を作る最も一般的な方法は,シングルクオート('),ダブルクオート(")で文字を囲む方法です.
10
+
11
+ * 特殊文字
12
+ - 一部の文字には特別な機能を持つものがあるので,以下にその例をいくつか示します.
13
+ - 改行文字(/n)...文字列を改行させる.
14
+ - タブ文字(/t)...文字列をインデントする.PCのTABキーと同じような役割.
15
+ - 垂直タブ文字(\v)...文字列内で,垂直に一段ずらすように空白を入れる.
16
+ - 式展開(#{})...変数の持つ値を展開する.
17
+
18
+ * シングルクオート(')とダブルクオート(")の違い
19
+ - シングルクオートで囲まれた文字列では,特殊文字は使用できず,全て普通の文字として認識されます.
20
+ - ダブルクオートで囲まれた文字列では,特殊文字を使用できます.
21
+
22
+ * 標準出力
23
+ - 引数として与えられた文字列を標準出力に出力するメソッドの紹介.
24
+ ** print
25
+ - 使用方法...print 引数
26
+ - 機能...引数のオブジェクトを文字列に変換して標準出力に出力する.
27
+ ** puts
28
+ - 使用方法...puts 引数
29
+ - 機能...引数のオブジェクトを文字列に変換し、改行を加えて標準出力に出力する.
30
+ ** p
31
+ - 使用方法...p 引数
32
+ - 機能...引数のオブジェクトを分かりやすい文字列にして標準出力に出力する.
33
+ ex) 文字列であれば””で囲まれていて、数値はそのま出力する末尾にはそれぞれ改行が付け足される..
@@ -1,9 +1,9 @@
1
1
  require "open3"
2
2
 
3
- RSpec.describe "string-check" do
3
+ RSpec.describe "section-1, part-1" do
4
4
  it "return 'Hello, Ruby.'" do
5
5
  workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
6
6
  stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb")
7
- expect { puts stdout }.to output("Hello, Ruby.\n").to_stdout
7
+ expect { print "#{stdout}"}.to output('Hello, Ruby.').to_stdout
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  # section_1/part_2/answer.rb
2
2
  # 1-2-print.rb
3
- puts 'Hello, "Ruby".'
3
+ puts "Hello,\vRuby."
@@ -1,6 +1,33 @@
1
- 「Hello, "Ruby".」という文字列を表示するプログラムを作成せよ。
1
+ -課題-
2
+ 「Hello,Ruby.」という文字列のカンマ(,)の後ろで垂直タブ(\v)を機能させ,標準出力に表示するプログラムを作成せよ。なお,文字列の最後は改行すること.
2
3
 
4
+ * オブジェクトについて
5
+ - ここでは詳しいことは説明しませんが以下のことは覚えておいてください.
6
+ - Rubyでは文字列や配列,数値等の全てがオブジェクトです.
3
7
 
4
- - 特殊文字
8
+ * 文字列について
9
+ - 文字列を作る最も一般的な方法は,シングルクオート('),ダブルクオート(")で文字を囲む方法です.
5
10
 
6
- 文字列中に「"」や「\」を用いたい場合は、それぞれ特殊文字「\"」「\\」を用いる。
11
+ * 特殊文字
12
+ - 一部の文字には特別な機能を持つものがあるので,以下にその例をいくつか示します.
13
+ - 改行文字(/n)...文字列を改行させる.
14
+ - タブ文字(/t)...文字列をインデントする.PCのTABキーと同じような役割.
15
+ - 垂直タブ文字(\v)...文字列内で,垂直に一段ずらすように空白を入れる.
16
+ - 式展開(#{})...変数の持つ値を展開する.
17
+
18
+ * シングルクオート(')とダブルクオート(")の違い
19
+ - シングルクオートで囲まれた文字列では,特殊文字は使用できず,全て普通の文字として認識されます.
20
+ - ダブルクオートで囲まれた文字列では,特殊文字を使用できます.
21
+
22
+ * 標準出力
23
+ - 引数として与えられた文字列を標準出力に出力するメソッドの紹介.
24
+ ** print
25
+ - 使用方法...print 引数
26
+ - 機能...引数のオブジェクトを文字列に変換して標準出力に出力する.
27
+ ** puts
28
+ - 使用方法...puts 引数
29
+ - 機能...引数のオブジェクトを文字列に変換し、改行を加えて標準出力に出力する.
30
+ ** p
31
+ - 使用方法...p 引数
32
+ - 機能...引数のオブジェクトを分かりやすい文字列にして標準出力に出力する.
33
+ ex) 文字列であれば””で囲まれていて、数値はそのま出力す.末尾にはそれぞれ改行が付け足される.
@@ -4,6 +4,6 @@ RSpec.describe "string-check" do
4
4
  it 'return "Hello, Ruby.\n"' do
5
5
  workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
6
6
  stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb")
7
- expect { puts stdout }.to output("Hello, \"Ruby\".\n").to_stdout
7
+ expect { puts stdout }.to output("Hello,\vRuby.\n").to_stdout
8
8
  end
9
9
  end
@@ -1,3 +1,4 @@
1
1
  # section_1/part_3/answer.rb
2
2
  # 1-3-p.rb
3
- p "Hello,\n\tRuby."
3
+ p 'Hello, Ruby.'
4
+ p 2020
@@ -1,8 +1,34 @@
1
- 「"Hello,\n\tRuby."」という文字列を表示するプログラムを作成せよ。
1
+ -課題-
2
+ 「"Hello, Ruby."
3
+ 2020 」という文字列を標準出力に表示するプログラムを作成せよ。2020の末尾は改行すること.
2
4
 
3
- - p
5
+ * オブジェクトについて
6
+ - ここでは詳しいことは説明しませんが以下のことは覚えておいてください.
7
+ - Rubyでは文字列や配列,数値等の全てがオブジェクトです.
4
8
 
5
- p 引数
9
+ * 文字列について
10
+ - 文字列を作る最も一般的な方法は,シングルクオート('),ダブルクオート(")で文字を囲む方法です.
6
11
 
7
- 引数として与えられた文字列を「" "」で囲んで表示するメソッド
8
- その他の処理はputsメソッドに順ずる
12
+ * 特殊文字
13
+ - 一部の文字には特別な機能を持つものがあるので,以下にその例をいくつか示します.
14
+ - 改行文字(/n)...文字列を改行させる.
15
+ - タブ文字(/t)...文字列をインデントする.PCのTABキーと同じような役割.
16
+ - 垂直タブ文字(\v)...文字列内で,垂直に一段ずらすように空白を入れる.
17
+ - 式展開(#{})...変数の持つ値を展開する.
18
+
19
+ * シングルクオート(')とダブルクオート(")の違い
20
+ - シングルクオートで囲まれた文字列では,特殊文字は使用できず,全て普通の文字として認識されます.
21
+ - ダブルクオートで囲まれた文字列では,特殊文字を使用できます.
22
+
23
+ * 標準出力
24
+ - 引数として与えられた文字列を標準出力に出力するメソッドの紹介.
25
+ ** print
26
+ - 使用方法...print 引数
27
+ - 機能...引数のオブジェクトを文字列に変換して標準出力に出力する.
28
+ ** puts
29
+ - 使用方法...puts 引数
30
+ - 機能...引数のオブジェクトを文字列に変換し、改行を加えて標準出力に出力する.
31
+ ** p
32
+ - 使用方法...p 引数
33
+ - 機能...引数のオブジェクトを分かりやすい文字列にして標準出力に出力する.
34
+ ex) 文字列であれば””で囲まれていて、数値はそのま出力する末尾にはそれぞれ改行が付け足される.
@@ -4,6 +4,6 @@ RSpec.describe "string-check" do
4
4
  it "return 'Hello, Ruby.'" do
5
5
  workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
6
6
  stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb")
7
- expect { puts stdout }.to output("\"Hello,\\n\\tRuby.\"\n").to_stdout
7
+ expect { puts stdout }.to output("\"Hello, Ruby.\"\n2020\n").to_stdout
8
8
  end
9
9
  end
@@ -1,7 +1,25 @@
1
- コマンドラインから5つの引数を受け取り、受け取った順に表示するプログラムを作成せよ。
1
+ -課題-
2
+ コマンドラインから5つの引数を受け取り,受け取った順に改行させて,標準出力に表示するプログラムを作成せよ.
2
3
 
4
+ * 標準入力
5
+ - 標準入力とはキーボード入力のことです.
6
+ - 標準入力を行えるメソッドの紹介.
7
+ ** STDIN
8
+ - 標準入力のレシーバー
9
+ ** レシーバ
10
+ - ドット(.)の左側
11
+ ** gets
12
+ - get string の略
13
+ - 使用方法...変数 = STDIN.gets
14
+ - 機能...標準入力にキーボード入力された1行の文字列を取得する.
15
+ ** readlines
16
+ - 使用方法...変数 = STDIN.readlines
17
+ - 機能...複数行の文字列を,1行ごとの配列として取得する.入力を終了する場合はCtrl+Dを行う.
18
+ ** ARGV
19
+ - 使用方法...ARGVを書いたファイルを実行する場合に,スペースを区切りに入力文字を記入していく.
20
+ ex) ruby argv.rb a b c d
21
+ - 機能...コマンドラインから引数として与えられた文字列を格納する配列オブジェクト.
3
22
 
4
- - ARGV[num]
5
-
6
- コマンドラインから引数として与えられた文字列を格納する配列オブジェクト
7
- 1つ目の引数はARGV[0]に格納される
23
+ * chomp
24
+ - 使用方法...文字列.chomp
25
+ - 機能...文字列の末尾の改行文字を取り除いた新しい文字列を返す
@@ -1,14 +1,39 @@
1
- コマンドラインから2つの引数を受け取って数値に変換し、その和、差、積、商を表示するプログラムを作成せよ。
1
+ -課題-
2
+ コマンドラインから2つの引数を受け取って整数に変換し,その和,差,積,商を表示するプログラムを作成せよ.
3
+ ARGVは引数を文字列として受け取るため,そのままでは計算には使えないことに注意.
2
4
 
5
+ * 識別子
6
+ - 変数やメソッド,クラスなどに付ける名前のこと.
3
7
 
4
- - 変数
8
+ * 変数
9
+ - オブジェクト(数値, 文字列, 配列 etc...)を保存する箱.中身を書き換えることが可能.
10
+ - 以下の変数の種類は,現時点では読まなくても良い.
11
+ ** ローカル変数
12
+ - 小文字またはアンダーバー(_)で始まる識別子.ブロック内、メソッド内などローカルなスコープで有効.
13
+ ** インスタンス変数
14
+ - アットマーク(@) で始まる識別子.インスタンスされたクラス等で,そのオブジェクトが存在する間有効.
15
+ ** クラス変数
16
+ - 2つのアットマーク(@@) で始まる識別子.同じクラスのすべてのインスタンスで共有される.
5
17
 
6
- 変数名 = オブジェクト
18
+ * 定数
19
+ - アルファベット大文字で始まる識別子.
20
+ - オブジェクト(数値, 文字列, 配列 etc...)を保存する箱.中身を書き換えることは可能であるが警告文が表示される.
7
21
 
8
-
9
- - .to_i
10
-
11
- 変数名 = オブジェクト.to_i
12
-
13
- オブジェクトの直後に記述することで、そのオブジェクトを数値に変換する。
14
- ARGVは引数を文字列として受け取るため、そのままでは計算には使えないことに注意。
22
+ * オブジェクトの変換メソッド(to_*)
23
+ - 使用方法...オブジェクト.to_* (to_*の*の部分に入る文字は以下に記す.)
24
+ - 機能...オブジェクトを他の型に変換する.
25
+ ** to_i
26
+ - to int
27
+ - 整数に変換
28
+ ** to_f
29
+ - to float
30
+ - 浮動小数点数に変換
31
+ ** to_s
32
+ - to string
33
+ - 文字列に変換
34
+ ** to_a
35
+ - to array
36
+ - 配列に変換
37
+ ** to_h
38
+ - to hash
39
+ - ハッシュに変換
@@ -0,0 +1,8 @@
1
+ # section_2/part_3/answer.rb
2
+ # 2-3-stdin.rb
3
+ def standard_input
4
+ # add your code
5
+ num = STDIN.gets.to_f
6
+ puts num
7
+ puts num * num
8
+ end
@@ -0,0 +1,57 @@
1
+ -課題-
2
+ コマンドライン以外から値を受け取って浮動小数点数に変換せよ.
3
+ さらに,受け取った値とその値の2乗をputsで表示するプログラムを作成せよ.
4
+
5
+ * 識別子
6
+ - 変数やメソッド,クラスなどに付ける名前のこと.
7
+
8
+ * 変数
9
+ - オブジェクト(数値, 文字列, 配列 etc...)を保存する箱.中身を書き換えることが可能.
10
+ - 以下の変数の種類は,現時点では読まなくても良い.
11
+ ** ローカル変数
12
+ - 小文字またはアンダーバー(_)で始まる識別子.ブロック内、メソッド内などローカルなスコープで有効.
13
+ ** インスタンス変数
14
+ - アットマーク(@) で始まる識別子.インスタンスされたクラス等で,そのオブジェクトが存在する間有効.
15
+ ** クラス変数
16
+ - 2つのアットマーク(@@) で始まる識別子.同じクラスのすべてのインスタンスで共有される.
17
+
18
+ * 定数
19
+ - アルファベット大文字で始まる識別子.
20
+ - オブジェクト(数値, 文字列, 配列 etc...)を保存する箱.中身を書き換えることは可能であるが警告文が表示される.
21
+
22
+ * オブジェクトの変換メソッド(to_*)
23
+ - 使用方法...オブジェクト.to_* (to_*の*の部分に入る文字は以下に記す.)
24
+ - 機能...オブジェクトを他の型に変換する.
25
+ ** to_i
26
+ - to int
27
+ - 整数に変換
28
+ ** to_f
29
+ - to float
30
+ - 浮動小数点数に変換
31
+ ** to_s
32
+ - to string
33
+ - 文字列に変換
34
+ ** to_a
35
+ - to array
36
+ - 配列に変換
37
+ ** to_h
38
+ - to hash
39
+ - ハッシュに変換
40
+ * 標準入力
41
+ - 標準入力とはキーボード入力のことです.
42
+ - 標準入力を行えるメソッドの紹介.
43
+ ** STDIN
44
+ - 標準入力のレシーバー
45
+ ** レシーバ
46
+ - ドット(.)の左側
47
+ ** gets
48
+ - get string の略
49
+ - 使用方法...変数 = STDIN.gets
50
+ - 機能...標準入力にキーボード入力された1行の文字列を取得する.
51
+ ** readlines
52
+ - 使用方法...変数 = STDIN.readlines
53
+ - 機能...複数行の文字列を,1行ごとの配列として取得する.入力を終了する場合はCtrl+Dを行う.
54
+ ** ARGV
55
+ - 使用方法...ARGVを書いたファイルを実行する場合に,スペースを区切りに入力文字を記入していく.
56
+ ex) ruby argv.rb a b c d
57
+ - 機能...コマンドラインから引数として与えられた文字列を格納する配列オブジェクト.
@@ -0,0 +1,5 @@
1
+ # section_2/part_3/workplace.rb
2
+ def standard_input
3
+ # add your code
4
+
5
+ end
@@ -0,0 +1,100 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = "doc"
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
@@ -0,0 +1,13 @@
1
+ require "open3"
2
+ require "#{ENV['HOME']}/.ruby_learner/workshop/lib/workplace.rb"
3
+
4
+ RSpec.describe "STDIN-check" do
5
+ it 'given 3, return "3.0\n9.0\n"' do
6
+ allow(STDIN).to receive(:gets) { 3 }
7
+ expect { standard_input() }.to output("3.0\n9.0\n").to_stdout
8
+ end
9
+ it 'given 8, return "8.0\n64.0\n"' do
10
+ allow(STDIN).to receive(:gets) { 8 }
11
+ expect { standard_input() }.to output("8.0\n64.0\n").to_stdout
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_learner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 1.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takaki Otsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-01 00:00:00.000000000 Z
11
+ date: 2018-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -189,6 +189,11 @@ files:
189
189
  - questions/sequential_check/section_2/part_2/lib/workplace.rb
190
190
  - questions/sequential_check/section_2/part_2/spec/spec_helper.rb
191
191
  - questions/sequential_check/section_2/part_2/spec/workplace_spec.rb
192
+ - questions/sequential_check/section_2/part_3/lib/answer.rb
193
+ - questions/sequential_check/section_2/part_3/lib/sentence.org
194
+ - questions/sequential_check/section_2/part_3/lib/workplace.rb
195
+ - questions/sequential_check/section_2/part_3/spec/spec_helper.rb
196
+ - questions/sequential_check/section_2/part_3/spec/workplace_spec.rb
192
197
  - questions/sequential_check/section_3/part_1/lib/answer.rb
193
198
  - questions/sequential_check/section_3/part_1/lib/sentence.org
194
199
  - questions/sequential_check/section_3/part_1/lib/workplace.rb