declarative_minitest 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d38e85b804ba99c4b4f7f89aef8d06db16c5c78a
4
- data.tar.gz: 99b0fb1600bd24b36a2622387572d3ba2fa65996
2
+ SHA256:
3
+ metadata.gz: 0feea1d3672cac89377207884f5ea67c603124fc3fbeba2a233f3e601b784cbd
4
+ data.tar.gz: 3dfe87e2074344540ba67579772633e992b37aaffb257d198aea1b971a9c2710
5
5
  SHA512:
6
- metadata.gz: 488cbad39fe77496c564e620ff03eb4ee49d2c71c816888ed5c10aa451a3db821707c743ab174a08fdb7d20be782c8ef0b27b9f170d63b1ad41b71c79de13749
7
- data.tar.gz: 0fa45a771131f0af91168c2681ff8287b5745934be2dfb0ad8719a7385035849a30fc007c8b20b8a0cf53599abe62633c642257faee6448ba1216ba3e63ca7ef
6
+ metadata.gz: b00147dbb17948e9c9ecd7b4c196ba9966748dd0804f3bdc3ca38e873ea77b6774066346e48a9e7af80fea82f657d12b5173dc6da2af910ef71133264f46e543
7
+ data.tar.gz: bb0c817a80a4b833f6b586803f20877222879bd2c20967b342ca7550178fe4a0e87063746d8bdb21183ae8b3d5b467cd49cf30aecde88f52ef613007027928bd
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Declarative Minitest ![Build Status](https://github.com/peterzhu2118/declarative_minitest/actions/workflows/test.yml/badge.svg?branch=master) [![Gem Version](https://badge.fury.io/rb/declarative_minitest.svg)](https://badge.fury.io/rb/declarative_minitest)
2
+
3
+ Adds declarative minitest (`setup do`, `test 'the truth' do`, and `teardown do`) syntax from Rails-flavoured minitest to the original minitest.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ $ gem install declarative_minitest
9
+ ```
10
+ or add to your `Gemfile`:
11
+ ```
12
+ gem 'declarative_minitest', '~> 0.1.2'
13
+ ```
14
+
15
+ ## How to use
16
+
17
+ Add the line `require 'minitest/declarative'` after `require 'minitest/autorun'` in
18
+ either `test_helper.rb` or in the individual tests that you want declarative syntax.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'declarative_minitest/test'
4
-
5
3
  #:nodoc:
6
4
  module DeclarativeMinitest
7
5
  end
@@ -13,6 +13,7 @@ module Minitest
13
13
  test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
14
14
  defined = method_defined? test_name
15
15
  raise "#{test_name} is already defined in #{self}" if defined
16
+
16
17
  if block_given?
17
18
  define_method(test_name, &block)
18
19
  else
@@ -21,5 +22,25 @@ module Minitest
21
22
  end
22
23
  end
23
24
  end
25
+
26
+ def self.setup(&block)
27
+ if block_given?
28
+ define_method(:setup, &block)
29
+ else
30
+ define_method(:setup) do
31
+ flunk "No implementation provided for #{name}"
32
+ end
33
+ end
34
+ end
35
+
36
+ def self.teardown(&block)
37
+ if block_given?
38
+ define_method(:teardown, &block)
39
+ else
40
+ define_method(:teardown) do
41
+ flunk "No implementation provided for #{name}"
42
+ end
43
+ end
44
+ end
24
45
  end
25
46
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: declarative_minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zhu
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-09 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
13
27
  description: Ports Rails declarative minitest into regular minitest
14
28
  email:
15
29
  - peter@peterzhu.ca
@@ -18,14 +32,14 @@ extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
34
  - MIT-LICENSE
21
- - Rakefile
35
+ - README.md
22
36
  - lib/declarative_minitest.rb
23
37
  - lib/minitest/declarative.rb
24
38
  homepage: https://github.com/peterzhu2118/declarative_minitest
25
39
  licenses:
26
40
  - MIT
27
41
  metadata: {}
28
- post_install_message:
42
+ post_install_message:
29
43
  rdoc_options: []
30
44
  require_paths:
31
45
  - lib
@@ -40,9 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  requirements: []
43
- rubyforge_project:
44
- rubygems_version: 2.5.2.3
45
- signing_key:
57
+ rubygems_version: 3.3.7
58
+ signing_key:
46
59
  specification_version: 4
47
60
  summary: Ports Rails declarative minitest into regular minitest
48
61
  test_files: []
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'declarative_minitest'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- require 'bundler/gem_tasks'
18
-
19
- require 'rake/testtask'
20
-
21
- Rake::TestTask.new(:test) do |t|
22
- t.libs << 'test'
23
- t.pattern = 'test/**/*_test.rb'
24
- t.verbose = false
25
- end
26
-
27
- task default: :test