spec_views 1.0.1 → 2.0.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +101 -16
  3. data/Rakefile +3 -1
  4. data/app/assets/config/spec_views_manifest.js +1 -0
  5. data/app/assets/javascripts/spec_views/diff.js +60 -0
  6. data/app/assets/javascripts/spec_views/jsdiff.js +1055 -0
  7. data/app/controllers/spec_views/views_controller.rb +18 -60
  8. data/app/models/spec_views/base_matcher.rb +64 -0
  9. data/app/models/spec_views/directory.rb +133 -0
  10. data/app/models/spec_views/html_matcher.rb +39 -0
  11. data/app/models/spec_views/http_response_extractor.rb +31 -0
  12. data/app/models/spec_views/mail_message_extractor.rb +30 -0
  13. data/app/models/spec_views/pdf_matcher.rb +49 -0
  14. data/app/views/layouts/spec_views.html.erb +261 -0
  15. data/app/views/spec_views/views/_actions.html.erb +11 -0
  16. data/app/views/spec_views/views/_directory_footer.html.erb +14 -0
  17. data/app/views/spec_views/views/compare.html.erb +11 -0
  18. data/app/views/spec_views/views/diff.html.erb +16 -0
  19. data/app/views/spec_views/views/index.html.erb +48 -0
  20. data/app/views/spec_views/views/preview.html.erb +32 -0
  21. data/config/routes.rb +3 -0
  22. data/lib/spec_views/configuration.rb +3 -2
  23. data/lib/spec_views/engine.rb +10 -0
  24. data/lib/spec_views/support.rb +56 -166
  25. data/lib/spec_views/version.rb +3 -1
  26. data/lib/spec_views.rb +3 -1
  27. data/lib/tasks/spec_views_tasks.rake +1 -0
  28. metadata +26 -15
  29. data/app/views/layouts/spec_views.html.haml +0 -200
  30. data/app/views/spec_views/views/compare.html.haml +0 -16
  31. data/app/views/spec_views/views/index.html.haml +0 -29
  32. data/app/views/spec_views/views/preview.html.haml +0 -19
data/lib/spec_views.rb CHANGED
@@ -1,4 +1,6 @@
1
- require "spec_views/engine"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_views/engine'
2
4
 
3
5
  module SpecViews
4
6
  # Your code goes here...
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # desc "Explaining what the task does"
2
3
  # task :spec_views do
3
4
  # # Task goes here
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: 1.0.1
4
+ version: 2.0.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: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: haml-rails
42
+ name: timecop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '0.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '0.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: timecop
56
+ name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.0'
62
- type: :runtime
61
+ version: '0'
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.0'
68
+ version: '0'
69
69
  description: Render views from controller specs for comparision
70
70
  email:
71
71
  - sebastian.gaul@lichtbit.com
@@ -77,11 +77,22 @@ files:
77
77
  - README.md
78
78
  - Rakefile
79
79
  - app/assets/config/spec_views_manifest.js
80
+ - app/assets/javascripts/spec_views/diff.js
81
+ - app/assets/javascripts/spec_views/jsdiff.js
80
82
  - app/controllers/spec_views/views_controller.rb
81
- - app/views/layouts/spec_views.html.haml
82
- - app/views/spec_views/views/compare.html.haml
83
- - app/views/spec_views/views/index.html.haml
84
- - app/views/spec_views/views/preview.html.haml
83
+ - app/models/spec_views/base_matcher.rb
84
+ - app/models/spec_views/directory.rb
85
+ - app/models/spec_views/html_matcher.rb
86
+ - app/models/spec_views/http_response_extractor.rb
87
+ - app/models/spec_views/mail_message_extractor.rb
88
+ - app/models/spec_views/pdf_matcher.rb
89
+ - app/views/layouts/spec_views.html.erb
90
+ - app/views/spec_views/views/_actions.html.erb
91
+ - app/views/spec_views/views/_directory_footer.html.erb
92
+ - app/views/spec_views/views/compare.html.erb
93
+ - app/views/spec_views/views/diff.html.erb
94
+ - app/views/spec_views/views/index.html.erb
95
+ - app/views/spec_views/views/preview.html.erb
85
96
  - config/routes.rb
