view_spec 0.0.0 → 0.0.1
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/LICENSE.txt +1 -1
- data/README.md +267 -24
- data/app/controllers/concerns/view_specs/preview_actions.rb +37 -0
- data/app/controllers/view_spec_previews_controller.rb +3 -0
- data/app/views/view_specs/_group.html.erb +56 -0
- data/app/views/view_specs/_scenario.html.erb +55 -0
- data/app/views/view_specs/_spec.html.erb +18 -0
- data/app/views/view_specs/group/_notes.html.erb +14 -0
- data/app/views/view_specs/group/_preview.html.erb +19 -0
- data/app/views/view_specs/group/_raw.html.erb +7 -0
- data/app/views/view_specs/group/_source.html.erb +7 -0
- data/app/views/view_specs/previews/index.html.erb +22 -0
- data/lib/view_spec/collection.rb +43 -0
- data/lib/view_spec/config.rb +26 -3
- data/lib/view_spec/context.rb +40 -0
- data/lib/view_spec/dsl/controller.rb +7 -2
- data/lib/view_spec/dsl/groups.rb +2 -2
- data/lib/view_spec/dsl/layout.rb +7 -1
- data/lib/view_spec/dsl/notes.rb +22 -0
- data/lib/view_spec/dsl/params.rb +25 -15
- data/lib/view_spec/dsl/preview.rb +25 -0
- data/lib/view_spec/dsl/scenarios.rb +6 -6
- data/lib/view_spec/dsl/tests.rb +18 -0
- data/lib/view_spec/dsl/title.rb +1 -1
- data/lib/view_spec/engine.rb +20 -1
- data/lib/view_spec/entry.rb +62 -0
- data/lib/view_spec/entry_collection.rb +11 -0
- data/lib/view_spec/error.rb +4 -0
- data/lib/view_spec/executable_proc.rb +32 -0
- data/lib/view_spec/executable_string.rb +23 -0
- data/lib/view_spec/group.rb +17 -13
- data/lib/view_spec/group_collection.rb +4 -0
- data/lib/view_spec/group_context.rb +10 -0
- data/lib/view_spec/group_preview.rb +52 -0
- data/lib/view_spec/markdown.rb +20 -0
- data/lib/view_spec/markdown_renderer.rb +13 -0
- data/lib/view_spec/minitest/tests.rb +27 -0
- data/lib/view_spec/note.rb +44 -0
- data/lib/view_spec/param.rb +12 -2
- data/lib/view_spec/param_set.rb +17 -11
- data/lib/view_spec/preview.rb +44 -0
- data/lib/view_spec/registry.rb +7 -23
- data/lib/view_spec/renderable.rb +8 -7
- data/lib/view_spec/scenario.rb +5 -49
- data/lib/view_spec/scenario_collection.rb +4 -0
- data/lib/view_spec/scenario_context.rb +11 -0
- data/lib/view_spec/scenario_preview.rb +30 -0
- data/lib/view_spec/source_file.rb +22 -0
- data/lib/view_spec/spec.rb +3 -13
- data/lib/view_spec/spec_collection.rb +7 -0
- data/lib/view_spec/spec_context.rb +11 -0
- data/lib/view_spec/test_case.rb +10 -0
- data/lib/view_spec/test_helpers.rb +23 -0
- data/lib/view_spec/types/symbol.rb +1 -1
- data/lib/view_spec/utils.rb +42 -1
- data/lib/view_spec/version.rb +1 -1
- data/lib/view_spec.rb +16 -2
- metadata +67 -15
- data/app/views/view_spec/_group.html.erb +0 -20
- data/app/views/view_spec/_scenario.html.erb +0 -17
- data/app/views/view_spec/_spec.html.erb +0 -10
- data/lib/view_spec/dsl/context.rb +0 -54
- data/lib/view_spec/dsl.rb +0 -18
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Perkins
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: zeitwerk
|
@@ -52,40 +51,95 @@ dependencies:
|
|
52
51
|
- - ">="
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '7.1'
|
55
|
-
|
56
|
-
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: method_source
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: redcarpet
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.6'
|
75
|
+
type: :runtime
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.6'
|
57
82
|
executables: []
|
58
83
|
extensions: []
|
59
84
|
extra_rdoc_files: []
|
60
85
|
files:
|
61
86
|
- LICENSE.txt
|
62
87
|
- README.md
|
63
|
-
- app/
|
64
|
-
- app/
|
65
|
-
- app/views/
|
88
|
+
- app/controllers/concerns/view_specs/preview_actions.rb
|
89
|
+
- app/controllers/view_spec_previews_controller.rb
|
90
|
+
- app/views/view_specs/_group.html.erb
|
91
|
+
- app/views/view_specs/_scenario.html.erb
|
92
|
+
- app/views/view_specs/_spec.html.erb
|
93
|
+
- app/views/view_specs/group/_notes.html.erb
|
94
|
+
- app/views/view_specs/group/_preview.html.erb
|
95
|
+
- app/views/view_specs/group/_raw.html.erb
|
96
|
+
- app/views/view_specs/group/_source.html.erb
|
97
|
+
- app/views/view_specs/previews/index.html.erb
|
66
98
|
- lib/view_spec.rb
|
99
|
+
- lib/view_spec/collection.rb
|
67
100
|
- lib/view_spec/config.rb
|
68
|
-
- lib/view_spec/
|
69
|
-
- lib/view_spec/dsl/context.rb
|
101
|
+
- lib/view_spec/context.rb
|
70
102
|
- lib/view_spec/dsl/controller.rb
|
71
103
|
- lib/view_spec/dsl/groups.rb
|
72
104
|
- lib/view_spec/dsl/layout.rb
|
105
|
+
- lib/view_spec/dsl/notes.rb
|
73
106
|
- lib/view_spec/dsl/params.rb
|
107
|
+
- lib/view_spec/dsl/preview.rb
|
74
108
|
- lib/view_spec/dsl/scenarios.rb
|
109
|
+
- lib/view_spec/dsl/tests.rb
|
75
110
|
- lib/view_spec/dsl/title.rb
|
76
111
|
- lib/view_spec/engine.rb
|
112
|
+
- lib/view_spec/entry.rb
|
113
|
+
- lib/view_spec/entry_collection.rb
|
77
114
|
- lib/view_spec/error.rb
|
115
|
+
- lib/view_spec/executable_proc.rb
|
116
|
+
- lib/view_spec/executable_string.rb
|
78
117
|
- lib/view_spec/group.rb
|
118
|
+
- lib/view_spec/group_collection.rb
|
119
|
+
- lib/view_spec/group_context.rb
|
120
|
+
- lib/view_spec/group_preview.rb
|
79
121
|
- lib/view_spec/helpers/spec_helper.rb
|
122
|
+
- lib/view_spec/markdown.rb
|
123
|
+
- lib/view_spec/markdown_renderer.rb
|
124
|
+
- lib/view_spec/minitest/tests.rb
|
125
|
+
- lib/view_spec/note.rb
|
80
126
|
- lib/view_spec/param.rb
|
81
127
|
- lib/view_spec/param_set.rb
|
128
|
+
- lib/view_spec/preview.rb
|
82
129
|
- lib/view_spec/registry.rb
|
83
130
|
- lib/view_spec/reloader.rb
|
84
131
|
- lib/view_spec/renderable.rb
|
85
132
|
- lib/view_spec/scenario.rb
|
133
|
+
- lib/view_spec/scenario_collection.rb
|
134
|
+
- lib/view_spec/scenario_context.rb
|
135
|
+
- lib/view_spec/scenario_preview.rb
|
86
136
|
- lib/view_spec/source_file.rb
|
87
137
|
- lib/view_spec/spec.rb
|
138
|
+
- lib/view_spec/spec_collection.rb
|
139
|
+
- lib/view_spec/spec_context.rb
|
88
140
|
- lib/view_spec/subject.rb
|
141
|
+
- lib/view_spec/test_case.rb
|
142
|
+
- lib/view_spec/test_helpers.rb
|
89
143
|
- lib/view_spec/type.rb
|
90
144
|
- lib/view_spec/types/boolean.rb
|
91
145
|
- lib/view_spec/types/date.rb
|
@@ -102,7 +156,6 @@ homepage: https://github.com/lookbook-hq/view_spec
|
|
102
156
|
licenses:
|
103
157
|
- MIT
|
104
158
|
metadata: {}
|
105
|
-
post_install_message:
|
106
159
|
rdoc_options: []
|
107
160
|
require_paths:
|
108
161
|
- lib
|
@@ -117,9 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
170
|
- !ruby/object:Gem::Version
|
118
171
|
version: '0'
|
119
172
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
173
|
+
rubygems_version: 3.6.8
|
122
174
|
specification_version: 4
|
123
|
-
summary: ViewSpec
|
124
|
-
|
175
|
+
summary: ViewSpec helps you develop, test and document the view layer of your Rails
|
176
|
+
app using example-led specifications written in an expressive Ruby DSL.
|
125
177
|
test_files: []
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%# locals: (group:) %>
|
2
|
-
|
3
|
-
<section style="padding: 20px; border: 1px solid #ccc; margin-bottom: 20px;">
|
4
|
-
<header>
|
5
|
-
<h2><%= group.title %></h2>
|
6
|
-
<p>Short identifier: <%= group.short_identifier %></p>
|
7
|
-
</header>
|
8
|
-
<div style="padding-left: 0px;">
|
9
|
-
<h4>Preview:</h4>
|
10
|
-
<div style="padding: 20px; border: 2px dotted #bbb;">
|
11
|
-
<% group.scenarios.each do |scenario| %>
|
12
|
-
<%= scenario.render_preview(params: request.query_parameters) %>
|
13
|
-
<% end %>
|
14
|
-
</div>
|
15
|
-
<h4>Output:</h4>
|
16
|
-
<code>
|
17
|
-
<pre style="padding: 10px; background-color: #eee; display: block;"><% group.scenarios.each do |scenario| -%><%= scenario.render_output(params: request.query_parameters) + "\n" %><% end %></pre>
|
18
|
-
</code>
|
19
|
-
</div>
|
20
|
-
</div>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%# locals: (scenario:) %>
|
2
|
-
|
3
|
-
<section style="padding: 20px; border: 1px solid #ccc; margin-bottom: 20px;">
|
4
|
-
<header>
|
5
|
-
<h2><%= scenario.title %></h2>
|
6
|
-
<p>Short identifier: <%= scenario.short_identifier %></p>
|
7
|
-
</header>
|
8
|
-
|
9
|
-
<h4>Preview:</h4>
|
10
|
-
<div style="padding: 20px; border: 2px dotted #bbb;">
|
11
|
-
<%= scenario.render_preview(params: request.query_parameters) %>
|
12
|
-
</div>
|
13
|
-
<h4>Output:</h4>
|
14
|
-
<code>
|
15
|
-
<pre style="padding: 10px; background-color: #eee; display: block;"><%= scenario.render_output(params: request.query_parameters) %></pre>
|
16
|
-
</code>
|
17
|
-
</section>
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module ViewSpec
|
2
|
-
module DSL
|
3
|
-
class Context
|
4
|
-
delegate :type, to: :class
|
5
|
-
|
6
|
-
def initialize(subject, lookup_attrs = {}, &block)
|
7
|
-
@subject = Subject.new(subject)
|
8
|
-
set_lookup_attrs(lookup_attrs.to_h)
|
9
|
-
@block = block
|
10
|
-
|
11
|
-
evaluate!
|
12
|
-
end
|
13
|
-
|
14
|
-
def entries
|
15
|
-
@entries ||= []
|
16
|
-
end
|
17
|
-
|
18
|
-
class << self
|
19
|
-
def type
|
20
|
-
@type ||= name.demodulize.underscore.to_sym
|
21
|
-
end
|
22
|
-
|
23
|
-
def lookup_attr(name)
|
24
|
-
lookup_attrs << name.to_sym
|
25
|
-
end
|
26
|
-
|
27
|
-
def lookup_attrs
|
28
|
-
@lookup_attrs ||= []
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def lookup_attrs
|
35
|
-
self.class.lookup_attrs.map do |key|
|
36
|
-
[key, public_send(key)]
|
37
|
-
end.to_h
|
38
|
-
end
|
39
|
-
|
40
|
-
def set_lookup_attrs(values_hash)
|
41
|
-
values_hash.each do |key, value|
|
42
|
-
public_send(key, value) if respond_to?(key)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def evaluate!
|
47
|
-
return if @evaluated
|
48
|
-
|
49
|
-
instance_exec(&@block) if @block
|
50
|
-
@evaluated = true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
data/lib/view_spec/dsl.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module ViewSpec
|
2
|
-
module DSL
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
class_methods do
|
6
|
-
def spec(subject, &block)
|
7
|
-
source_path = caller_locations(1..1).first.absolute_path
|
8
|
-
registry.add(source_path, subject, &block)
|
9
|
-
end
|
10
|
-
|
11
|
-
def registry
|
12
|
-
@registry ||= Registry.new
|
13
|
-
end
|
14
|
-
|
15
|
-
alias_method :specs, :registry
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|