回答編集履歴

1

ちゃんとかいた

2016/11/30 23:05

投稿

hana-da
hana-da

スコア1728

test CHANGED
@@ -4,11 +4,13 @@
4
4
 
5
5
  ```ruby
6
6
 
7
+ # frozen_string_literal: true
8
+
7
- require 'optprase'
9
+ require 'optparse'
8
10
 
9
11
 
10
12
 
11
- describe 'ARGV' do
13
+ RSpec.describe "ARGV.getopts('ab')" do
12
14
 
13
15
  subject { ARGV.getopts('ab') }
14
16
 
@@ -24,8 +26,32 @@
24
26
 
25
27
 
26
28
 
27
- it { is_expected.to eq {"a"=>true, "b"=>true} }
29
+ it { is_expected.to eq('a' => true, 'b' => true) }
28
30
 
29
31
  end
30
32
 
31
33
  ```
34
+
35
+
36
+
37
+ ```
38
+
39
+ $ rspec spec/argv_spec.rb
40
+
41
+
42
+
43
+ Randomized with seed 53536
44
+
45
+
46
+
47
+ ARGV.getopts('ab')
48
+
49
+ should eq {"a"=>true, "b"=>true}
50
+
51
+
52
+
53
+ Finished in 0.00413 seconds (files took 0.79551 seconds to load)
54
+
55
+ 1 example, 0 failures
56
+
57
+ ```