86
97
  - lib/spec_views.rb
87
98
  - lib/spec_views/configuration.rb
@@ -1,200 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
- %title Spec Views
6
- %meta{charset: "utf-8"}/
7
- %meta{content: "width=device-width, initial-scale=1, shrink-to-fit=no", name: "viewport"}/
8
- %meta{name: "turbolinks-cache-control", content: "no-cache"}/
9
- = csrf_meta_tags
10
- = csp_meta_tag
11
- :sass
12
- $dark-bg: #252526
13
- $dark-bg-light: #2A2D2E
14
- $dark-bg-lighter: #37373D
15
- $dark-text: #DADADA
16
-
17
- $accept-bg: #5fa285
18
- $accept-text: $dark-text
19
-
20
- $reject-bg: #d27575
21
- $reject-text: $dark-text
22
-
23
- $highlight: #0E639C
24
- $challenger: $highlight
25
- $outdated: $reject-bg
26
-
27
- *
28
- box-sizing: border-box
29
- margin: 0
30
- padding: 0
31
-
32
- body
33
- font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"
34
- background: #252526
35
- color: #FFF
36
- margin: 0
37
- padding: 0
38
-
39
- .iframes
40
- position: relative
41
- z-index: 5
42
- display: flex
43
- justify-content: space-between
44
- align-items: stretch
45
- height: calc(100vh - 50px)
46
- overflow: auto
47
-
48
- > *
49
- width: calc(50% - 5px)
50
- height: 100%
51
- display: flex
52
- flex-direction: column
53
- justify-content: stretch
54
-
55
- &.w-100
56
- width: calc(100% - 5px)
57
-
58
- iframe
59
- border: 0
60
- margin: 0
61
- padding: 0
62
- width: 100%
63
- flex-grow: 1
64
-
65
- h2
66
- margin: 0
67
- padding: 4px 0
68
- text-align: center
69
- font-weight: 300
70
- text-transform: uppercase
71
- font-size: 12px
72
- line-height: 1
73
-
74
- .footer
75
- position: relative
76
- z-index: 10
77
- display: flex
78
- justify-content: space-between
79
- height: 50px
80
- box-shadow: 0px -1px 4px rgba(0, 0, 0, 0.65)
81
-
82
- .info
83
- padding: 0 0 0 10px
84
- font-size: 14px
85
- display: flex
86
- align-items: center
87
-
88
- > div
89
- padding: .5rem .2rem
90
-
91
- .actions
92
- display: flex
93
- justify-content: flex-end
94
- padding: 2px 2rem 0 0
95
-
96
- > *
97
- margin-left: 2rem
98
-
99
- form.button_to
100
- display: flex
101
-
102
- input[type=submit], .btn
103
- display: block
104
- padding: .5rem .5rem .4rem
105
- border: 0 solid $dark-bg-lighter
106
- border-width: 0 0 8px 0
107
- color: $dark-text
108
- border-radius: 0
109
- background: $dark-bg-light
110
- cursor: pointer
111
- font-size: .9rem
112
- line-height: 1.75
113
- min-width: 5rem
114
- text-align: center
115
-
116
- &:hover
117
- background: $dark-bg-lighter
118
-
119
- &.accept
120
- border-color: $accept-bg
121
- color: $accept-text
122
- &.reject
123
- border-color: $reject-bg
124
- color: $reject-text
125
- &.btn
126
- border-color: $highlight
127
- &.disabled
128
- opacity: 0.5
129
- cursor: default
130
- &:hover
131
- background: $dark-bg-light
132
-
133
- a
134
- color: $dark-text
135
- text-decoration: none
136
-
137
- .directories
138
- display: flex
139
- flex-direction: column
140
- align-items: center
141
- margin: 5rem auto 0
142
- list-style-type: none
143
- padding: 0
144
- padding-bottom: 2rem
145
-
146
- > div
147
- margin-top: 1rem
148
- width: 58rem
149
- > a
150
- display: flex
151
- flex: 1 0 auto
152
- align-items: stretch
153
- line-height: 1.5
154
-
155
- &:hover, &:focus
156
- background-color: $dark-bg-light
157
- &:active
158
- background-color: $dark-bg-lighter
159
-
160
- &.challenger
161
- > div:first-child
162
- border-color: $challenger
163
- text-align: center
164
- &.outdated
165
- > div:first-child
166
- border-color: $outdated
167
- text-align: center
168
-
169
- > div
170
- padding: .5rem
171
-
172
- > :first-child
173
- width: 8rem
174
- border: 0 solid transparent
175
- border-left-width: 1rem
176
- font-size: 0.75rem
177
- display: flex
178
- align-items: center
179
-
180
- > :last-child
181
- display: flex
182
- flex: 1 0 auto
183
- width: 50rem
184
- align-items: center
185
-
186
- > :nth-child(1)
187
- flex-shrink: 0
188
- overflow: hidden
189
- text-overflow: ellipsis
190
- width: 15rem
191
- text-align: right
192
- > :nth-child(2)
193
- flex-shrink: 0
194
- padding: 0 1rem
195
- text-align: center
196
- width: 4rem
197
- > :nth-child(3)
198
-
199
- %body
200
- = yield
@@ -1,16 +0,0 @@
1
- .iframes
2
- %div
3
- %h2 Champion
4
- %iframe{ src: url_for(action: :show) }
5
- %div
6
- %h2 Challenger
7
- %iframe{ src: url_for(action: :show, view: :challenger) }
8
- .footer
9
- .info
10
- %div= @directory.controller_name
11
- %div= @directory.method
12
- %div= @directory.description
13
- .actions
14
- = link_to 'Index', url_for(action: :index), class: 'index btn'
15
- = button_to 'Reject', url_for(action: :reject), class: 'reject'
16
- = button_to 'Accept', url_for(action: :accept), class: 'accept'
@@ -1,29 +0,0 @@
1
- .iframes
2
- %div.w-100
3
- .directories
4
- - @directories.each do |dir|
5
- - body = capture do
6
- %div
7
- %div= dir.controller_name
8
- %div= dir.method
9
- %div= dir.description
10
- - if dir.challenger?
11
- = link_to({ action: :compare, id: dir }, class: 'challenger') do
12
- %div CHALLENGER
13
- = body
14
- - elsif dir.last_run < @latest_run
15
- = link_to({ action: :preview, id: dir }, class: 'outdated') do
16
- %div OUTDATED
17
- = body
18
- - else
19
- = link_to(action: :preview, id: dir) do
20
- %div
21
- = body
22
-
23
- .footer
24
- .info
25
- .actions
26
- - if @directories.any?{ |dir| dir.last_run < @latest_run }
27
- = button_to 'Remove Outdated', url_for(action: :destroy_outdated), method: :delete, class: 'reject'
28
- - if @directories.any?(&:challenger?)
29
- = button_to 'Accept All', url_for(action: :accept_all), method: :post, class: 'accept'
@@ -1,19 +0,0 @@
1
- .iframes
2
- %div.w-100
3
- %h2 Champion
4
- %iframe{ src: url_for(action: :show) }
5
- .footer
6
- .info
7
- %div= @directory.controller_name
8
- %div= @directory.method
9
- %div= @directory.description
10
- .actions
11
- = link_to 'Index', url_for(action: :index), class: 'index btn'
12
- - if @previous
13
- = link_to 'Previous', url_for(action: :preview, id: @previous), class: 'previous btn', disabled: true
14
- - else
15
- %span.previous.btn.disabled Previous
16
- - if @next
17
- = link_to 'Next', url_for(action: :preview, id: @next), class: 'next btn'
18
- - else
19
- %span.previous.btn.disabled Next