still_life 0.1.0 → 0.2.0
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/.gitignore +1 -0
- data/.travis.yml +15 -4
- data/README.md +6 -2
- data/Rakefile +2 -0
- data/lib/still_life/action_dispatch_extension.rb +10 -10
- data/lib/still_life/capybara_extension.rb +6 -3
- data/lib/still_life/railtie.rb +11 -8
- data/lib/still_life/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d2486c2d3db425af9db4c7b0632a5aecadd94ea383e13c51e3e9f0fab1f70f
|
4
|
+
data.tar.gz: 6b8193f48947fec6d8d4bc079582614669ac171b9d87af6bd1c7abc188830469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c09f261b346364ffb7c0c5e487ae97295cb75cfad7de6f7707cbab45e86ae7b4f210d6656d2e74c221e0a4efaf3396af3b7a5f0db39e7ba139b3aa9ab6e14ab
|
7
|
+
data.tar.gz: b05f324577658154e7c60f1d35b5d919e39ba87a985273056e03197e13733a862361727fa963eb5bd6b2d7691704452e4e722f21c3883f462857a99f7073340f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,7 +1,18 @@
|
|
1
|
-
|
2
|
-
sudo: false
|
1
|
+
dist: focal
|
3
2
|
language: ruby
|
4
3
|
cache: bundler
|
4
|
+
|
5
|
+
addons:
|
6
|
+
chrome: stable
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- sudo apt update -qq
|
10
|
+
- sudo apt install -y chromium-chromedriver
|
11
|
+
|
5
12
|
rvm:
|
6
|
-
- 2.7.
|
7
|
-
|
13
|
+
- 2.7.2
|
14
|
+
|
15
|
+
env:
|
16
|
+
- TEST_FRAMEWORK=test-unit
|
17
|
+
- TEST_FRAMEWORK=minitest
|
18
|
+
- TEST_FRAMEWORK=rspec
|
data/README.md
CHANGED
@@ -122,20 +122,24 @@ and push some more commits...
|
|
122
122
|
### 4. Compare the results, and make sure there's no unexpected diffs
|
123
123
|
|
124
124
|
```sh
|
125
|
-
% diff -
|
125
|
+
% git diff --no-index --color-words tmp/html/rails52/ tmp/html/rails60/
|
126
126
|
```
|
127
127
|
|
128
128
|
|
129
129
|
## Notes
|
130
|
+
### git diff
|
131
|
+
As written in the above example, `git diff --no-index --color-words` should perfectly work for recursively comparing two output directories.
|
132
|
+
|
130
133
|
### Random Values
|
131
134
|
|
132
135
|
If your response includes some kind of random values, the test results may change between each test runs.
|
133
|
-
In such case, maybe you could specify a random seed, or mock the random source in your app
|
136
|
+
In such case, maybe you could specify a random seed, or mock the random source in your app.
|
134
137
|
|
135
138
|
|
136
139
|
## TODOs / Known Issues
|
137
140
|
- The Capybara monkeypatch sometimes fails to get the `page.body` due to Capybara timing problem
|
138
141
|
- Support older versions of Rails, Capybara, and Ruby
|
142
|
+
- Fix the CI with RSpec + headless Chrome
|
139
143
|
|
140
144
|
|
141
145
|
## Contributing
|
data/Rakefile
CHANGED
@@ -2,32 +2,32 @@
|
|
2
2
|
|
3
3
|
module StillLife
|
4
4
|
module ActionDispatchExtension
|
5
|
-
def get(
|
6
|
-
super
|
5
|
+
def get(*, **)
|
6
|
+
super.tap do
|
7
7
|
StillLife.draw(response.body)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def post(
|
12
|
-
super
|
11
|
+
def post(*, **)
|
12
|
+
super.tap do
|
13
13
|
StillLife.draw(response.body)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def put(
|
18
|
-
super
|
17
|
+
def put(*, **)
|
18
|
+
super.tap do
|
19
19
|
StillLife.draw(response.body)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def patch(
|
24
|
-
super
|
23
|
+
def patch(*, **)
|
24
|
+
super.tap do
|
25
25
|
StillLife.draw(response.body)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def delete(
|
30
|
-
super
|
29
|
+
def delete(*, **)
|
30
|
+
super.tap do
|
31
31
|
StillLife.draw(response.body)
|
32
32
|
end
|
33
33
|
end
|
@@ -8,9 +8,12 @@ module StillLife
|
|
8
8
|
|
9
9
|
body_was = session.body
|
10
10
|
super.tap do
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
3.times do
|
12
|
+
if session.body.present? && (session.body != body_was)
|
13
|
+
StillLife.draw(session.body)
|
14
|
+
else
|
15
|
+
sleep(0.5) && next
|
16
|
+
end
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
data/lib/still_life/railtie.rb
CHANGED
@@ -13,16 +13,19 @@ module StillLife
|
|
13
13
|
ActionDispatch::SystemTestCase.include StillLife::CapybaraExtension
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
ActiveSupport.on_load :active_support_test_case do
|
17
|
+
begin
|
18
|
+
require 'rspec-rails'
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
# TODO: maybe we could use some kind of hook instead of directly configuring here?
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.prepend StillLife::ActionDispatchExtension, type: :request
|
23
|
+
config.prepend StillLife::ActionDispatchExtension, type: :controller
|
24
|
+
config.include StillLife::CapybaraExtension, type: :feature
|
25
|
+
config.include StillLife::CapybaraExtension, type: :system
|
26
|
+
end
|
27
|
+
rescue LoadError
|
24
28
|
end
|
25
|
-
rescue LoadError
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
data/lib/still_life/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: still_life
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ homepage: https://github.com/amatsuda/still_life
|
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|
94
|
-
post_install_message:
|
94
|
+
post_install_message:
|
95
95
|
rdoc_options: []
|
96
96
|
require_paths:
|
97
97
|
- lib
|
@@ -106,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.0.
|
110
|
-
signing_key:
|
109
|
+
rubygems_version: 3.2.0.rc.1
|
110
|
+
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Test result HTML recorder
|
113
113
|
test_files: []
|