spec_views 3.3.1 → 3.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffc864c05ff98f751abe8d28920fb4dcddcf8da527299327a42f1565bc545718
4
- data.tar.gz: dbb69ec88cdbaa8157875ff907f1d1b0a31475029454e5d0d23993b6c5a5e9d2
3
+ metadata.gz: b9d735d5be23258478cd7985580dbd28795d0c56d0a4047437cdef7b05d7f50c
4
+ data.tar.gz: 501d7d05ac210122760f79706da9bba4c02dfb04e2ef0f73e00195925a054c33
5
5
  SHA512:
6
- metadata.gz: cf0d8f5c736f7736eede534183b70d52ff1782545d2086542126dfaba9c66af03bbd46e70a073bdd4b7adcb8b4012d9e2016c789c99739308a57f53872ab1ca9
7
- data.tar.gz: '0387e85f37e57af40325a7282dff27ac5687e13d2e7f156894dc77c8abc27fc91b2003e0aa21fadd6b51cbc9dc6c0e943ebae9bd127070a84bea03c54b723da1'
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
- FileUtils.remove_file(directory.challenger_path)
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$/, '').gsub('_', '::')
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
@@ -9,6 +9,7 @@ Rails.application.routes.draw do
9
9
  get :batch
10
10
  delete :destroy_outdated
11
11
  post :accept_all
12
+ post :reject_all
12
13
  post :batch_accept
13
14
  end
14
15
  member do
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpecViews
4
- VERSION = '3.3.1'
4
+ VERSION = '3.5.0'
5
5
  end
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.3.1
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: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs