minispec-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/minispec/rails/system_test.rb +13 -0
- data/lib/minispec/rails/version.rb +5 -0
- data/lib/minispec/rails.rb +24 -0
- data/minispec-rails.gemspec +36 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d99901e5cd8d396c7b26b6b5d9b0592a66ed091e
|
4
|
+
data.tar.gz: cd4f2da6203d362fd2a24d0f15aa36a9e921126d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88d5fba22bf4642244cf78a50304d97985d963af902ed6c129bc429c32e12b8f8eafe856b24349d6d01c17830d034ff6480950a34d2e6565eea752a4c91e2f60
|
7
|
+
data.tar.gz: e6158199d4ab0321e1f502a5808d0376588703129657de4c00958a4f3ab35c8076de6d267f8f2b579ca35df0a2a3332b4d4f3da9e462f580204aa5f0961072f0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Jared Ning
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Minispec::Rails
|
2
|
+
|
3
|
+
Use Minitest::Spec in Rails.
|
4
|
+
|
5
|
+
## Why another minitest rails gem?
|
6
|
+
|
7
|
+
There are plenty out there, and I'm sure they all work just fine.
|
8
|
+
I have personally never used any of them because it was never a big deal to insert Minitest::Spec into any Rails project manually with just a few lines of code.
|
9
|
+
The fewer gems/lines of code there are, the better.
|
10
|
+
But obviously that's not very helpful to anyone who just wants it to work with a simple `gem blah`, done (including me).
|
11
|
+
|
12
|
+
## Goals
|
13
|
+
|
14
|
+
* Get running in Rails with Minitest::Spec with minimal lines of code.
|
15
|
+
|
16
|
+
## Not Goals
|
17
|
+
|
18
|
+
* Help with migrating from "Rails style" to Spec style. I don't recommend anyone convert any test suite to spec style for the sake of converting. You really don't gain all that much.
|
19
|
+
* Support multiple styles. You're probably here to use Spec style, so use Spec style. Why would you want to mix and match?
|
20
|
+
* Support old Rails versions. Since I don't recommend converting, I don't see a big use case for supporting older Rails versions.
|
21
|
+
* (for now at least) Rails generators. I personally don't find them all that useful. If there is enough demand for it, I might do it, but in the interest of keeping this gem small, I'm going to skip them.
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem 'minispec-rails'
|
29
|
+
```
|
30
|
+
|
31
|
+
And then execute:
|
32
|
+
|
33
|
+
$ bundle
|
34
|
+
|
35
|
+
Or install it yourself as:
|
36
|
+
|
37
|
+
$ gem install minispec-rails
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
Once this gem is required, you can immediately start using it to `describe` your tests.
|
42
|
+
There is 1 exception: SystemTests.
|
43
|
+
In order to lazy-load, just require the workaround before defining `ApplicationSystemTestCase`:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# test/application_system_test_case.rb.
|
47
|
+
require "test_helper"
|
48
|
+
require 'minispec/rails/system_test' # Add this line here.
|
49
|
+
|
50
|
+
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
51
|
+
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
See the [example rails app](https://github.com/ordinaryzelig/minispec-rails-example).
|
56
|
+
|
57
|
+
## TODO
|
58
|
+
|
59
|
+
* Ask Rails to add `run_load_hooks` for ActionDispatch::SystemTestCase so we can lazy load like the others.
|
60
|
+
* Custom file types? I like file types like `spec/models/my_model.spec.rb`. But maybe later.
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "minispec/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# We can't lazy load SystemTestCase, so we need to require this manually.
|
2
|
+
# If we can get Rails to add `run_load_hooks` for this class,
|
3
|
+
# then we can lazy load it and move it with the others in lib/minispec/rails.
|
4
|
+
ActionDispatch::SystemTestCase.extend(
|
5
|
+
Module.new do
|
6
|
+
def inherited(*)
|
7
|
+
super
|
8
|
+
unless Minitest::Spec::TYPES.find { |matcher, type| type == ApplicationSystemTestCase }
|
9
|
+
Minitest::Spec.register_spec_type(//, ApplicationSystemTestCase)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "minispec/rails/version"
|
2
|
+
require 'minitest/spec'
|
3
|
+
|
4
|
+
module Minispec
|
5
|
+
module Rails
|
6
|
+
|
7
|
+
# We can't force ActiveSupport to be a subclass of Minitest::Spec.
|
8
|
+
# Next best thing.
|
9
|
+
ActiveSupport::TestCase.extend Minitest::Spec::DSL
|
10
|
+
|
11
|
+
ActiveSupport.on_load(:active_support_test_case) do
|
12
|
+
Minitest::Spec.register_spec_type(ActiveSupport::TestCase) do |desc|
|
13
|
+
desc.is_a?(Class) && desc.include?(ActiveRecord::Core)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
ActiveSupport.on_load(:action_dispatch_integration_test) do
|
18
|
+
Minitest::Spec.register_spec_type(ActionDispatch::IntegrationTest) do |desc|
|
19
|
+
desc.is_a?(Class) && desc < AbstractController::Base
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "minispec/rails/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "minispec-rails"
|
8
|
+
spec.version = Minispec::Rails::VERSION
|
9
|
+
spec.authors = ["Jared Ning"]
|
10
|
+
spec.email = ["jared@redningja.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Minimal Minitest::Spec in Rails.}
|
13
|
+
spec.description = %q{Get Minitest::Spec in Rails with very few lines and no other features.}
|
14
|
+
spec.homepage = "https://github.com/ordinaryzelig/minispec-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minispec-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jared Ning
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: Get Minitest::Spec in Rails with very few lines and no other features.
|
56
|
+
email:
|
57
|
+
- jared@redningja.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/minispec/rails.rb
|
71
|
+
- lib/minispec/rails/system_test.rb
|
72
|
+
- lib/minispec/rails/version.rb
|
73
|
+
- minispec-rails.gemspec
|
74
|
+
homepage: https://github.com/ordinaryzelig/minispec-rails
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata:
|
78
|
+
allowed_push_host: https://rubygems.org
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.6.8
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Minimal Minitest::Spec in Rails.
|
99
|
+
test_files: []
|