specfactor 0.1.2
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 +7 -0
- data/.gitignore +11 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/specfac.iml +26 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +436 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/specfac +4 -0
- data/lib/spec_module.rb +180 -0
- data/lib/specfac/version.rb +3 -0
- data/lib/specfac.rb +84 -0
- data/pull_me.txt +1 -0
- data/specfac.gemspec +31 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 11ecd958de6de807c319e41ede9c9dd47eec3c9c1e24a684d6f6ef1b21c0b1c9
|
4
|
+
data.tar.gz: 854e657728672de8a1fae7023e35bedb68365a89da056972d2cd95ef523b2c2b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 299d41bdb187d634a3a62ac54ed35a055ba0d7c99631eefcf559250af44e095a1a932bb6beb1e5271f3660976075f9bfbc31c27f6efe3be30abcc4a33b2d8778
|
7
|
+
data.tar.gz: 0bd1bbe711de1ad5100afbbd118c72849294d3524b3e16c6162216a921fa0209a15ac7ae8e8259d1d9dd938dba14ba8e3eec6b21de0bc5439e3ce75afcbfd71d
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build specfac-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install specfac-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install specfac-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push specfac-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.4.4" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
data/.idea/specfac.iml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="inheritedJdk" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.1, RVM: ruby-2.4.4) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.3, RVM: ruby-2.4.4) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.5, RVM: ruby-2.4.4) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.4.4) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.1.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, RVM: ruby-2.4.4) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.1, RVM: ruby-2.4.4) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v0.20.0, RVM: ruby-2.4.4) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.4.4) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, RVM: ruby-2.4.4) [gem]" level="application" />
|
25
|
+
</component>
|
26
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,436 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="9c170d0c-08bf-4830-a863-b6dfc3a02d09" name="Default" comment="">
|
5
|
+
<change beforePath="$PROJECT_DIR$/lib/factory/spec_module.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/spec_module.rb" afterDir="false" />
|
6
|
+
<change beforePath="$PROJECT_DIR$/lib/specfac.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/specfac.rb" afterDir="false" />
|
7
|
+
</list>
|
8
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
9
|
+
<option name="TRACKING_ENABLED" value="true" />
|
10
|
+
<option name="SHOW_DIALOG" value="false" />
|
11
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
12
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
13
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
14
|
+
</component>
|
15
|
+
<component name="FileEditorManager">
|
16
|
+
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
17
|
+
<file leaf-file-name="specfac.gemspec" pinned="false" current-in-tab="false">
|
18
|
+
<entry file="file://$PROJECT_DIR$/specfac.gemspec">
|
19
|
+
<provider selected="true" editor-type-id="text-editor">
|
20
|
+
<state relative-caret-position="390">
|
21
|
+
<caret line="26" column="49" selection-start-line="26" selection-start-column="49" selection-end-line="26" selection-end-column="49" />
|
22
|
+
</state>
|
23
|
+
</provider>
|
24
|
+
</entry>
|
25
|
+
</file>
|
26
|
+
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
|
27
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
28
|
+
<provider selected="true" editor-type-id="text-editor">
|
29
|
+
<state relative-caret-position="120">
|
30
|
+
<caret line="8" column="18" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="18" />
|
31
|
+
</state>
|
32
|
+
</provider>
|
33
|
+
</entry>
|
34
|
+
</file>
|
35
|
+
<file leaf-file-name="specfac.rb" pinned="false" current-in-tab="true">
|
36
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac.rb">
|
37
|
+
<provider selected="true" editor-type-id="text-editor">
|
38
|
+
<state relative-caret-position="30">
|
39
|
+
<caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
|
40
|
+
</state>
|
41
|
+
</provider>
|
42
|
+
</entry>
|
43
|
+
</file>
|
44
|
+
<file leaf-file-name="yammos_controller_spec.rb" pinned="false" current-in-tab="false">
|
45
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/yammos_controller_spec.rb">
|
46
|
+
<provider selected="true" editor-type-id="text-editor" />
|
47
|
+
</entry>
|
48
|
+
</file>
|
49
|
+
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
50
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
51
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
52
|
+
<state split_layout="SPLIT">
|
53
|
+
<first_editor relative-caret-position="765">
|
54
|
+
<caret line="51" column="94" selection-start-line="51" selection-start-column="94" selection-end-line="51" selection-end-column="94" />
|
55
|
+
</first_editor>
|
56
|
+
<second_editor />
|
57
|
+
</state>
|
58
|
+
</provider>
|
59
|
+
</entry>
|
60
|
+
</file>
|
61
|
+
<file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
|
62
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac/version.rb">
|
63
|
+
<provider selected="true" editor-type-id="text-editor">
|
64
|
+
<state relative-caret-position="15">
|
65
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
66
|
+
</state>
|
67
|
+
</provider>
|
68
|
+
</entry>
|
69
|
+
</file>
|
70
|
+
<file leaf-file-name="spec_module.rb" pinned="false" current-in-tab="false">
|
71
|
+
<entry file="file://$PROJECT_DIR$/lib/spec_module.rb">
|
72
|
+
<provider selected="true" editor-type-id="text-editor">
|
73
|
+
<state relative-caret-position="312">
|
74
|
+
<caret line="37" column="29" selection-start-line="37" selection-start-column="29" selection-end-line="37" selection-end-column="29" />
|
75
|
+
</state>
|
76
|
+
</provider>
|
77
|
+
</entry>
|
78
|
+
</file>
|
79
|
+
</leaf>
|
80
|
+
</component>
|
81
|
+
<component name="FindInProjectRecents">
|
82
|
+
<findStrings>
|
83
|
+
<find>Walter</find>
|
84
|
+
<find>SpecModule</find>
|
85
|
+
</findStrings>
|
86
|
+
<replaceStrings>
|
87
|
+
<replace>Specfac</replace>
|
88
|
+
<replace>Utils</replace>
|
89
|
+
</replaceStrings>
|
90
|
+
</component>
|
91
|
+
<component name="Git.Settings">
|
92
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
93
|
+
</component>
|
94
|
+
<component name="IdeDocumentHistory">
|
95
|
+
<option name="CHANGED_PATHS">
|
96
|
+
<list>
|
97
|
+
<option value="$PROJECT_DIR$/exe/specfac" />
|
98
|
+
<option value="$PROJECT_DIR$/specfac.gemspec" />
|
99
|
+
<option value="$PROJECT_DIR$/.gitignore" />
|
100
|
+
<option value="$PROJECT_DIR$/README.md" />
|
101
|
+
<option value="$PROJECT_DIR$/lib/specfac/version.rb" />
|
102
|
+
<option value="$PROJECT_DIR$/lib/factory/spec_module.rb" />
|
103
|
+
<option value="$PROJECT_DIR$/lib/specfac.rb" />
|
104
|
+
</list>
|
105
|
+
</option>
|
106
|
+
</component>
|
107
|
+
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
108
|
+
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
109
|
+
<component name="JsGulpfileManager">
|
110
|
+
<detection-done>true</detection-done>
|
111
|
+
<sorting>DEFINITION_ORDER</sorting>
|
112
|
+
</component>
|
113
|
+
<component name="NodePackageJsonFileManager">
|
114
|
+
<packageJsonPaths />
|
115
|
+
</component>
|
116
|
+
<component name="ProjectFrameBounds">
|
117
|
+
<option name="y" value="23" />
|
118
|
+
<option name="width" value="1440" />
|
119
|
+
<option name="height" value="797" />
|
120
|
+
</component>
|
121
|
+
<component name="ProjectView">
|
122
|
+
<navigator proportions="" version="1">
|
123
|
+
<foldersAlwaysOnTop value="true" />
|
124
|
+
</navigator>
|
125
|
+
<panes>
|
126
|
+
<pane id="ProjectPane">
|
127
|
+
<subPane>
|
128
|
+
<expand>
|
129
|
+
<path>
|
130
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
131
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
132
|
+
</path>
|
133
|
+
<path>
|
134
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
135
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
136
|
+
<item name="exe" type="462c0819:PsiDirectoryNode" />
|
137
|
+
</path>
|
138
|
+
<path>
|
139
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
140
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
141
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
142
|
+
</path>
|
143
|
+
<path>
|
144
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
145
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
146
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
147
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
148
|
+
</path>
|
149
|
+
<path>
|
150
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
151
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
152
|
+
<item name="spec" type="462c0819:PsiDirectoryNode" />
|
153
|
+
</path>
|
154
|
+
<path>
|
155
|
+
<item name="specfac" type="b2602c69:ProjectViewProjectNode" />
|
156
|
+
<item name="specfac" type="462c0819:PsiDirectoryNode" />
|
157
|
+
<item name="spec" type="462c0819:PsiDirectoryNode" />
|
158
|
+
<item name="controllers" type="462c0819:PsiDirectoryNode" />
|
159
|
+
</path>
|
160
|
+
</expand>
|
161
|
+
<select />
|
162
|
+
</subPane>
|
163
|
+
</pane>
|
164
|
+
<pane id="Scope" />
|
165
|
+
</panes>
|
166
|
+
</component>
|
167
|
+
<component name="PropertiesComponent">
|
168
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
169
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
170
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
171
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
172
|
+
<property name="settings.editor.selected.configurable" value="configurable.group.build" />
|
173
|
+
</component>
|
174
|
+
<component name="RecentsManager">
|
175
|
+
<key name="MoveFile.RECENT_KEYS">
|
176
|
+
<recent name="$PROJECT_DIR$/lib" />
|
177
|
+
</key>
|
178
|
+
</component>
|
179
|
+
<component name="RunDashboard">
|
180
|
+
<option name="ruleStates">
|
181
|
+
<list>
|
182
|
+
<RuleState>
|
183
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
184
|
+
</RuleState>
|
185
|
+
<RuleState>
|
186
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
187
|
+
</RuleState>
|
188
|
+
</list>
|
189
|
+
</option>
|
190
|
+
</component>
|
191
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
192
|
+
<component name="SvnConfiguration">
|
193
|
+
<configuration />
|
194
|
+
</component>
|
195
|
+
<component name="TaskManager">
|
196
|
+
<task active="true" id="Default" summary="Default task">
|
197
|
+
<changelist id="9c170d0c-08bf-4830-a863-b6dfc3a02d09" name="Default" comment="" />
|
198
|
+
<created>1534450331409</created>
|
199
|
+
<option name="number" value="Default" />
|
200
|
+
<option name="presentableId" value="Default" />
|
201
|
+
<updated>1534450331409</updated>
|
202
|
+
<workItem from="1534450332680" duration="4232000" />
|
203
|
+
<workItem from="1534944836242" duration="417000" />
|
204
|
+
<workItem from="1534945842456" duration="1238000" />
|
205
|
+
<workItem from="1535055366512" duration="3097000" />
|
206
|
+
</task>
|
207
|
+
<servers />
|
208
|
+
</component>
|
209
|
+
<component name="TimeTrackingManager">
|
210
|
+
<option name="totallyTimeSpent" value="8984000" />
|
211
|
+
</component>
|
212
|
+
<component name="ToolWindowManager">
|
213
|
+
<frame x="0" y="23" width="1440" height="797" extended-state="0" />
|
214
|
+
<editor active="true" />
|
215
|
+
<layout>
|
216
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26037195" />
|
217
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
218
|
+
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
219
|
+
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
|
220
|
+
<window_info anchor="right" id="Database" order="3" />
|
221
|
+
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
|
222
|
+
<window_info anchor="bottom" id="Run" order="2" />
|
223
|
+
<window_info anchor="bottom" id="Version Control" order="7" />
|
224
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
225
|
+
<window_info anchor="bottom" id="Terminal" order="7" visible="true" />
|
226
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
227
|
+
<window_info id="Favorites" order="2" side_tool="true" />
|
228
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
229
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
230
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
231
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
232
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
233
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
234
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
235
|
+
</layout>
|
236
|
+
</component>
|
237
|
+
<component name="TypeScriptGeneratedFilesManager">
|
238
|
+
<option name="version" value="1" />
|
239
|
+
</component>
|
240
|
+
<component name="VcsContentAnnotationSettings">
|
241
|
+
<option name="myLimit" value="2678400000" />
|
242
|
+
</component>
|
243
|
+
<component name="editorHistoryManager">
|
244
|
+
<entry file="file://$PROJECT_DIR$/specfac.gemspec">
|
245
|
+
<provider selected="true" editor-type-id="text-editor">
|
246
|
+
<state relative-caret-position="390">
|
247
|
+
<caret line="26" column="49" selection-start-line="26" selection-start-column="49" selection-end-line="26" selection-end-column="49" />
|
248
|
+
</state>
|
249
|
+
</provider>
|
250
|
+
</entry>
|
251
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
252
|
+
<provider selected="true" editor-type-id="text-editor">
|
253
|
+
<state relative-caret-position="120">
|
254
|
+
<caret line="8" column="18" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="18" />
|
255
|
+
</state>
|
256
|
+
</provider>
|
257
|
+
</entry>
|
258
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac.rb">
|
259
|
+
<provider selected="true" editor-type-id="text-editor">
|
260
|
+
<state relative-caret-position="990">
|
261
|
+
<caret line="66" column="30" selection-start-line="66" selection-start-column="30" selection-end-line="66" selection-end-column="30" />
|
262
|
+
</state>
|
263
|
+
</provider>
|
264
|
+
</entry>
|
265
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
266
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
267
|
+
<state split_layout="SPLIT">
|
268
|
+
<first_editor relative-caret-position="765">
|
269
|
+
<caret line="51" column="94" selection-start-line="51" selection-start-column="94" selection-end-line="51" selection-end-column="94" />
|
270
|
+
</first_editor>
|
271
|
+
<second_editor />
|
272
|
+
</state>
|
273
|
+
</provider>
|
274
|
+
</entry>
|
275
|
+
<entry file="file://$PROJECT_DIR$/lib/spec_module.rb">
|
276
|
+
<provider selected="true" editor-type-id="text-editor">
|
277
|
+
<state relative-caret-position="2700">
|
278
|
+
<caret line="180" selection-start-line="180" selection-end-line="180" />
|
279
|
+
</state>
|
280
|
+
</provider>
|
281
|
+
</entry>
|
282
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac/version.rb">
|
283
|
+
<provider selected="true" editor-type-id="text-editor">
|
284
|
+
<state relative-caret-position="15">
|
285
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
286
|
+
</state>
|
287
|
+
</provider>
|
288
|
+
</entry>
|
289
|
+
<entry file="file://$PROJECT_DIR$/specfac.gemspec">
|
290
|
+
<provider selected="true" editor-type-id="text-editor">
|
291
|
+
<state relative-caret-position="390">
|
292
|
+
<caret line="26" column="49" selection-start-line="26" selection-start-column="49" selection-end-line="26" selection-end-column="49" />
|
293
|
+
</state>
|
294
|
+
</provider>
|
295
|
+
</entry>
|
296
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
297
|
+
<provider selected="true" editor-type-id="text-editor">
|
298
|
+
<state relative-caret-position="120">
|
299
|
+
<caret line="8" column="18" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="18" />
|
300
|
+
</state>
|
301
|
+
</provider>
|
302
|
+
</entry>
|
303
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac.rb">
|
304
|
+
<provider selected="true" editor-type-id="text-editor">
|
305
|
+
<state relative-caret-position="990">
|
306
|
+
<caret line="66" column="30" selection-start-line="66" selection-start-column="30" selection-end-line="66" selection-end-column="30" />
|
307
|
+
</state>
|
308
|
+
</provider>
|
309
|
+
</entry>
|
310
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/yoddels_controller_spec.rb" />
|
311
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/robots_controller_spec.rb" />
|
312
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/rabbits_controller_spec.rb" />
|
313
|
+
<entry file="file://$PROJECT_DIR$/spec/spec_helper.rb" />
|
314
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/tests_controller_spec.rb" />
|
315
|
+
<entry file="file://$PROJECT_DIR$/lib/spec_module.rb">
|
316
|
+
<provider selected="true" editor-type-id="text-editor">
|
317
|
+
<state relative-caret-position="2700">
|
318
|
+
<caret line="180" selection-start-line="180" selection-end-line="180" />
|
319
|
+
</state>
|
320
|
+
</provider>
|
321
|
+
</entry>
|
322
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
323
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
324
|
+
<state split_layout="SPLIT">
|
325
|
+
<first_editor relative-caret-position="765">
|
326
|
+
<caret line="51" column="94" selection-start-line="51" selection-start-column="94" selection-end-line="51" selection-end-column="94" />
|
327
|
+
</first_editor>
|
328
|
+
<second_editor />
|
329
|
+
</state>
|
330
|
+
</provider>
|
331
|
+
</entry>
|
332
|
+
<entry file="file://$PROJECT_DIR$/specfac.gemspec">
|
333
|
+
<provider selected="true" editor-type-id="text-editor">
|
334
|
+
<state relative-caret-position="390">
|
335
|
+
<caret line="26" column="49" selection-start-line="26" selection-start-column="49" selection-end-line="26" selection-end-column="49" />
|
336
|
+
</state>
|
337
|
+
</provider>
|
338
|
+
</entry>
|
339
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
340
|
+
<provider selected="true" editor-type-id="text-editor">
|
341
|
+
<state relative-caret-position="120">
|
342
|
+
<caret line="8" column="18" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="18" />
|
343
|
+
</state>
|
344
|
+
</provider>
|
345
|
+
</entry>
|
346
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac.rb">
|
347
|
+
<provider selected="true" editor-type-id="text-editor">
|
348
|
+
<state relative-caret-position="990">
|
349
|
+
<caret line="66" column="30" selection-start-line="66" selection-start-column="30" selection-end-line="66" selection-end-column="30" />
|
350
|
+
</state>
|
351
|
+
</provider>
|
352
|
+
</entry>
|
353
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/yoddels_controller_spec.rb" />
|
354
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/robots_controller_spec.rb" />
|
355
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/rabbits_controller_spec.rb" />
|
356
|
+
<entry file="file://$PROJECT_DIR$/spec/spec_helper.rb" />
|
357
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/tests_controller_spec.rb" />
|
358
|
+
<entry file="file://$PROJECT_DIR$/lib/spec_module.rb">
|
359
|
+
<provider selected="true" editor-type-id="text-editor">
|
360
|
+
<state relative-caret-position="2700">
|
361
|
+
<caret line="180" selection-start-line="180" selection-end-line="180" />
|
362
|
+
</state>
|
363
|
+
</provider>
|
364
|
+
</entry>
|
365
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
366
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
367
|
+
<state split_layout="SPLIT">
|
368
|
+
<first_editor relative-caret-position="615">
|
369
|
+
<caret line="41" column="21" selection-start-line="41" selection-start-column="21" selection-end-line="41" selection-end-column="21" />
|
370
|
+
</first_editor>
|
371
|
+
<second_editor />
|
372
|
+
</state>
|
373
|
+
</provider>
|
374
|
+
</entry>
|
375
|
+
<entry file="file://$PROJECT_DIR$/exe/specfac">
|
376
|
+
<provider selected="true" editor-type-id="text-editor">
|
377
|
+
<state relative-caret-position="45">
|
378
|
+
<caret line="3" column="7" selection-start-line="3" selection-start-column="7" selection-end-line="3" selection-end-column="7" />
|
379
|
+
</state>
|
380
|
+
</provider>
|
381
|
+
</entry>
|
382
|
+
<entry file="file://$PROJECT_DIR$/specfac.gemspec">
|
383
|
+
<provider selected="true" editor-type-id="text-editor">
|
384
|
+
<state relative-caret-position="390">
|
385
|
+
<caret line="26" column="49" selection-start-line="26" selection-start-column="49" selection-end-line="26" selection-end-column="49" />
|
386
|
+
</state>
|
387
|
+
</provider>
|
388
|
+
</entry>
|
389
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
390
|
+
<provider selected="true" editor-type-id="text-editor">
|
391
|
+
<state relative-caret-position="120">
|
392
|
+
<caret line="8" column="18" selection-start-line="8" selection-start-column="18" selection-end-line="8" selection-end-column="18" />
|
393
|
+
</state>
|
394
|
+
</provider>
|
395
|
+
</entry>
|
396
|
+
<entry file="file://$PROJECT_DIR$/spec/spec_helper.rb" />
|
397
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/tests_controller_spec.rb" />
|
398
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/rabbits_controller_spec.rb" />
|
399
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/robots_controller_spec.rb" />
|
400
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/yoddels_controller_spec.rb" />
|
401
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
402
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
403
|
+
<state split_layout="SPLIT">
|
404
|
+
<first_editor relative-caret-position="765">
|
405
|
+
<caret line="51" column="94" selection-start-line="51" selection-start-column="94" selection-end-line="51" selection-end-column="94" />
|
406
|
+
</first_editor>
|
407
|
+
<second_editor />
|
408
|
+
</state>
|
409
|
+
</provider>
|
410
|
+
</entry>
|
411
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac/version.rb">
|
412
|
+
<provider selected="true" editor-type-id="text-editor">
|
413
|
+
<state relative-caret-position="15">
|
414
|
+
<caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
|
415
|
+
</state>
|
416
|
+
</provider>
|
417
|
+
</entry>
|
418
|
+
<entry file="file://$PROJECT_DIR$/lib/spec_module.rb">
|
419
|
+
<provider selected="true" editor-type-id="text-editor">
|
420
|
+
<state relative-caret-position="312">
|
421
|
+
<caret line="37" column="29" selection-start-line="37" selection-start-column="29" selection-end-line="37" selection-end-column="29" />
|
422
|
+
</state>
|
423
|
+
</provider>
|
424
|
+
</entry>
|
425
|
+
<entry file="file://$PROJECT_DIR$/spec/controllers/yammos_controller_spec.rb">
|
426
|
+
<provider selected="true" editor-type-id="text-editor" />
|
427
|
+
</entry>
|
428
|
+
<entry file="file://$PROJECT_DIR$/lib/specfac.rb">
|
429
|
+
<provider selected="true" editor-type-id="text-editor">
|
430
|
+
<state relative-caret-position="30">
|
431
|
+
<caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
|
432
|
+
</state>
|
433
|
+
</provider>
|
434
|
+
</entry>
|
435
|
+
</component>
|
436
|
+
</project>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
specfactor (0.1.2)
|
5
|
+
activesupport (~> 5.2.0)
|
6
|
+
thor (~> 0.20)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.2.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
concurrent-ruby (1.0.5)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
i18n (1.1.0)
|
19
|
+
concurrent-ruby (~> 1.0)
|
20
|
+
minitest (5.11.3)
|
21
|
+
rake (10.5.0)
|
22
|
+
rspec (3.8.0)
|
23
|
+
rspec-core (~> 3.8.0)
|
24
|
+
rspec-expectations (~> 3.8.0)
|
25
|
+
rspec-mocks (~> 3.8.0)
|
26
|
+
rspec-core (3.8.0)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-expectations (3.8.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-mocks (3.8.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-support (3.8.0)
|
35
|
+
thor (0.20.0)
|
36
|
+
thread_safe (0.3.6)
|
37
|
+
tzinfo (1.2.5)
|
38
|
+
thread_safe (~> 0.1)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.16)
|
45
|
+
rake (~> 10.0)
|
46
|
+
rspec (~> 3.0)
|
47
|
+
specfactor!
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.16.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 viktharien
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Specfactor
|
2
|
+
|
3
|
+
Specfactor is a gem that generates commonly used tests for commonly used controller actions.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Specfactor is dependent on these gems:
|
8
|
+
|
9
|
+
rspec-rails
|
10
|
+
activesupport
|
11
|
+
factory_bot_rails
|
12
|
+
|
13
|
+
Provided you are developing on Rails, activesupport should be included by default.
|
14
|
+
Specfactor generates tests that utilize factories, and so FactoryBot is recommended. Otherwise, simply comment out/delete parts of the tests you don't want to use.
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'specfactor'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install specfactor
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
In terminal, type:
|
33
|
+
|
34
|
+
specfac [controller] [actions]
|
35
|
+
|
36
|
+
__[controller]__ should be the name of the controller you'd like to generate tests for
|
37
|
+
|
38
|
+
__[actions]__ should be the names of methods to be generated
|
39
|
+
|
40
|
+
An example usage for specific tests:
|
41
|
+
|
42
|
+
specfac generate participants index show
|
43
|
+
|
44
|
+
An example for all available tests:
|
45
|
+
|
46
|
+
specfac generate participants ALL
|
47
|
+
|
48
|
+
Currently, tests can be generated for :index, :show, :new, :create, :edit, :update, and :destroy.
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/viktharien/specfacthor.
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "specfac"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/specfac
ADDED
data/lib/spec_module.rb
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext/string'
|
3
|
+
|
4
|
+
module Utils
|
5
|
+
@@term = nil
|
6
|
+
|
7
|
+
def self.define_utils_methods_params(term)
|
8
|
+
@@term = term
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.si
|
12
|
+
Utils.singularize(@@term)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.si_ca
|
16
|
+
Utils.singularize(@@term.capitalize)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.pl
|
20
|
+
Utils.pluralize(@@term)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.pluralize(string)
|
24
|
+
return ActiveSupport::Inflector.pluralize(string)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.singularize(string)
|
28
|
+
return ActiveSupport::Inflector.singularize(string)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
module SpecModule
|
33
|
+
include Utils
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def self.index
|
38
|
+
"describe 'GET #index' do
|
39
|
+
it 'returns http success' do
|
40
|
+
get :index
|
41
|
+
expect(response).to have_http_status(:success)
|
42
|
+
end
|
43
|
+
it 'assigns @#{Utils.pl} to #{Utils.si_ca}.all' do
|
44
|
+
#{Utils.si} = create(:#{Utils.si})
|
45
|
+
get :index
|
46
|
+
expect(assigns(:#{Utils.pl})).to eq([#{Utils.si}])
|
47
|
+
end
|
48
|
+
end"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.show
|
52
|
+
"describe 'GET #show' do
|
53
|
+
it 'returns http success' do
|
54
|
+
#{Utils.si} = create(:#{Utils.si})
|
55
|
+
get :show, params: {id: #{Utils.si}.to_param}
|
56
|
+
expect(response).to have_http_status(:success)
|
57
|
+
end
|
58
|
+
it 'assigns @#{Utils.si} to a #{Utils.si_ca}' do
|
59
|
+
#{Utils.si} = create(:#{Utils.si})
|
60
|
+
get :show, params: {id: #{Utils.si}.to_param}
|
61
|
+
expect(assigns(:#{Utils.si})).to eq(#{Utils.si})
|
62
|
+
end
|
63
|
+
end"
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.new
|
67
|
+
"describe 'GET #new' do
|
68
|
+
it 'returns http success' do
|
69
|
+
get :new
|
70
|
+
expect(response).to have_http_status(:success)
|
71
|
+
end
|
72
|
+
it 'assigns @#{Utils.si} to a new #{Utils.si_ca}' do
|
73
|
+
#{Utils.si} = create(:#{Utils.si})
|
74
|
+
get :new, params: {id: #{Utils.si}.to_param}
|
75
|
+
expect(assigns(:#{Utils.si})).to be_a_new(#{Utils.si_ca})
|
76
|
+
end
|
77
|
+
end"
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.create
|
81
|
+
"describe 'POST #create' do
|
82
|
+
let(:#{Utils.si}) {create(:#{Utils.si})}
|
83
|
+
let(:valid_attributes) { attributes_for(:#{Utils.si} )}
|
84
|
+
let(:invalid_attributes) { attributes_for(:invalid_#{Utils.si}_attrs)}
|
85
|
+
it 'creates a new #{Utils.si}' do
|
86
|
+
expect{
|
87
|
+
post :create, params: {#{Utils.si}: valid_attributes}
|
88
|
+
}.to change(#{Utils.si_ca}, :count).by(1)
|
89
|
+
end
|
90
|
+
it 'redirects on save' do
|
91
|
+
post :create, params: {#{Utils.si}: valid_attributes}
|
92
|
+
expect(response).to redirect_to(#{Utils.pl}_path)
|
93
|
+
end
|
94
|
+
it 'renders a flash message on save' do
|
95
|
+
post :create, params: {#{Utils.si}: valid_attributes}
|
96
|
+
expect(flash[:notice]).to be_present
|
97
|
+
end
|
98
|
+
it 'fails to create a new #{Utils.si}' do
|
99
|
+
expect(build(:invalid_#{Utils.si}_attrs)).to be_invalid
|
100
|
+
end
|
101
|
+
it 'redirects to new template on failure to save new #{Utils.si}' do
|
102
|
+
post :create, params: {#{Utils.si}: invalid_attributes}
|
103
|
+
expect(response).to redirect_to(new_#{Utils.si}_path)
|
104
|
+
end
|
105
|
+
end"
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.edit
|
109
|
+
"describe 'GET #edit' do
|
110
|
+
it 'returns http success' do
|
111
|
+
#{Utils.si} = create(:#{Utils.si})
|
112
|
+
get :edit, params: {id: #{Utils.si}.to_param}
|
113
|
+
expect(response).to have_http_status(:success)
|
114
|
+
end
|
115
|
+
it 'assigns @#{Utils.si} to a #{Utils.si_ca}' do
|
116
|
+
#{Utils.si} = create(:#{Utils.si})
|
117
|
+
get :edit, params: {id: #{Utils.si}.to_param}
|
118
|
+
expect(assigns(:#{Utils.si})).to eq(#{Utils.si})
|
119
|
+
end
|
120
|
+
end"
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.update
|
124
|
+
"describe 'POST #update' do
|
125
|
+
let(:#{Utils.si}) {create(:#{Utils.si})}
|
126
|
+
let(:valid_attributes) { attributes_for(:#{Utils.si} )}
|
127
|
+
let(:new_attributes) { attributes_for(:updated_#{Utils.si})}
|
128
|
+
let(:invalid_attributes) { attributes_for(:invalid_#{Utils.si}_attrs)}
|
129
|
+
it 'updates attributes for #{Utils.si}' do
|
130
|
+
patch :update, params: {id: #{Utils.si}.to_param,#{Utils.si}: new_attributes}
|
131
|
+
#{Utils.si}.reload
|
132
|
+
# expect(#{Utils.si}.name).to eq('test2')
|
133
|
+
# expect(#{Utils.si}.points).to eq(800)
|
134
|
+
end
|
135
|
+
it 'redirects on update' do
|
136
|
+
patch :update, params: {id: #{Utils.si}.to_param,#{Utils.si}: new_attributes}
|
137
|
+
expect(response).to redirect_to(#{Utils.si}s_path)
|
138
|
+
end
|
139
|
+
it 'renders a flash message on update' do
|
140
|
+
patch :update, params: {id: #{Utils.si}.to_param,#{Utils.si}: new_attributes}
|
141
|
+
expect(flash[:notice]).to be_present
|
142
|
+
end
|
143
|
+
it 'renders a flash message on failure to update' do
|
144
|
+
patch :update, params: {id: #{Utils.si}.to_param,#{Utils.si}: invalid_attributes}
|
145
|
+
expect(flash[:alert]).to be_present
|
146
|
+
end
|
147
|
+
it 'fails to update #{Utils.si}' do
|
148
|
+
expect(build(:invalid_#{Utils.si}_attrs)).to be_invalid
|
149
|
+
end
|
150
|
+
it 'redirects to edit template on failure to update #{Utils.si}' do
|
151
|
+
patch :update, params: {id: #{Utils.si}.to_param,#{Utils.si}: invalid_attributes}
|
152
|
+
expect(response).to redirect_to(edit_#{Utils.si}_path(#{Utils.si}))
|
153
|
+
end
|
154
|
+
end"
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.destroy
|
158
|
+
"describe 'DELETE #destroy' do
|
159
|
+
let(:#{Utils.si}) {build(:#{Utils.si})}
|
160
|
+
it 'destroys a #{Utils.si}' do
|
161
|
+
#{Utils.si}.save
|
162
|
+
expect {
|
163
|
+
delete :destroy, params: {id: #{Utils.si}.to_param }
|
164
|
+
}.to change(#{Utils.si_ca}, :count).by(-1)
|
165
|
+
end
|
166
|
+
it 'renders a flash message after delete' do
|
167
|
+
#{Utils.si}.save
|
168
|
+
delete :destroy, params: {id: #{Utils.si}.to_param }
|
169
|
+
expect(flash[:notice]).to be_present
|
170
|
+
end
|
171
|
+
it 'redirects to #{Utils.si}s_path after destroy' do
|
172
|
+
#{Utils.si}.save
|
173
|
+
delete :destroy, params: {id: #{Utils.si}.to_param }
|
174
|
+
expect(response).to redirect_to(#{Utils.si}s_path)
|
175
|
+
end
|
176
|
+
end"
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
end
|
data/lib/specfac.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'specfac'
|
2
|
+
require 'thor'
|
3
|
+
require 'spec_module'
|
4
|
+
module SpecFac
|
5
|
+
class CLI < Thor
|
6
|
+
include Utils
|
7
|
+
include SpecModule
|
8
|
+
attr_accessor :dir_controllers, :dir_factories, :working_dirs, :working_file, :protected_methods, :available_methods, :found_methods
|
9
|
+
|
10
|
+
######### AVAILABLE COMMANDS
|
11
|
+
desc "generate [controller] [actions]", "generates tests for specified actions"
|
12
|
+
def generate(*args)
|
13
|
+
@working_dirs = ["spec", "controllers", "factories"]
|
14
|
+
@dir_controllers = "#{@working_dirs[0]}/#{@working_dirs[1]}"
|
15
|
+
@dir_factories = "#{@working_dirs[0]}/#{@working_dirs[2]}"
|
16
|
+
# @protected_methods = %w(define_utils_methods_params si si_ca pl)
|
17
|
+
@found_methods = SpecModule.methods(false).to_a.map {|item| item.to_s}
|
18
|
+
@available_methods = @found_methods # @found_methods - @protected_methods
|
19
|
+
@working_file = nil
|
20
|
+
|
21
|
+
controller = args.shift
|
22
|
+
actions = args
|
23
|
+
sanitize(controller, actions)
|
24
|
+
end
|
25
|
+
|
26
|
+
######## UTILITY METHODS
|
27
|
+
#
|
28
|
+
|
29
|
+
no_commands do
|
30
|
+
def create_directories(*dirs)
|
31
|
+
dirs.each {|dir| Dir.mkdir(dir) if !Dir.exists?(dir) }
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def pull_src(controller, actions)
|
36
|
+
create_directories(@working_dirs[0], @dir_controllers, @dir_factories)
|
37
|
+
@working_file = "#{@dir_controllers}/#{controller.downcase}_controller_spec.rb"
|
38
|
+
# Header stuff
|
39
|
+
|
40
|
+
opener(
|
41
|
+
"header",
|
42
|
+
["require 'rails_helper'","RSpec.describe #{controller.capitalize}Controller, type: :controller do"]
|
43
|
+
)
|
44
|
+
# p actions
|
45
|
+
Utils.define_utils_methods_params(controller)
|
46
|
+
actions != nil ? actions.each {|action| opener("body", SpecModule.public_send(action.to_sym))} : nil
|
47
|
+
opener("end", "end")
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def opener(mode, lines)
|
52
|
+
filer = lambda {|type, output| File.open(@working_file, type) { |handle| handle.puts output}}
|
53
|
+
if mode == "header"
|
54
|
+
filer.call("w", nil)
|
55
|
+
lines.each do |item|
|
56
|
+
filer.call("a", item)
|
57
|
+
end
|
58
|
+
else
|
59
|
+
filer.call("a", lines)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def sanitize(controller, actions)
|
64
|
+
|
65
|
+
rem = "_controller"
|
66
|
+
if controller.include? "_controller"
|
67
|
+
controller.gsub!(rem, "")
|
68
|
+
# puts controller
|
69
|
+
end
|
70
|
+
if actions.include?("ALL")
|
71
|
+
matched_actions = @available_methods
|
72
|
+
else
|
73
|
+
matched_actions = []
|
74
|
+
actions.each {|action| matched_actions << action if @available_methods.include?(action)}
|
75
|
+
end
|
76
|
+
|
77
|
+
# p matched_actions
|
78
|
+
pull_src(controller, matched_actions)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
data/pull_me.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/specfac.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "specfac/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "specfactor"
|
8
|
+
spec.version = Specfac::VERSION
|
9
|
+
spec.authors = ["viktharien"]
|
10
|
+
spec.email = ["viktharien@zoho.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Specfac is short for SpecFactor, a CLI for generating rspec controller tests}
|
13
|
+
spec.homepage = "https://github.com/viktharien/specfacthor"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
spec.add_dependency "thor", "~> 0.20"
|
27
|
+
spec.add_dependency "activesupport", "~> 5.2.0"
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: specfactor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- viktharien
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.20'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.20'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- viktharien@zoho.com
|
86
|
+
executables:
|
87
|
+
- specfac
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".idea/.rakeTasks"
|
93
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
94
|
+
- ".idea/misc.xml"
|
95
|
+
- ".idea/modules.xml"
|
96
|
+
- ".idea/specfac.iml"
|
97
|
+
- ".idea/vcs.xml"
|
98
|
+
- ".idea/workspace.xml"
|
99
|
+
- ".rspec"
|
100
|
+
- ".travis.yml"
|
101
|
+
- Gemfile
|
102
|
+
- Gemfile.lock
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- bin/console
|
107
|
+
- bin/setup
|
108
|
+
- exe/specfac
|
109
|
+
- lib/spec_module.rb
|
110
|
+
- lib/specfac.rb
|
111
|
+
- lib/specfac/version.rb
|
112
|
+
- pull_me.txt
|
113
|
+
- specfac.gemspec
|
114
|
+
homepage: https://github.com/viktharien/specfacthor
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.7.7
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Specfac is short for SpecFactor, a CLI for generating rspec controller tests
|
138
|
+
test_files: []
|