speckle 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +22 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +230 -0
- data/bin/speckle +12 -0
- data/lib/dsl.riml +29 -0
- data/lib/expectation.riml +34 -0
- data/lib/matchers/above_matcher.riml +13 -0
- data/lib/matchers/atleast_matcher.riml +13 -0
- data/lib/matchers/atmost_matcher.riml +13 -0
- data/lib/matchers/below_matcher.riml +13 -0
- data/lib/matchers/between_matcher.riml +19 -0
- data/lib/matchers/boolean_matcher.riml +13 -0
- data/lib/matchers/dict_key_matcher.riml +14 -0
- data/lib/matchers/equality_matcher.riml +13 -0
- data/lib/matchers/existance_matcher.riml +13 -0
- data/lib/matchers/length_matcher.riml +14 -0
- data/lib/matchers/match_item.riml +8 -0
- data/lib/matchers/match_tester.riml +33 -0
- data/lib/matchers/matchers.riml +72 -0
- data/lib/matchers/regexp_matcher.riml +14 -0
- data/lib/matchers/within_matcher.riml +28 -0
- data/lib/reporters/base_reporter.riml +126 -0
- data/lib/reporters/dotmatrix_reporter.riml +47 -0
- data/lib/reporters/min_reporter.riml +13 -0
- data/lib/reporters/reporter_factory.riml +15 -0
- data/lib/reporters/spec_reporter.riml +58 -0
- data/lib/reporters/tap_reporter.riml +38 -0
- data/lib/runners/runner.riml +49 -0
- data/lib/runners/spec_runner.riml +96 -0
- data/lib/speckle/cli/app.rb +18 -0
- data/lib/speckle/cli/controller.rb +67 -0
- data/lib/speckle/cli/environment.rb +148 -0
- data/lib/speckle/cli/rake_app.rb +146 -0
- data/lib/speckle/cli/router.rb +16 -0
- data/lib/speckle/loader.rb +10 -0
- data/lib/speckle/version.rb +3 -0
- data/lib/speckle.rb +4 -0
- data/lib/speckle.riml +148 -0
- data/lib/utils/spec_meta.riml +30 -0
- data/lib/utils/spec_timer.riml +30 -0
- data/lib/utils/statistician.riml +70 -0
- data/lib/writers/buffer_writer.riml +37 -0
- data/lib/writers/console_writer.riml +28 -0
- data/lib/writers/file_writer.riml +31 -0
- data/lib/writers/writer_factory.riml +13 -0
- data/spec/after_hooks_spec.riml +58 -0
- data/spec/before_hooks_spec.riml +38 -0
- data/spec/matchers/above_matcher_spec.riml +27 -0
- data/spec/matchers/atleast_matcher_spec.riml +28 -0
- data/spec/matchers/atmost_matcher_spec.riml +29 -0
- data/spec/matchers/below_matcher_spec.riml +28 -0
- data/spec/matchers/between_matcher_spec.riml +17 -0
- data/spec/matchers/boolean_matcher_spec.riml +27 -0
- data/spec/matchers/custom_matcher_spec.riml +47 -0
- data/spec/matchers/dict_key_matcher_spec.riml +19 -0
- data/spec/matchers/equality_matcher_spec.riml +31 -0
- data/spec/matchers/existance_matcher_spec.riml +17 -0
- data/spec/matchers/length_matcher_spec.riml +18 -0
- data/spec/matchers/regexp_matcher_spec.riml +31 -0
- data/spec/matchers/within_matcher_spec.riml +18 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/speckle/cli/environment_spec.rb +296 -0
- data/speckle.gemspec +30 -0
- metadata +210 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
class WriterFactory
|
2
|
+
defm get_writer(writer_name)
|
3
|
+
if a:writer_name == 'file'
|
4
|
+
return new FileWriter()
|
5
|
+
elseif a:writer_name == 'console'
|
6
|
+
return new ConsoleWriter()
|
7
|
+
elseif a:writer_name == 'buffer'
|
8
|
+
return new BufferWriter()
|
9
|
+
else
|
10
|
+
return new BufferWriter()
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class AfterHookSpec
|
4
|
+
defm describe
|
5
|
+
return 'After hooks'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm before
|
9
|
+
self.stuff = 'foo'
|
10
|
+
end
|
11
|
+
|
12
|
+
defm it_adds_more_stuff
|
13
|
+
self.more_stuff = 'bar'
|
14
|
+
expect(self.stuff).to_equal('foo')
|
15
|
+
end
|
16
|
+
|
17
|
+
defm after
|
18
|
+
unless self.stuff == 'foo'
|
19
|
+
throw 'before hook not called'
|
20
|
+
end
|
21
|
+
unless self.more_stuff == 'bar'
|
22
|
+
throw 'after called before test'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class AfterEachHookSpec
|
28
|
+
defm describe
|
29
|
+
return 'After_each hooks'
|
30
|
+
end
|
31
|
+
|
32
|
+
defm before
|
33
|
+
self.stuff = 'foo'
|
34
|
+
end
|
35
|
+
|
36
|
+
defm it_adds_some_more_stuff
|
37
|
+
self.more_stuff = 'bar'
|
38
|
+
expect(self.stuff).to_equal('foo')
|
39
|
+
end
|
40
|
+
|
41
|
+
defm after_each
|
42
|
+
unless self.stuff == 'foo'
|
43
|
+
throw 'before hook not called'
|
44
|
+
end
|
45
|
+
unless self.more_stuff == 'bar'
|
46
|
+
throw 'after called before test'
|
47
|
+
end
|
48
|
+
|
49
|
+
self.even_more_stuff = 'foobar'
|
50
|
+
end
|
51
|
+
|
52
|
+
defm after
|
53
|
+
unless self.even_more_stuff == 'foobar'
|
54
|
+
throw 'after_each called before after'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class BeforeHookSpec
|
4
|
+
defm describe
|
5
|
+
return 'Before hooks'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm before
|
9
|
+
self.stuff = 'foo'
|
10
|
+
end
|
11
|
+
|
12
|
+
defm it_has_stuff_from_before
|
13
|
+
expect(self.stuff).to_equal('foo')
|
14
|
+
end
|
15
|
+
|
16
|
+
defm it_still_has_stuff_from_before
|
17
|
+
expect(self.stuff).to_equal('foo')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class BeforeEachHookSpec
|
22
|
+
defm describe
|
23
|
+
return 'Before_each hooks'
|
24
|
+
end
|
25
|
+
|
26
|
+
defm before_each
|
27
|
+
self.stuff = 'foo'
|
28
|
+
end
|
29
|
+
|
30
|
+
defm it_has_stuff_from_before_each
|
31
|
+
expect(self.stuff).to_equal('foo')
|
32
|
+
end
|
33
|
+
|
34
|
+
defm it_still_has_stuff_from_before_each
|
35
|
+
expect(self.stuff).to_equal('foo')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class AboveMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'AboveMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_upper_bounds
|
9
|
+
expect(10).to_be_above(1)
|
10
|
+
expect(20).to_be_above(10)
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_negation_of_upper_bounds
|
14
|
+
expect(10).to_not_be_above(20)
|
15
|
+
expect(10).to_not_be_above(10)
|
16
|
+
end
|
17
|
+
|
18
|
+
defm it_can_check_for_upper_bounds_with_alias_gt
|
19
|
+
expect(10).to_be_gt(1)
|
20
|
+
expect(20).to_be_gt(10)
|
21
|
+
end
|
22
|
+
|
23
|
+
defm it_can_check_for_negation_of_upper_bounds_with_alias_gt
|
24
|
+
expect(10).to_not_be_gt(20)
|
25
|
+
expect(10).to_not_be_gt(10)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class AtleastMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'AtleastMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_least
|
9
|
+
expect(5).to_be_at_least(5)
|
10
|
+
expect(10).to_be_at_least(6)
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_negation_of_least
|
14
|
+
expect(5).to_not_be_at_least(6)
|
15
|
+
expect(10).to_not_be_at_least(11)
|
16
|
+
end
|
17
|
+
|
18
|
+
defm it_can_check_for_least_with_gte_alias
|
19
|
+
expect(5).to_be_gte(5)
|
20
|
+
expect(10).to_be_gte(6)
|
21
|
+
end
|
22
|
+
|
23
|
+
defm it_can_check_for_negation_of_least_with_gte_alias
|
24
|
+
expect(5).to_not_be_gte(6)
|
25
|
+
expect(10).to_not_be_gte(11)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class AtmostMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'AtmostMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_most
|
9
|
+
expect(5).to_be_at_most(5)
|
10
|
+
expect(5).to_be_at_most(6)
|
11
|
+
expect(6).to_be_at_most(10)
|
12
|
+
end
|
13
|
+
|
14
|
+
defm it_can_check_for_negation_of_most
|
15
|
+
expect(6).to_not_be_at_most(5)
|
16
|
+
expect(11).to_not_be_at_most(10)
|
17
|
+
end
|
18
|
+
|
19
|
+
defm it_can_check_for_most_with_alias_lte
|
20
|
+
expect(5).to_be_lte(5)
|
21
|
+
expect(5).to_be_lte(6)
|
22
|
+
expect(6).to_be_lte(10)
|
23
|
+
end
|
24
|
+
|
25
|
+
defm it_can_check_for_negation_of_most_with_alias_lte
|
26
|
+
expect(6).to_not_be_lte(5)
|
27
|
+
expect(11).to_not_be_lte(10)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class BelowMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'BelowMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_lower_bounds
|
9
|
+
expect(10).to_be_below(20)
|
10
|
+
expect(10).to_be_below(25)
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_negation_of_below
|
14
|
+
expect(10).to_not_be_below(1)
|
15
|
+
expect(10).to_not_be_below(10)
|
16
|
+
end
|
17
|
+
|
18
|
+
defm it_can_check_for_lower_bounds_with_lt_alias
|
19
|
+
expect(10).to_be_lt(20)
|
20
|
+
expect(10).to_be_lt(25)
|
21
|
+
end
|
22
|
+
|
23
|
+
defm it_can_check_for_negation_of_below_with_lt_alias
|
24
|
+
expect(10).to_not_be_lt(1)
|
25
|
+
expect(10).to_not_be_lt(10)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class BetweenMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'BetweenMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_value_between_bounds
|
9
|
+
expect(10).to_be_between([1, 100])
|
10
|
+
expect(10).to_be_between([1, 10])
|
11
|
+
expect(1).to_be_between([1, 10])
|
12
|
+
end
|
13
|
+
|
14
|
+
defm it_can_check_for_value_outside_bounds
|
15
|
+
expect(10).to_not_be_between([20, 30])
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class BooleanMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'BooleanMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_truthy
|
9
|
+
expect(true).to_be_true()
|
10
|
+
expect(1).to_be_true()
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_truthy_with_ok
|
14
|
+
expect(true).to_be_ok()
|
15
|
+
expect(1).to_be_ok()
|
16
|
+
end
|
17
|
+
|
18
|
+
defm it_can_check_for_falsy
|
19
|
+
expect(false).to_be_false()
|
20
|
+
expect(0).to_be_false()
|
21
|
+
end
|
22
|
+
|
23
|
+
defm it_can_check_for_falsy_with_not_ok
|
24
|
+
expect(false).to_not_be_ok()
|
25
|
+
expect(0).to_not_be_ok()
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class Person
|
4
|
+
def initialize(name)
|
5
|
+
self.name = name
|
6
|
+
end
|
7
|
+
|
8
|
+
defm get_name()
|
9
|
+
return self.name
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class PersonNameMatcher
|
14
|
+
defm match(expected, actual)
|
15
|
+
self.result = actual.get_name()
|
16
|
+
return self.result == expected
|
17
|
+
end
|
18
|
+
|
19
|
+
defm failure_message_for_match(expected, actual)
|
20
|
+
return "expected person name to be “#{expected}” but was “#{self.result}”"
|
21
|
+
end
|
22
|
+
|
23
|
+
defm failure_message_for_mismatch(expected, actual)
|
24
|
+
return "expected person name to not be “#{expected}” but was “#{self.result}”"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
matcher = new PersonNameMatcher()
|
29
|
+
define_matcher('to_have_name', 'to_not_have_name', matcher)
|
30
|
+
|
31
|
+
class PersonNameMatcherSpec
|
32
|
+
defm describe
|
33
|
+
return 'Custom matcher to_have_name and to_not_have_name'
|
34
|
+
end
|
35
|
+
|
36
|
+
defm before_each
|
37
|
+
self.person = new Person('john')
|
38
|
+
end
|
39
|
+
|
40
|
+
defm it_can_check_for_persons_name
|
41
|
+
expect(self.person).to_have_name('john')
|
42
|
+
end
|
43
|
+
|
44
|
+
defm it_can_check_for_negation_of_persons_name
|
45
|
+
expect(self.person).to_not_have_name('foo')
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class DictKeyMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'DictKeyMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_presence_of_key
|
9
|
+
box = {}
|
10
|
+
box.red = 'yes'
|
11
|
+
|
12
|
+
expect(box).to_have_key('red')
|
13
|
+
end
|
14
|
+
|
15
|
+
defm it_can_check_for_absence_of_key
|
16
|
+
box = {}
|
17
|
+
expect(box).to_not_have_key('red')
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class EqualityMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return "EqualityMatcher"
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_equality_of_strings
|
9
|
+
expect('foo').to_equal('foo')
|
10
|
+
end
|
11
|
+
|
12
|
+
defm it_can_check_inequality_of_strings
|
13
|
+
expect('foo').to_not_equal('bar')
|
14
|
+
end
|
15
|
+
|
16
|
+
defm it_can_check_equality_of_numbers
|
17
|
+
expect(1).to_equal(1)
|
18
|
+
end
|
19
|
+
|
20
|
+
defm it_can_check_inequality_of_numbers
|
21
|
+
expect(1).to_not_equal(2)
|
22
|
+
end
|
23
|
+
|
24
|
+
defm it_can_check_equality_with_alias_eq
|
25
|
+
expect('foo').to_eq('foo')
|
26
|
+
end
|
27
|
+
|
28
|
+
defm it_can_check_inequality_with_alias_neq
|
29
|
+
expect('foo').to_neq('bar')
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class ExistanceMatcherSpec
|
4
|
+
|
5
|
+
defm describe
|
6
|
+
return 'ExistanceMatcher'
|
7
|
+
end
|
8
|
+
|
9
|
+
defm it_can_check_for_presence_of_global_variable
|
10
|
+
g:existance_matcher_global_var = 1
|
11
|
+
expect('g:existance_matcher_global_var').to_exist()
|
12
|
+
end
|
13
|
+
|
14
|
+
defm it_can_check_for_absence_of_global_variable
|
15
|
+
expect('g:undefined_existance_matcher_global_var').to_not_exist()
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class LengthMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'LengthMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_length_of_string
|
9
|
+
expect("foo").to_have_length(3)
|
10
|
+
expect("foo").to_not_have_length(4)
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_length_of_list
|
14
|
+
expect([1, 2, 3]).to_have_length(3)
|
15
|
+
expect([1, 2, 3]).to_not_have_length(4)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class RegExpMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'RegExpMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_match_string_patterns
|
9
|
+
expect('lorem').to_match("ore")
|
10
|
+
expect('lorem').to_not_match('foo')
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_match_regex_patterns
|
14
|
+
expect('lorem').to_match("^l")
|
15
|
+
expect('lorem').to_match("m$")
|
16
|
+
|
17
|
+
expect('lorem').to_not_match("^r")
|
18
|
+
expect('lorem').to_not_match("a$")
|
19
|
+
end
|
20
|
+
|
21
|
+
defm it_can_match_strings
|
22
|
+
expect('lorem').to_have_string('ore')
|
23
|
+
expect('lorem').to_not_have_string('ipsum')
|
24
|
+
end
|
25
|
+
|
26
|
+
defm it_can_match_complex_patterns
|
27
|
+
expect('Four0Five').to_match('^\w\+[0-9]\w\+$')
|
28
|
+
expect('0Four0').to_not_match('^\w\+[0-9]\w\+$')
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
riml_include 'dsl.riml'
|
2
|
+
|
3
|
+
class WithinMatcherSpec
|
4
|
+
defm describe
|
5
|
+
return 'WithinMatcher'
|
6
|
+
end
|
7
|
+
|
8
|
+
defm it_can_check_for_floats_within_delta
|
9
|
+
expect(5).to_be_within([0.2, 5.1])
|
10
|
+
expect(5.005).to_be_within([0.01, 5.006])
|
11
|
+
end
|
12
|
+
|
13
|
+
defm it_can_check_for_floats_outside_delta
|
14
|
+
expect(5).to_not_be_within([0.02, 5.1])
|
15
|
+
expect(5.005).to_not_be_within([0.0001, 5.006])
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/speckle/loader')
|