act_with_booleans 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +1 -3
- data/.github/workflows/rake.yml +3 -4
- data/.ruby-version +1 -1
- data/Gemfile +3 -2
- data/MIT-LICENSE +3 -1
- data/README.md +4 -3
- data/lib/act_with_booleans/version.rb +2 -1
- data/test/benchmark_test.rb +1 -1
- data/test/coding_check_add_test.rb +1 -1
- data/test/coding_coverage_test.rb +4 -1
- data/test/coding_one_test.rb +2 -2
- data/test/one_test.rb +2 -2
- metadata +3 -4
- data/.watchr +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4640236fbfd6a32e80383d4fc9d9ede303c9abdf17c50007fca2f6ffbf5f824
|
4
|
+
data.tar.gz: 123d982d723a4ea0a140d6924f1f2afd7808940c36309e0e549415a19e84a43e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '01794525018fc50a09c582f450e9f30190d567633d7ea32cd0d000df00e09ba80f962f9ba2479a0759f0864b8b1adbfe6db5ca0de57a4e728438ba2045775c5b'
|
7
|
+
data.tar.gz: fc8efd57e21adfac8ee480efb4537920ae92972ca0f7090cd159afdfc0db3e9d9c3d3039923e26906bb06a31cc8bd9283028dbae898a5fc37e639c75b0a0ca55
|
data/.github/workflows/lint.yml
CHANGED
@@ -5,12 +5,10 @@ jobs:
|
|
5
5
|
runs-on: ubuntu-latest
|
6
6
|
steps:
|
7
7
|
- name: Checkout code
|
8
|
-
uses: actions/checkout@
|
8
|
+
uses: actions/checkout@v3
|
9
9
|
- name: Set up Ruby
|
10
10
|
uses: ruby/setup-ruby@v1
|
11
11
|
with:
|
12
12
|
bundler-cache: true
|
13
13
|
- name: Run Standard
|
14
14
|
run: bundle exec standardrb
|
15
|
-
# - name: Run erb-lint
|
16
|
-
# run: bundle exec erblint --lint-all
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
|
2
2
|
name: Rake
|
3
3
|
|
4
|
-
on: push
|
4
|
+
on: [push]
|
5
5
|
|
6
6
|
jobs:
|
7
7
|
test:
|
@@ -9,13 +9,12 @@ jobs:
|
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
11
|
os: [ubuntu-latest]
|
12
|
-
|
13
|
-
ruby: [3.0.0, head]
|
12
|
+
ruby: ["2.7", "3.0", "3.2", head]
|
14
13
|
test_command: ["bundle exec rake test"]
|
15
14
|
runs-on: ${{ matrix.os }}
|
16
15
|
|
17
16
|
steps:
|
18
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v3
|
19
18
|
- uses: ruby/setup-ruby@v1
|
20
19
|
with:
|
21
20
|
ruby-version: ${{ matrix.ruby }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.
|
1
|
+
ruby-3.2.2
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -14,6 +14,7 @@ As usual:
|
|
14
14
|
# Gemfile
|
15
15
|
gem "act_with_booleans"
|
16
16
|
```
|
17
|
+
and run "bundle install".
|
17
18
|
|
18
19
|
## Examples
|
19
20
|
|
@@ -112,9 +113,9 @@ Further reading:
|
|
112
113
|
- [gem bitwise](https://github.com/kenn/bitwise)
|
113
114
|
|
114
115
|
|
115
|
-
##
|
116
|
+
## Miscellaneous
|
116
117
|
|
117
|
-
Copyright (c)
|
118
|
-
|
118
|
+
Copyright (c) 2023 Dittmar Krall (www.matiq.com),
|
119
|
+
released under the MIT license:
|
119
120
|
|
120
121
|
* https://opensource.org/licenses/MIT
|
data/test/benchmark_test.rb
CHANGED
@@ -10,10 +10,13 @@ describe "Coverage" do
|
|
10
10
|
|
11
11
|
it "coverage to_s" do
|
12
12
|
res = order.act_with_booleans.to_s
|
13
|
-
# puts res
|
14
13
|
puts res if ENV["MORE"]
|
15
14
|
end
|
16
15
|
|
16
|
+
it "coverage location raise" do
|
17
|
+
assert_raises { order.act_with_flags.location(:unknown) }
|
18
|
+
end
|
19
|
+
|
17
20
|
it "coverage position" do
|
18
21
|
assert_equal 1, order.act_with_booleans.position(:a)
|
19
22
|
assert_equal 7, Order.act_with_booleans.position(:b)
|
data/test/coding_one_test.rb
CHANGED
@@ -10,14 +10,14 @@ describe "Internal One Flag" do
|
|
10
10
|
Order.add_to_booleans bool
|
11
11
|
end
|
12
12
|
|
13
|
-
it "test order.
|
13
|
+
it "test order.act_with_" do
|
14
14
|
refute_nil admin
|
15
15
|
assert_equal admin, order.class.act_with_booleans
|
16
16
|
assert_equal admin, order.act_with_booleans
|
17
17
|
assert_equal admin, Order.act_with_booleans
|
18
18
|
end
|
19
19
|
|
20
|
-
it "checks definition of methods
|
20
|
+
it "checks definition of methods" do
|
21
21
|
msg = "method '#{bool}' not defined"
|
22
22
|
assert order.respond_to?(bool.to_s), msg
|
23
23
|
assert order.respond_to?("#{bool}?"), msg
|
data/test/one_test.rb
CHANGED
@@ -9,13 +9,13 @@ describe "One Flag" do
|
|
9
9
|
Order.add_to_booleans bool
|
10
10
|
end
|
11
11
|
|
12
|
-
it "checks
|
12
|
+
it "checks defaults" do
|
13
13
|
refute_equal true, order.blocked
|
14
14
|
assert_equal false, order.blocked
|
15
15
|
assert_equal false, order.blocked?
|
16
16
|
end
|
17
17
|
|
18
|
-
it "set
|
18
|
+
it "set :blocked" do
|
19
19
|
order.blocked = true
|
20
20
|
assert_equal true, order.blocked
|
21
21
|
assert_equal true, order.blocked?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act_with_booleans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- ".gitignore"
|
65
65
|
- ".ruby-gemset"
|
66
66
|
- ".ruby-version"
|
67
|
-
- ".watchr"
|
68
67
|
- Gemfile
|
69
68
|
- MIT-LICENSE
|
70
69
|
- README.md
|
@@ -112,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
111
|
- !ruby/object:Gem::Version
|
113
112
|
version: '0'
|
114
113
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.4.10
|
116
115
|
signing_key:
|
117
116
|
specification_version: 4
|
118
117
|
summary: Ruby gem act_with_booleans
|
data/.watchr
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
TESTING = %w[test]
|
2
|
-
HH = "#" * 22 unless defined?(HH)
|
3
|
-
H = "#" * 5 unless defined?(H)
|
4
|
-
|
5
|
-
def usage
|
6
|
-
puts <<-EOS
|
7
|
-
Ctrl-\\ or ctrl-4 Running all tests
|
8
|
-
Ctrl-C Exit
|
9
|
-
EOS
|
10
|
-
end
|
11
|
-
|
12
|
-
def run(cmd)
|
13
|
-
puts "#{HH} #{Time.now} #{HH}"
|
14
|
-
puts "#{H} #{cmd}"
|
15
|
-
system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def run_it(type, files)
|
19
|
-
files.split(" ").flatten.each do |file|
|
20
|
-
case type
|
21
|
-
when "test" then run %(bundle exec ruby -I test #{file})
|
22
|
-
# when 'spec'; run %(rspec -X #{file})
|
23
|
-
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def run_all_tests
|
29
|
-
puts "\n#{HH} Running all tests #{HH}\n"
|
30
|
-
TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_matching_files(base)
|
34
|
-
base = base.split("_").first
|
35
|
-
TESTING.each { |type|
|
36
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*.rb/ }
|
37
|
-
run_it type, files.join(" ") unless files.empty?
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
TESTING.each { |type|
|
42
|
-
watch("#{type}/#{type}_helper.rb") { run_all_tests }
|
43
|
-
watch("lib/.*.rb") { run_all_tests }
|
44
|
-
watch("#{type}/.*/*_#{type}.rb") { |match| run_it type, match[0] }
|
45
|
-
watch("#{type}/data/(.*).rb") { |match|
|
46
|
-
m1 = match[1]
|
47
|
-
run_matching_files("#{type}/#{m1}/#{m1}_#{type}.rb")
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
%w[rb erb haml slim].each { |type|
|
52
|
-
watch("app/.*/(.*).#{type}") { |match|
|
53
|
-
run_matching_files(match[1])
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
# Ctrl-\ or ctrl-4
|
58
|
-
Signal.trap("QUIT") { run_all_tests }
|
59
|
-
# Ctrl-C
|
60
|
-
Signal.trap("INT") { abort("Interrupted\n") }
|
61
|
-
usage
|