mimoco 0.3.0 → 0.3.1
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 +4 -4
- data/.github/workflows/rake.yml +2 -6
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/MIT-LICENSE +3 -1
- data/README.md +17 -7
- data/lib/mimoco/version.rb +5 -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: f7687d9d8c3b8c3971572508cc9185fc7269694a8b5e4f1323276cb2a92e2f23
|
4
|
+
data.tar.gz: f03125f88696b0e2047e367944e311c96a62074eebb267f2480909bb635f35d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f209deac9fc564873191ff1eec4a481911ac199308e8a3c34bb7c4f6b5e309075238b30bf577113b4f4a61da8854bb95dd3735f11af67b4b115fa9775c819a4f
|
7
|
+
data.tar.gz: 3963910ec299d1f399a1a5edc31c55d42d4a01d9d0856d248311ca68c706f8ed601229bfcaff939ca276ea57d7598c9ec1c9da78ab71cd690e224ad4d238c1ce
|
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.1", 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/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.1.
|
1
|
+
ruby-3.1.3
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021-2022 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
|
-
[](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 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,9 @@
|
|
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.1" # 2022-12-25
|
5
|
+
# VERSION = "0.3.0" # 2022-02-11
|
6
|
+
# VERSION = "0.2.0" # 2022-01-06
|
7
|
+
# VERSION = "0.1.0" # 2022-01-03
|
8
|
+
# VERSION = "0.0.1" # 2021-12-29
|
9
9
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-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.3.
|
114
|
+
rubygems_version: 3.3.26
|
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
|