meszaros 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/meszaros.rb +1 -0
- data/lib/meszaros/version.rb +1 -1
- data/spec/meszaros/loop_spec.rb +25 -25
- metadata +1 -1
data/lib/meszaros.rb
CHANGED
data/lib/meszaros/version.rb
CHANGED
data/spec/meszaros/loop_spec.rb
CHANGED
@@ -4,33 +4,33 @@ require 'meszaros/loop'
|
|
4
4
|
module Meszaros
|
5
5
|
describe Loop do
|
6
6
|
it "should allow data driven spec : 0" do
|
7
|
-
|
7
|
+
result = []
|
8
8
|
Loop.data_driven_spec([]) do |element|
|
9
|
-
|
9
|
+
result << element
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
result.should be_empty
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should allow data driven spec : 1" do
|
16
|
-
|
16
|
+
result = []
|
17
17
|
Loop.data_driven_spec([4]) do |element|
|
18
|
-
|
18
|
+
result << element
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
result.should == [4]
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should allow data driven spec : n" do
|
25
|
-
|
25
|
+
result = []
|
26
26
|
Loop.data_driven_spec([1,2,3,4]) do |element|
|
27
|
-
|
27
|
+
result << element
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
result.should == [1,2,3,4]
|
31
31
|
end
|
32
32
|
|
33
|
-
it "should raise
|
33
|
+
it "should raise eresultception when nil is passed as the parameter to data driven spec" do
|
34
34
|
expect do
|
35
35
|
Loop.data_driven_spec(nil) do |element|
|
36
36
|
true.should be_true
|
@@ -39,27 +39,27 @@ module Meszaros
|
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
|
-
it "should allow
|
43
|
-
|
42
|
+
it "should allow eresultecution of a chunk of code for 0 number of times" do
|
43
|
+
result = 0
|
44
44
|
|
45
45
|
Loop.repeat(0) do
|
46
|
-
|
46
|
+
result += 1
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
result.should == 0
|
50
50
|
end
|
51
51
|
|
52
|
-
it "should allow
|
53
|
-
|
52
|
+
it "should allow eresultecution of a chunk of code for 1 number of times" do
|
53
|
+
result = 0
|
54
54
|
|
55
55
|
Loop.repeat(1) do
|
56
|
-
|
56
|
+
result += 1
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
result.should == 1
|
60
60
|
end
|
61
61
|
|
62
|
-
it "should raise
|
62
|
+
it "should raise eresultception when nil is passed for the parameter to repeat" do
|
63
63
|
expect do
|
64
64
|
Loop.repeat(nil) do
|
65
65
|
true.should be_true
|
@@ -68,7 +68,7 @@ module Meszaros
|
|
68
68
|
|
69
69
|
end
|
70
70
|
|
71
|
-
it "should raise
|
71
|
+
it "should raise eresultception when string is passed for the parameter to repeat" do
|
72
72
|
expect do
|
73
73
|
Loop.repeat("dumb") do
|
74
74
|
true.should be_true
|
@@ -76,7 +76,7 @@ module Meszaros
|
|
76
76
|
end.to raise_error
|
77
77
|
end
|
78
78
|
|
79
|
-
it "should raise
|
79
|
+
it "should raise eresultception when float is passed for the parameter to repeat" do
|
80
80
|
expect do
|
81
81
|
Loop.repeat(2.2) do
|
82
82
|
true.should be_true
|
@@ -84,14 +84,14 @@ module Meszaros
|
|
84
84
|
end.to raise_error
|
85
85
|
end
|
86
86
|
|
87
|
-
it "should allow
|
88
|
-
|
87
|
+
it "should allow eresultecution of a chunk of code for n number of times" do
|
88
|
+
result = 0
|
89
89
|
|
90
90
|
Loop.repeat(3) do
|
91
|
-
|
91
|
+
result += 1
|
92
92
|
end
|
93
93
|
|
94
|
-
|
94
|
+
result.should == 3
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|