mimoco 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -6
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/MIT-LICENSE +3 -1
- data/README.md +17 -7
- data/lib/mimoco/version.rb +6 -5
- data/lib/mimoco.rb +2 -2
- data/mimoco.gemspec +2 -3
- data/test/controllers/controllers_test.rb +1 -0
- metadata +5 -6
- data/.watchr +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d005db7d29601313d32a107b3e0f4c5c2a97cf57458208c48f3647b8504310f
|
4
|
+
data.tar.gz: 6e2eadc55c6d207ca53b5dfc1208093ca5099c731fcf8ccbaca700a6d4736cac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb42f23837494c9c0811b94d95304d01364394d396de5e58338b5aa1025fdfbacb8bdddfc71398612e641ebc2f5d41bded49ac578cff36eb7afecf26476932b1
|
7
|
+
data.tar.gz: 41eb22c914323da8eb91b72111c0bccad4a8c7f1f86ce1ba399c8ddf3656e8219631a25a34e19788fb12973265cfd352496366b44d631c4b74f3cc85f668a556
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
|
2
2
|
name: Rake
|
3
3
|
|
4
|
-
#on: [push, pull_request]
|
5
4
|
on: [push]
|
6
5
|
|
7
6
|
jobs:
|
@@ -9,16 +8,13 @@ jobs:
|
|
9
8
|
strategy:
|
10
9
|
fail-fast: false
|
11
10
|
matrix:
|
12
|
-
# os: [ubuntu-latest, macos-latest]
|
13
11
|
os: [ubuntu-latest]
|
14
|
-
|
15
|
-
# ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
|
16
|
-
ruby: ["2.7.2", "3.0.1", 3.1.0]
|
12
|
+
ruby: ["2.7", "3.0", "3.2", head]
|
17
13
|
test_command: ["bundle exec rake test"]
|
18
14
|
runs-on: ${{ matrix.os }}
|
19
15
|
|
20
16
|
steps:
|
21
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v3
|
22
18
|
- uses: ruby/setup-ruby@v1
|
23
19
|
with:
|
24
20
|
ruby-version: ${{ matrix.ruby }}
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.
|
1
|
+
ruby-3.2.2
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021-2023 Dittmar Krall (www.matiq.com)
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# MiMoCo
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/mimoco.png)](http://badge.fury.io/rb/mimoco)
|
4
4
|
|
5
5
|
Mimoco (MInitest MOdels COntrollers) DRY
|
6
6
|
your tests by specifying some (trivial) of them via a table.
|
@@ -12,15 +12,16 @@ to detect code changes which often went unseen.
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
As usual:
|
16
|
+
```ruby
|
16
17
|
# Gemfile
|
17
18
|
gem "mimoco"
|
18
|
-
|
19
|
+
```
|
19
20
|
and run "bundle install".
|
20
21
|
|
21
22
|
## Usage for Models
|
22
23
|
|
23
|
-
|
24
|
+
```ruby
|
24
25
|
require "test_helper"
|
25
26
|
require "mimoco"
|
26
27
|
|
@@ -41,7 +42,7 @@ class ModelsTest < Minitest::Test
|
|
41
42
|
check_models models
|
42
43
|
end
|
43
44
|
end
|
44
|
-
|
45
|
+
```
|
45
46
|
|
46
47
|
Furthermore, "valids" and "invalids" accepts an array
|
47
48
|
of hashes to create models to be checked.
|
@@ -51,7 +52,7 @@ to instantiated a model used to applicate the methods.
|
|
51
52
|
|
52
53
|
## Usage for Controllers
|
53
54
|
|
54
|
-
|
55
|
+
```ruby
|
55
56
|
require "test_helper"
|
56
57
|
require "mimoco"
|
57
58
|
|
@@ -64,8 +65,17 @@ class ControllersTest < ActionDispatch::IntegrationTest
|
|
64
65
|
call_class_methods: %i[class_method],
|
65
66
|
public_methods: %i[create destroy edit index new show update]
|
66
67
|
}
|
68
|
+
ArticlesController => ...
|
67
69
|
}
|
70
|
+
|
68
71
|
check_controllers controllers
|
69
72
|
end
|
70
73
|
end
|
71
|
-
|
74
|
+
```
|
75
|
+
|
76
|
+
## Miscellaneous
|
77
|
+
|
78
|
+
Copyright (c) 2022-2023 Dittmar Krall (www.matiq.com),
|
79
|
+
released under the MIT license:
|
80
|
+
|
81
|
+
* https://opensource.org/licenses/MIT
|
data/lib/mimoco/version.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# rubocop: disable all
|
3
2
|
|
4
3
|
module Mimoco
|
5
|
-
VERSION = "0.3.
|
6
|
-
# VERSION = "0.
|
7
|
-
# VERSION = "0.
|
8
|
-
# VERSION = "0.0
|
4
|
+
VERSION = "0.3.2" # 2023-04-25
|
5
|
+
# VERSION = "0.3.1" # 2022-12-25
|
6
|
+
# VERSION = "0.3.0" # 2022-02-11
|
7
|
+
# VERSION = "0.2.0" # 2022-01-06
|
8
|
+
# VERSION = "0.1.0" # 2022-01-03
|
9
|
+
# VERSION = "0.0.1" # 2021-12-29
|
9
10
|
end
|
data/lib/mimoco.rb
CHANGED
@@ -76,8 +76,8 @@ module Minitest
|
|
76
76
|
|
77
77
|
def self.public_methods(expected)
|
78
78
|
cls = @klass.public_instance_methods(false).sort
|
79
|
-
cls
|
80
|
-
|
79
|
+
cls.delete_if { |x| /.*_associated_records_.*/ =~ x }
|
80
|
+
# validate_associated_records_for_projects]
|
81
81
|
check_equal expected, cls
|
82
82
|
end
|
83
83
|
|
data/mimoco.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.summary = "Mimoco: some minitests for models and controllers"
|
10
10
|
s.description = "Some testing for models and controllers"
|
11
11
|
s.authors = ["Dittmar Krall"]
|
12
|
-
s.email = ["dittmar.krall@
|
13
|
-
s.homepage = "http://
|
12
|
+
s.email = ["dittmar.krall@matiq.com"]
|
13
|
+
s.homepage = "http://matiq.com"
|
14
14
|
s.license = "MIT"
|
15
15
|
|
16
16
|
s.metadata["source_code_uri"] = "https://github.com/matique/mimoco"
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_development_dependency "combustion"
|
22
|
-
|
23
22
|
s.add_development_dependency "minitest"
|
24
23
|
s.add_development_dependency "sqlite3"
|
25
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mimoco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: combustion
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
description: Some testing for models and controllers
|
56
56
|
email:
|
57
|
-
- dittmar.krall@
|
57
|
+
- dittmar.krall@matiq.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".ruby-gemset"
|
65
65
|
- ".ruby-version"
|
66
|
-
- ".watchr"
|
67
66
|
- Gemfile
|
68
67
|
- MIT-LICENSE
|
69
68
|
- README.md
|
@@ -92,7 +91,7 @@ files:
|
|
92
91
|
- test/internal/db/schema.rb
|
93
92
|
- test/models/models_test.rb
|
94
93
|
- test/test_helper.rb
|
95
|
-
homepage: http://
|
94
|
+
homepage: http://matiq.com
|
96
95
|
licenses:
|
97
96
|
- MIT
|
98
97
|
metadata:
|
@@ -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: 'Mimoco: some minitests for models and controllers'
|
data/.watchr
DELETED
@@ -1,59 +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, file)
|
19
|
-
case type
|
20
|
-
when "test" then run %(bundle exec ruby -I test #{file})
|
21
|
-
# when 'spec'; run %(rspec -X #{file})
|
22
|
-
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_all_tests
|
27
|
-
puts "\n#{HH} Running all tests #{HH}\n"
|
28
|
-
TESTING.each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) }
|
29
|
-
end
|
30
|
-
|
31
|
-
def run_matching_files(base)
|
32
|
-
base = base.split("_").first
|
33
|
-
TESTING.each { |type|
|
34
|
-
files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ }
|
35
|
-
run_it type, files.join(" ") unless files.empty?
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
TESTING.each { |type|
|
40
|
-
watch("#{type}/#{type}_helper\.rb") { run_all_tests }
|
41
|
-
watch("lib/.*\.rb") { run_all_tests }
|
42
|
-
watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] }
|
43
|
-
watch("#{type}/data/(.*)\.rb") { |match|
|
44
|
-
m1 = match[1]
|
45
|
-
run_matching_files("#{type}/#{m1}/#{m1}_#{type}.rb")
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
%w[rb erb haml slim].each { |type|
|
50
|
-
watch(".*/(.*)\.#{type}") { |match|
|
51
|
-
run_matching_files(match[1])
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
# Ctrl-\ or ctrl-4
|
56
|
-
Signal.trap("QUIT") { run_all_tests }
|
57
|
-
# Ctrl-C
|
58
|
-
Signal.trap("INT") { abort("Interrupted\n") }
|
59
|
-
usage
|