codeless_code 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/codeless_code.gemspec +5 -2
- data/lib/codeless_code/filters/header_integer.rb +1 -1
- data/test/codeless_code/filters/test_builders.rb +32 -0
- data/test/codeless_code/filters/test_header_integer.rb +82 -0
- data/test/codeless_code/filters/test_header_string.rb +82 -0
- data/test/codeless_code/test_catalog.rb +1 -3
- data/test/helper.rb +6 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead759abc57cf4ba37d82e2837ebedb3b8375859b4146513e7cc2e53dbe24868
|
4
|
+
data.tar.gz: 1c528ddfca911727e94e8786c69f16f296dce0dc6ec1972772a41b4f195fc22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0136a3d0368a69d20fe44d0541ddfe42d54315985dc978ad175314f3f51854635999ae8bdbc11ce7f2cbdd9992eefc4458d9359175e508bfd399512147f68d3
|
7
|
+
data.tar.gz: 66c643b815b4a49626eaa57c01682af7f8ed0f8d9a746084691fed9acfda0203a24e4b8191ca0d8ec683403b9834483c96487728ef1a8ac2a8a9ea6cb751643b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/codeless_code.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: codeless_code 0.1.
|
5
|
+
# stub: codeless_code 0.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "codeless_code".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
@@ -1501,6 +1501,9 @@ Gem::Specification.new do |s|
|
|
1501
1501
|
"lib/codeless_code/options.rb",
|
1502
1502
|
"lib/codeless_code/renderers/fable.rb",
|
1503
1503
|
"lib/codeless_code/renderers/term_page.rb",
|
1504
|
+
"test/codeless_code/filters/test_builders.rb",
|
1505
|
+
"test/codeless_code/filters/test_header_integer.rb",
|
1506
|
+
"test/codeless_code/filters/test_header_string.rb",
|
1504
1507
|
"test/codeless_code/test_catalog.rb",
|
1505
1508
|
"test/codeless_code/test_fable.rb",
|
1506
1509
|
"test/codeless_code/test_fable_set.rb",
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# codeless_code filters and prints fables from http://thecodelesscode.com
|
2
|
+
# Copyright (C) 2018 Jon Sangster
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU General Public License as published by the Free Software
|
6
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
7
|
+
# version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
12
|
+
# details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License along with
|
15
|
+
# this program. If not, see <https://www.gnu.org/licenses/>.
|
16
|
+
require 'helper'
|
17
|
+
|
18
|
+
module Filters
|
19
|
+
class TestBuilders < UnitTest
|
20
|
+
def test_header_integer_filter
|
21
|
+
assert_kind_of Class, Filters::Builders.header_integer_filter('FooOne')
|
22
|
+
assert_kind_of Filters::HeaderInteger,
|
23
|
+
Filters::Builders.header_integer_filter('FooTwo').new
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_header_string_filter
|
27
|
+
assert_kind_of Class, Filters::Builders.header_string_filter('BarOne')
|
28
|
+
assert_kind_of Filters::HeaderString,
|
29
|
+
Filters::Builders.header_string_filter('BarTwo').new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# codeless_code filters and prints fables from http://thecodelesscode.com
|
2
|
+
# Copyright (C) 2018 Jon Sangster
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU General Public License as published by the Free Software
|
6
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
7
|
+
# version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
12
|
+
# details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License along with
|
15
|
+
# this program. If not, see <https://www.gnu.org/licenses/>.
|
16
|
+
require 'helper'
|
17
|
+
|
18
|
+
module Filters
|
19
|
+
class TestHeaderInteger < UnitTest
|
20
|
+
def test_enabled?
|
21
|
+
refute_predicate filter('Test'), :enabled?
|
22
|
+
refute_predicate filter('Test', exclude: false), :enabled?
|
23
|
+
|
24
|
+
assert_predicate filter('Test', exact: 1), :enabled?
|
25
|
+
assert_predicate filter('Test', min: 1), :enabled?
|
26
|
+
assert_predicate filter('Test', max: 1), :enabled?
|
27
|
+
assert_predicate filter('Test', exclude: true), :enabled?
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_call_exact
|
31
|
+
assert_filter(exact: 100)
|
32
|
+
|
33
|
+
refute_filter(exact: 123)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_call_min
|
37
|
+
assert_filter(min: 99)
|
38
|
+
assert_filter(min: 100)
|
39
|
+
|
40
|
+
refute_filter(min: 101)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_call_max
|
44
|
+
assert_filter(max: 100)
|
45
|
+
assert_filter(max: 101)
|
46
|
+
|
47
|
+
refute_filter(max: 99)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_call_exclude
|
51
|
+
assert_filter('MissingHeader', exclude: true)
|
52
|
+
|
53
|
+
refute_filter(exclude: true)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def filter(key, **opts)
|
59
|
+
Filters::HeaderInteger.new(key, **opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
def assert_filter(key = 'Test', **opts)
|
63
|
+
fab = Fable.new(test_io)
|
64
|
+
filt = filter(key, **opts)
|
65
|
+
assert filt.call(fab), format('Expected %p to match %p', opts, fab)
|
66
|
+
end
|
67
|
+
|
68
|
+
def refute_filter(key = 'Test', **opts)
|
69
|
+
fab = Fable.new(test_io)
|
70
|
+
filt = filter(key, **opts)
|
71
|
+
refute filt.call(fab), format('Expected %p not to match %p', opts, fab)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_io
|
75
|
+
mock_filter(<<-BODY.strip)
|
76
|
+
Test: 100
|
77
|
+
|
78
|
+
body
|
79
|
+
BODY
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# codeless_code filters and prints fables from http://thecodelesscode.com
|
2
|
+
# Copyright (C) 2018 Jon Sangster
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify it under
|
5
|
+
# the terms of the GNU General Public License as published by the Free Software
|
6
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
7
|
+
# version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
12
|
+
# details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License along with
|
15
|
+
# this program. If not, see <https://www.gnu.org/licenses/>.
|
16
|
+
require 'helper'
|
17
|
+
|
18
|
+
module Filters
|
19
|
+
class TestHeaderString < UnitTest
|
20
|
+
def test_enabled?
|
21
|
+
refute_predicate filter('Test'), :enabled?
|
22
|
+
refute_predicate filter('Test', exclude: false), :enabled?
|
23
|
+
|
24
|
+
assert_predicate filter('Test', exact: 'foo'), :enabled?
|
25
|
+
assert_predicate filter('Test', start_with: 'foo'), :enabled?
|
26
|
+
assert_predicate filter('Test', end_with: 'foo'), :enabled?
|
27
|
+
assert_predicate filter('Test', exclude: true), :enabled?
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_call_exact
|
31
|
+
assert_filter(exact: 'some text')
|
32
|
+
|
33
|
+
refute_filter(exact: 'something else')
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_call_start_with
|
37
|
+
assert_filter(start_with: 'some')
|
38
|
+
assert_filter(start_with: '')
|
39
|
+
|
40
|
+
refute_filter(start_with: 'something else')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_call_end_with
|
44
|
+
assert_filter(end_with: 'text')
|
45
|
+
assert_filter(end_with: '')
|
46
|
+
|
47
|
+
refute_filter(end_with: 'something else')
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_call_exclude
|
51
|
+
assert_filter('MissingHeader', exclude: true)
|
52
|
+
|
53
|
+
refute_filter(exclude: true)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def filter(key, **opts)
|
59
|
+
Filters::HeaderString.new(key, **opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
def assert_filter(key = 'Test', **opts)
|
63
|
+
fab = Fable.new(test_io)
|
64
|
+
filt = filter(key, **opts)
|
65
|
+
assert filt.call(fab), format('Expected %p to match %p', opts, fab)
|
66
|
+
end
|
67
|
+
|
68
|
+
def refute_filter(key = 'Test', **opts)
|
69
|
+
fab = Fable.new(test_io)
|
70
|
+
filt = filter(key, **opts)
|
71
|
+
refute filt.call(fab), format('Expected %p not to match %p', opts, fab)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_io
|
75
|
+
mock_filter(<<-BODY.strip)
|
76
|
+
Test: some text
|
77
|
+
|
78
|
+
body
|
79
|
+
BODY
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -19,9 +19,7 @@ class TestCatalog < UnitTest
|
|
19
19
|
def test_languages
|
20
20
|
assert_kind_of Enumerable, catalog.languages
|
21
21
|
|
22
|
-
catalog.languages.each
|
23
|
-
assert_kind_of Symbol, lang
|
24
|
-
end
|
22
|
+
catalog.languages.each { |lang| assert_kind_of Symbol, lang }
|
25
23
|
end
|
26
24
|
|
27
25
|
def test_fetch
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeless_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Sangster
|
@@ -1727,6 +1727,9 @@ files:
|
|
1727
1727
|
- lib/codeless_code/options.rb
|
1728
1728
|
- lib/codeless_code/renderers/fable.rb
|
1729
1729
|
- lib/codeless_code/renderers/term_page.rb
|
1730
|
+
- test/codeless_code/filters/test_builders.rb
|
1731
|
+
- test/codeless_code/filters/test_header_integer.rb
|
1732
|
+
- test/codeless_code/filters/test_header_string.rb
|
1730
1733
|
- test/codeless_code/test_catalog.rb
|
1731
1734
|
- test/codeless_code/test_fable.rb
|
1732
1735
|
- test/codeless_code/test_fable_set.rb
|