spec_views 3.3.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/app/controllers/spec_views/views_controller.rb +8 -1
- data/app/models/spec_views/directory.rb +1 -1
- data/app/views/spec_views/views/index.html.erb +2 -3
- data/config/routes.rb +1 -0
- data/lib/spec_views/support.rb +4 -0
- data/lib/spec_views/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9d735d5be23258478cd7985580dbd28795d0c56d0a4047437cdef7b05d7f50c
|
4
|
+
data.tar.gz: 501d7d05ac210122760f79706da9bba4c02dfb04e2ef0f73e00195925a054c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c0ae84c37be9a0e2c08000036fae329cee08e4d1e23d29d224997ae397f300c8b8ad0908f36b82811adeb316206c159e6a164be33c39eacc026fe4da7f35295
|
7
|
+
data.tar.gz: 69457a1c2df67cb8fa1bf1ddcab8ad85720ccc40dae44b7b9cd0ab7b76cc908b3e7b0f8a90209b50e96235f4bcd620ca98087ba9188bd27c102998e164fbf67d
|
data/README.md
CHANGED
@@ -79,6 +79,23 @@ RSpec.describe "Articles", type: :request do
|
|
79
79
|
end
|
80
80
|
```
|
81
81
|
|
82
|
+
### Add an affix
|
83
|
+
If you have two requests with the same description, you can add an affix to the generated name:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
RSpec.describe "Articles", type: :request do
|
87
|
+
describe 'GET /articles' do
|
88
|
+
it 'renders the listing' do
|
89
|
+
get articles_path
|
90
|
+
expect(response).to match_html_fixture.with_affix('only 10')
|
91
|
+
|
92
|
+
get articles_path(all: '1')
|
93
|
+
expect(response).to match_html_fixture.with_affix('all')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
82
99
|
### PDF matching
|
83
100
|
If your request responds with a PDF you can compare it as well:
|
84
101
|
|
@@ -82,8 +82,15 @@ module SpecViews
|
|
82
82
|
redirect_to action: :index
|
83
83
|
end
|
84
84
|
|
85
|
+
def reject_all
|
86
|
+
directories.each do |dir|
|
87
|
+
dir.remove_challenger if dir.challenger?
|
88
|
+
end
|
89
|
+
redirect_to action: :index
|
90
|
+
end
|
91
|
+
|
85
92
|
def reject
|
86
|
-
|
93
|
+
directory.remove_challenger
|
87
94
|
redirect_to action: :index, challenger: :next
|
88
95
|
end
|
89
96
|
|
@@ -27,7 +27,7 @@ module SpecViews
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def controller_name
|
30
|
-
splitted_description.first.gsub(/Controller(_.*)$/, 'Controller').gsub(/Controller$/, '')
|
30
|
+
splitted_description.first.gsub(/Controller(_.*)$/, 'Controller').gsub(/Controller$/, '')
|
31
31
|
end
|
32
32
|
|
33
33
|
def method
|
@@ -38,13 +38,12 @@
|
|
38
38
|
<div class="footer">
|
39
39
|
<div class="info"></div>
|
40
40
|
<div class="actions">
|
41
|
-
<% if @directories.any?(&:challenger?) %>
|
42
|
-
<%= link_to 'Batch Diff', url_for(action: :batch), class: 'diff btn' %>
|
43
|
-
<% end %>
|
44
41
|
<% if @directories.any?{ |dir| dir.last_run < @latest_run } %>
|
45
42
|
<%= button_to 'Remove Outdated', url_for(action: :destroy_outdated), method: :delete, class: 'reject' %>
|
46
43
|
<% end %>
|
47
44
|
<% if @directories.any?(&:challenger?) %>
|
45
|
+
<%= link_to 'Batch Diff', url_for(action: :batch), class: 'diff btn' %>
|
46
|
+
<%= button_to 'Reject All', url_for(action: :reject_all), method: :post, class: 'reject' %>
|
48
47
|
<%= button_to 'Accept All', url_for(action: :accept_all), method: :post, class: 'accept' %>
|
49
48
|
<% end %>
|
50
49
|
</div>
|
data/config/routes.rb
CHANGED
data/lib/spec_views/support.rb
CHANGED
@@ -55,10 +55,14 @@ matchers.each do |matcher|
|
|
55
55
|
chain :for_status do |status|
|
56
56
|
@status = status
|
57
57
|
end
|
58
|
+
chain :with_affix do |affix|
|
59
|
+
@affix = affix
|
60
|
+
end
|
58
61
|
|
59
62
|
match do |actual|
|
60
63
|
example = @matcher_execution_context.instance_variable_get('@_spec_view_example')
|
61
64
|
description = example.full_description
|
65
|
+
description = "#{description}-#{@affix}" if @affix.present?
|
62
66
|
type = example.metadata[:type]
|
63
67
|
run_time = $_spec_view_time # rubocop:disable Style/GlobalVars
|
64
68
|
@status ||= :ok
|
data/lib/spec_views/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec_views
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Gaul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|