minitest-spec-context 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/tests.yml +38 -0
- data/README.md +20 -2
- data/lib/minitest-spec-context.rb +9 -1
- data/minitest-spec-context.gemspec +6 -3
- data/test/context_test.rb +14 -1
- metadata +43 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f73ac320f38a6858e0d18fc81e5089cc313eb6478e4cf2912d3d1be5874c4153
|
4
|
+
data.tar.gz: a8770c302c7db09235213037deed91686e4bd90753927928dcde18feba337374
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68d87792e43d9c883b171bb9256ca9b5f51a3734f5e01e7bbaee7d6168a47bd652beb4644550b00bdebc472d56630f8169eaf5ff8ac8f39347767f5a9b0a9572
|
7
|
+
data.tar.gz: 8060d343a5f3faa1aa8d62c3a9066b2078538c6e65a72b0dae01dd46262097172844320730fee997854df5d2a688cfbb40cdac3a4a26061a900432a572470099
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "master" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "master" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Test
|
30
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
31
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
32
|
+
# uses: ruby/setup-ruby@v1
|
33
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
37
|
+
- name: Run tests
|
38
|
+
run: bundle exec ruby test/context_test.rb
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Minitest::Spec::Context
|
2
2
|
|
3
|
-
This gem provides a ```context``` method for
|
3
|
+
This gem provides a ```context``` method for Minitest::Spec
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,6 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
Require the gem in the `test_helper`:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "minitest-spec-context"
|
25
|
+
```
|
26
|
+
|
27
|
+
And now you can use it:
|
28
|
+
|
21
29
|
```ruby
|
22
30
|
|
23
31
|
describe "#method" do
|
@@ -33,8 +41,18 @@ describe "#method" do
|
|
33
41
|
end
|
34
42
|
end
|
35
43
|
```
|
44
|
+
The ```context``` method is available only in the nested blocks. One cannot use it in the outside most block. I simply do not desire to introduce a new method in ruby ```Kernel``` module
|
45
|
+
|
46
|
+
The ```context``` method is also available on ```ActiveSupport::TestCase```, for use within Rails applications.
|
36
47
|
|
37
|
-
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
class ActiveSupport::TestCase
|
51
|
+
context "when using Rails" do
|
52
|
+
...
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
38
56
|
|
39
57
|
## Contributing
|
40
58
|
|
@@ -1,9 +1,17 @@
|
|
1
1
|
require 'minitest/spec'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Minitest
|
4
4
|
class Spec
|
5
5
|
class << self
|
6
6
|
alias_method :context, :describe
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
if defined? ActiveSupport::TestCase
|
12
|
+
class ActiveSupport::TestCase
|
13
|
+
class << self
|
14
|
+
alias_method :context, :describe
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.authors = ["Yi Wen"]
|
4
4
|
gem.email = ["hayafirst@gmail.com"]
|
5
|
-
gem.description = %q{Provides context method to
|
6
|
-
gem.summary = %q{Provides context method to
|
5
|
+
gem.description = %q{Provides context method to Minitest::Spec}
|
6
|
+
gem.summary = %q{Provides context method to Minitest::Spec}
|
7
7
|
gem.homepage = "https://github.com/ywen/minitest-spec-context"
|
8
8
|
|
9
9
|
gem.files = `git ls-files`.split($\)
|
@@ -11,5 +11,8 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
12
12
|
gem.name = "minitest-spec-context"
|
13
13
|
gem.require_paths = ["lib"]
|
14
|
-
gem.version = '0.0.
|
14
|
+
gem.version = '0.0.5'
|
15
|
+
|
16
|
+
gem.add_development_dependency "activesupport", "~> 6.0"
|
17
|
+
gem.add_development_dependency "minitest"
|
15
18
|
end
|
data/test/context_test.rb
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require_relative '../lib/minitest-spec-context'
|
4
|
+
require 'active_support'
|
5
|
+
require 'active_support/test_case'
|
4
6
|
|
5
|
-
describe
|
7
|
+
describe Minitest::Spec do
|
8
|
+
describe ".context" do
|
9
|
+
let(:object) { "44" }
|
10
|
+
context "when nested with context method" do
|
11
|
+
it "has the access to the variables defined outside" do
|
12
|
+
object.must_equal "44"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class ActiveSupport::TestCase
|
6
19
|
describe ".context" do
|
7
20
|
let(:object) { "44" }
|
8
21
|
context "when nested with context method" do
|
metadata
CHANGED
@@ -1,24 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-spec-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Yi Wen
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
11
|
+
date: 2023-08-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Provides context method to Minitest::Spec
|
15
42
|
email:
|
16
43
|
- hayafirst@gmail.com
|
17
44
|
executables: []
|
18
45
|
extensions: []
|
19
46
|
extra_rdoc_files: []
|
20
47
|
files:
|
21
|
-
- .
|
48
|
+
- ".github/workflows/tests.yml"
|
49
|
+
- ".gitignore"
|
22
50
|
- Gemfile
|
23
51
|
- LICENSE
|
24
52
|
- README.md
|
@@ -29,27 +57,25 @@ files:
|
|
29
57
|
- test/context_test.rb
|
30
58
|
homepage: https://github.com/ywen/minitest-spec-context
|
31
59
|
licenses: []
|
32
|
-
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
33
62
|
rdoc_options: []
|
34
63
|
require_paths:
|
35
64
|
- lib
|
36
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
66
|
requirements:
|
39
|
-
- -
|
67
|
+
- - ">="
|
40
68
|
- !ruby/object:Gem::Version
|
41
69
|
version: '0'
|
42
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
71
|
requirements:
|
45
|
-
- -
|
72
|
+
- - ">="
|
46
73
|
- !ruby/object:Gem::Version
|
47
74
|
version: '0'
|
48
75
|
requirements: []
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
summary: Provides context method to MiniTest::Spec
|
76
|
+
rubygems_version: 3.3.26
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Provides context method to Minitest::Spec
|
54
80
|
test_files:
|
55
81
|
- test/context_test.rb
|