turbolog 0.1.4 → 0.1.5

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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.idea/workspace.xml +29 -24
  4. data/.rspec +3 -0
  5. data/Gemfile.lock +18 -56
  6. data/lib/generators/turbolog/config_generator.rb +37 -17
  7. data/lib/generators/turbolog/install_generator.rb +3 -0
  8. data/lib/generators/turbolog/templates/.gitignore +20 -0
  9. data/lib/generators/turbolog/templates/.rspec +2 -0
  10. data/lib/generators/turbolog/templates/app/models/user.rb +12 -0
  11. data/lib/generators/turbolog/templates/application_controller_spec.rb +8 -0
  12. data/lib/generators/turbolog/templates/lib/string_calculator.rb +12 -0
  13. data/lib/generators/turbolog/templates/routes.rb +6 -0
  14. data/lib/generators/turbolog/templates/spec/controllers/welcomes_controller_spec.rb +86 -0
  15. data/lib/generators/turbolog/templates/spec/factories/users.rb +15 -0
  16. data/lib/generators/turbolog/templates/spec/factories/welcomes.rb +5 -0
  17. data/lib/generators/turbolog/templates/spec/helpers/welcomes_helper_spec.rb +23 -0
  18. data/lib/generators/turbolog/templates/spec/models/welcome_spec.rb +17 -0
  19. data/lib/generators/turbolog/templates/spec/rails_helper.rb +23 -0
  20. data/lib/generators/turbolog/templates/spec/requests/welcomes_spec.rb +16 -0
  21. data/lib/generators/turbolog/templates/spec/spec_helper.rb +96 -0
  22. data/lib/generators/turbolog/templates/spec/support/controller_helper.rb +12 -0
  23. data/lib/generators/turbolog/templates/spec/support/database_cleaner.rb +73 -0
  24. data/lib/generators/turbolog/templates/spec/support/devise.rb +8 -0
  25. data/lib/generators/turbolog/templates/spec/welcomes_controller_spec.rb +86 -0
  26. data/lib/turbolog/version.rb +1 -1
  27. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd61a126d6148675a63f3cb58344bbf80a088fb23319ffd5988b76df3ccd88be
4
- data.tar.gz: 6f09b35340fac83fab2e98dadb8c89a918dab85aa4065b6248dcaf0339e21fe6
3
+ metadata.gz: 7a69e7818940e9d6eb4988cc7c525c30ae2c705d67abdc4afa2fb58003826888
4
+ data.tar.gz: 19915c2451e2e233400ace8779a2210f2313e1af81470a206f04475d86f809f7
5
5
  SHA512:
6
- metadata.gz: 8b10137b081e8b7f0cd31d5dd984c19646cffc97289f7a63e0d22518055227fc3cfd19aa860a0eda2b8235185a7684dd28391b918d0cf1139d78c6be7c9216d7
7
- data.tar.gz: 625ff8d389c37299e2714c0eccb273ebdd0e96e383bce7bf62a4d3836a06cf827318e73fe272da227241491a74a67a6bf4fe0e0b41fa99dc641eec1a7a69e5c6
6
+ metadata.gz: 2d069a261ce4284802038940c005222fa737e56205a8612930153a2cc2a5825b8f12ec4fd6a66eb38cfb0f6a2bdb45e6f28b33b4599fa44c7bee96d54ae146f4
7
+ data.tar.gz: e8bc2e65111d6bf3f32957149a10017c438b4c0cf6a9a878a7e8f8e943f6605b495daab6c43fbeb412457c6215bdd2a6034a77741503b3f00d6ea70470579bc9
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /lib/turbolog/templates/.env
10
+
data/.idea/workspace.xml CHANGED
@@ -1,12 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
- <list default="true" id="103acaee-3a49-4b33-9f69-7529104273a3" name="Default" comment="">
5
- <change beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
6
- <change beforePath="$PROJECT_DIR$/lib/turbolog.rb" afterPath="$PROJECT_DIR$/lib/turbolog.rb" />
7
- <change beforePath="$PROJECT_DIR$/spec/turbolog_spec.rb" afterPath="$PROJECT_DIR$/spec/turbolog_spec.rb" />
8
- <change beforePath="$PROJECT_DIR$/turbolog.gemspec" afterPath="$PROJECT_DIR$/turbolog.gemspec" />
9
- </list>
4
+ <list default="true" id="103acaee-3a49-4b33-9f69-7529104273a3" name="Default" comment="" />
10
5
  <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
11
6
  <option name="TRACKING_ENABLED" value="true" />
12
7
  <option name="SHOW_DIALOG" value="false" />
@@ -18,12 +13,12 @@
18
13
  <SUITE FILE_PATH="coverage/turbolog@turbolog.coverage" NAME="turbolog Coverage Results" MODIFIED="1518103961523" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/tasks" MODULE_NAME="turbolog" />
19
14
  </component>
20
15
  <component name="FileEditorManager">
21
- <leaf>
16
+ <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
22
17
  <file leaf-file-name="turbolog.rake" pinned="false" current-in-tab="true">
23
18
  <entry file="file://$PROJECT_DIR$/lib/tasks/turbolog.rake">
24
19
  <provider selected="true" editor-type-id="text-editor">
25
- <state relative-caret-position="60">
26
- <caret line="4" column="22" lean-forward="false" selection-start-line="4" selection-start-column="22" selection-end-line="4" selection-end-column="22" />
20
+ <state relative-caret-position="90">
21
+ <caret line="6" column="21" lean-forward="false" selection-start-line="6" selection-start-column="21" selection-end-line="6" selection-end-column="21" />
27
22
  <folding />
28
23
  </state>
29
24
  </provider>
@@ -68,6 +63,8 @@
68
63
  <foldersAlwaysOnTop value="true" />
69
64
  </navigator>
70
65
  <panes>
66
+ <pane id="Scratches" />
67
+ <pane id="Scope" />
71
68
  <pane id="ProjectPane">
72
69
  <subPane>
73
70
  <expand>
@@ -90,8 +87,6 @@
90
87
  <select />
91
88
  </subPane>
92
89
  </pane>
93
- <pane id="Scratches" />
94
- <pane id="Scope" />
95
90
  </panes>
96
91
  </component>
97
92
  <component name="PropertiesComponent">
@@ -152,32 +147,34 @@
152
147
  <option name="presentableId" value="Default" />
153
148
  <updated>1518041171796</updated>
154
149
  <workItem from="1518041173110" duration="1010000" />
150
+ <workItem from="1518295185190" duration="24000" />
155
151
  </task>
156
152
  <servers />
157
153
  </component>
158
154
  <component name="TimeTrackingManager">
159
- <option name="totallyTimeSpent" value="1010000" />
155
+ <option name="totallyTimeSpent" value="1034000" />
160
156
  </component>
161
157
  <component name="ToolWindowManager">
162
158
  <frame x="498" y="-1038" width="979" height="662" extended-state="0" />
159
+ <editor active="true" />
163
160
  <layout>
164
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2497332" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
161
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25506938" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
165
162
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
166
- <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
167
- <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
168
- <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
163
+ <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
164
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
165
+ <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
166
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
169
167
  <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32911393" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
170
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
171
168
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
172
- <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290441" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
169
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290441" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
170
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
173
171
  <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39889705" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
174
- <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
175
172
  <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
176
- <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
177
173
  <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
178
174
  <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
179
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
180
175
  <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
176
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
177
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
181
178
  <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
182
179
  </layout>
183
180
  </component>
@@ -192,7 +189,7 @@
192
189
  <breakpoints>
193
190
  <line-breakpoint enabled="true" type="ruby-line">
194
191
  <url>file://$PROJECT_DIR$/lib/tasks/turbolog.rake</url>
195
- <line>14</line>
192
+ <line>16</line>
196
193
  </line-breakpoint>
197
194
  </breakpoints>
198
195
  <option name="time" value="1" />
@@ -202,8 +199,16 @@
202
199
  <component name="editorHistoryManager">
203
200
  <entry file="file://$PROJECT_DIR$/lib/tasks/turbolog.rake">
204
201
  <provider selected="true" editor-type-id="text-editor">
205
- <state relative-caret-position="60">
206
- <caret line="4" column="22" lean-forward="false" selection-start-line="4" selection-start-column="22" selection-end-line="4" selection-end-column="22" />
202
+ <state relative-caret-position="0">
203
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
204
+ <folding />
205
+ </state>
206
+ </provider>
207
+ </entry>
208
+ <entry file="file://$PROJECT_DIR$/lib/tasks/turbolog.rake">
209
+ <provider selected="true" editor-type-id="text-editor">
210
+ <state relative-caret-position="90">
211
+ <caret line="6" column="21" lean-forward="false" selection-start-line="6" selection-start-column="21" selection-end-line="6" selection-end-column="21" />
207
212
  <folding />
208
213
  </state>
209
214
  </provider>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format=progress
2
+ --colour
3
+ --format doc
data/Gemfile.lock CHANGED
@@ -1,40 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbolog (0.1.0)
4
+ turbolog (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  coderay (1.1.2)
10
- diff-lcs (1.3)
11
10
  ffi (1.9.21)
12
- formatador (0.2.5)
13
- guard (2.14.2)
14
- formatador (>= 0.2.4)
15
- listen (>= 2.7, < 4.0)
16
- lumberjack (>= 1.0.12, < 2.0)
17
- nenv (~> 0.1)
18
- notiffany (~> 0.0)
19
- pry (>= 0.9.12)
20
- shellany (~> 0.0)
21
- thor (>= 0.18.1)
22
- guard-compat (1.2.1)
23
- guard-rspec (4.7.3)
24
- guard (~> 2.1)
25
- guard-compat (~> 1.1)
26
- rspec (>= 2.99.0, < 4.0)
27
- listen (3.1.5)
28
- rb-fsevent (~> 0.9, >= 0.9.4)
29
- rb-inotify (~> 0.9, >= 0.9.7)
30
- ruby_dep (~> 1.2)
31
- lumberjack (1.0.12)
11
+ guard (0.10.0)
12
+ ffi (>= 0.5.0)
13
+ thor (~> 0.14.6)
14
+ guard-rspec (0.7.3)
15
+ guard (>= 0.10.0)
32
16
  method_source (0.8.2)
33
17
  minitest (5.11.3)
34
- nenv (0.3.0)
35
- notiffany (0.1.1)
36
- nenv (~> 0.1)
37
- shellany (~> 0.0)
38
18
  pry (0.10.4)
39
19
  coderay (~> 1.1.0)
40
20
  method_source (~> 0.8.1)
@@ -45,45 +25,27 @@ GEM
45
25
  pry (~> 0.9)
46
26
  slop (~> 3.0)
47
27
  rake (10.5.0)
48
- rb-fsevent (0.10.2)
49
- rb-inotify (0.9.10)
50
- ffi (>= 0.5.0, < 2)
51
- rspec (3.7.0)
52
- rspec-core (~> 3.7.0)
53
- rspec-expectations (~> 3.7.0)
54
- rspec-mocks (~> 3.7.0)
55
- rspec-core (3.7.1)
56
- rspec-support (~> 3.7.0)
57
- rspec-expectations (3.7.0)
58
- diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.7.0)
60
- rspec-mocks (3.7.0)
61
- diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.7.0)
63
- rspec-nc (0.3.0)
64
- rspec (>= 3)
65
- terminal-notifier (>= 1.4)
66
- rspec-support (3.7.1)
67
- ruby_dep (1.5.0)
68
- shellany (0.0.1)
28
+ rspec (0.9.4)
29
+ rspec-nc (0.0.3)
30
+ terminal-notifier (~> 1.4.2)
69
31
  slop (3.6.0)
70
- terminal-notifier (2.0.0)
71
- thor (0.20.0)
32
+ terminal-notifier (1.4.2)
33
+ thor (0.14.6)
72
34
 
73
35
  PLATFORMS
74
36
  ruby
75
37
 
76
38
  DEPENDENCIES
77
39
  bundler (~> 1.16)
78
- guard
79
- guard-rspec
40
+ guard (~> 0)
41
+ guard-rspec (~> 0)
80
42
  minitest (~> 5.0)
81
- pry
82
- pry-nav
83
- pry-remote
43
+ pry (~> 0)
44
+ pry-nav (~> 0)
45
+ pry-remote (~> 0)
84
46
  rake (~> 10.0)
85
- rspec
86
- rspec-nc
47
+ rspec (~> 0)
48
+ rspec-nc (~> 0)
87
49
  turbolog!
88
50
 
89
51
  BUNDLED WITH
@@ -26,26 +26,32 @@ module Turbolog
26
26
  def config_devise
27
27
  puts Color.blue("..................rails g devise:install................\n")
28
28
  run "rails generate devise:install"
29
+ puts Color.blue(" ..............Remove devise from routes.............\n")
30
+ gsub_file 'config/routes.rb',/devise_for.*\n/,''
29
31
  puts Color.blue("....................rails g devise User.................\n")
30
32
  run "rails generate devise User"
31
- # remove another devise from rails g devise User
32
- gsub_file 'config/routes.rb',/devise_for :users\n/,''
33
-
34
33
  end
35
34
 
36
- desc "Create Initial Controller"
35
+ desc "Create Initial Sample Controller"
37
36
  puts Color.blue(".............Create Welcome Initial Controller..........\n")
38
37
  def create_welcome
39
38
  run "rails g scaffold welcome greeting:text"
39
+ #copy_file "welcomes_controller_spec.rb","spec/controllers"
40
+ #copy_file "welcomes_spec.rb","spec/models"
40
41
  end
41
42
 
42
- def config_welcome
43
+ def config_root
43
44
  # set root to Welcome
44
- puts Color.blue("................Set root to: welcomes#index ...........\n")
45
- gsub_file 'config/routes.rb',/root.*/,'root to: \'welcomes#index\''
46
- inject_into_file 'config/routes.rb', :after => 'Rails.application.routes.draw do' do
47
- "\n get 'welcomes/index'\n"
48
- end
45
+ puts Color.blue(".................config routes for user ................\n")
46
+ copy_file "routes.rb","config/routes.rb"
47
+ end
48
+
49
+ def dot_option
50
+ # set root to Welcome
51
+ puts Color.blue("......................config .rspec ....................\n")
52
+ copy_file ".rspec",".rspec"
53
+ copy_file ".env",".env"
54
+ copy_file ".gitignore",".gitignore" #protect .env
49
55
  end
50
56
 
51
57
  desc "authenticate_user"
@@ -56,12 +62,6 @@ module Turbolog
56
62
  end
57
63
  end
58
64
 
59
- def setup_routes_users
60
- puts Color.blue(".................Setup routes for Users.................\n")
61
- route "devise_for :users, :controllers => { :omniauth_callbacks => \"users/omniauth_callbacks\" }"
62
- end
63
-
64
-
65
65
  desc "Set up omniauth config"
66
66
  def setup_omniauth
67
67
  puts Color.blue("...............config devise for facebook...............\n")
@@ -102,7 +102,27 @@ module Turbolog
102
102
  "\n <% end %>\n"
103
103
  end
104
104
  end
105
-
105
+
106
+ desc "Config default mail server in development and test"
107
+ puts Color.blue("......Add Log In/Log Out View in application.html.......\n")
108
+ def set_default_mailer
109
+ inject_into_file 'config/environments/development.rb', :after => 'ails.application.configure do' do
110
+ "\n ## config default mail server \n" +
111
+ " config.action_mailer.default_url_options = { host\: \"localhost\:3000\" }\n"
112
+ end
113
+ inject_into_file 'config/environments/test.rb', :after => 'ails.application.configure do' do
114
+ "\n ## config default mail server \n" +
115
+ " config.action_mailer.default_url_options = { host\: \"localhost\:3000\" }\n"
116
+ end
117
+ end
118
+
119
+ desc "Add user spec"
120
+ puts Color.blue("......................Add Spec Data.....................\n")
121
+ def add_spec
122
+ directory "spec"
123
+ directory "lib"
124
+ end
125
+
106
126
  def finish
107
127
  puts "\n"
108
128
  puts Color.blue("________________________________________________________\n")
@@ -32,6 +32,9 @@ module Turbolog
32
32
  gem 'guard-minitest'
33
33
  gem 'capybara'
34
34
  gem 'rb-fsevent'
35
+ gem 'simplecov'
36
+ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
37
+ gem 'database_cleaner'
35
38
  end
36
39
  end
37
40
 
@@ -0,0 +1,20 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore all logfiles and tempfiles.
11
+ /log/*
12
+ /tmp/*
13
+ !/log/.keep
14
+ !/tmp/.keep
15
+
16
+ /node_modules
17
+ /yarn-error.log
18
+
19
+ .byebug_history
20
+ .env
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,12 @@
1
+ class User
2
+ include Mongoid::Document
3
+ include Mongoid::Attributes::Dynamic
4
+ ## Added
5
+ field :activated, type: Boolean, default: false
6
+ field :activated_at, type: DateTime
7
+
8
+ def User.digest(string)
9
+ cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost
10
+ BCrypt::Password.create(string, cost: cost)
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'rails_helper'
4
+ require './app/controllers/application_controller'
5
+
6
+ describe ApplicationController do
7
+
8
+ end
@@ -0,0 +1,12 @@
1
+ # lib/string_calculator.rb
2
+ class StringCalculator
3
+
4
+ def self.add(input)
5
+ if input.empty?
6
+ 0
7
+ else
8
+ numbers = input.split(",").map { |num| num.to_i }
9
+ numbers.inject(0) { |sum, number| sum + number }
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
3
+ get 'welcomes/index'
4
+ root to: 'welcomes#index'
5
+ resources :welcomes
6
+ end
@@ -0,0 +1,86 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe WelcomesController, type: :controller do
4
+
5
+ let(:valid_attributes) {
6
+ {':greeting'=>'Initial Greeting'}
7
+ }
8
+
9
+ let(:invalid_attributes) {
10
+ {':greeting' => nil}
11
+ }
12
+
13
+ let(:valid_session) { {} }
14
+
15
+
16
+ before do
17
+ puts '========>'+' '+ 'Run before of FactoryBot for @welcome'
18
+ @authorize_user = FactoryBot.create(:authorize_user)
19
+ @welcome = FactoryBot.create(:welcome)
20
+ @welcome.save
21
+ end
22
+
23
+
24
+ describe "GET #index success #{200}" do
25
+ it "returns a success response" do
26
+ sign_in(@authorize_user)
27
+ expect(response).to be_success
28
+
29
+ end
30
+ end
31
+
32
+ describe "Sign_in GET #show" do
33
+ it "returns a success response" do
34
+ sign_in(@authorize_user)
35
+ welcome = Welcome.create!(greeting: 'Greeting by FactoryBot')
36
+ get :show, params: {id: welcome.to_param}, session: valid_session
37
+ #expect(response).to be_success
38
+ assert_response :success
39
+ #assert_response :redirect #302 Sign_in
40
+
41
+ end
42
+ end
43
+
44
+ describe "GET #new redirect to Sign_in #302" do
45
+ it "returns a success response" do
46
+ get :new, params: {}, session: valid_session
47
+ assert_response :redirect #302 Sign_in
48
+ end
49
+ end
50
+
51
+ describe "POST #create" do
52
+ context "create welcome redirect to sign_in" do
53
+ it "it redirect to users/sign_in" do
54
+ post :create, params: {welcome: { greeting: "Lorem ipsum" }}, session: valid_session
55
+ expect(response).to redirect_to("/users/sign_in")
56
+ end
57
+ end
58
+
59
+ it "login create welcome expect success" do
60
+ sign_in(@authorize_user)
61
+ welcome = Welcome.create!(greeting: 'Greeting by FactoryBot')
62
+ #post :create, params: {welcome: { greeting: "Lorem ipsum" }}, session: valid_session
63
+ expect(response).to be_success
64
+ end
65
+ end
66
+
67
+
68
+ describe "DELETE #destroy" do
69
+
70
+ it "can not delete then redirects to users/sign_in" do
71
+ delete :destroy, params: {id: 3333}
72
+ expect(response).to redirect_to("/users/sign_in")
73
+ end
74
+ end
75
+
76
+ describe "Login user can delete" do
77
+ it "then returns to welcomes" do
78
+ sign_in(@authorize_user)
79
+ puts '========>'+' '+ @welcome.to_param
80
+ @welcome.reload
81
+ delete :destroy, params: {id: @welcome.to_param}
82
+ expect(response).to redirect_to(welcomes_url)
83
+ end
84
+ end
85
+ end
86
+
@@ -0,0 +1,15 @@
1
+ FactoryBot.define do
2
+ factory :user do |f|
3
+ f.email Faker::Internet.free_email #=> "freddy@gmail.com"
4
+ f.password "secret"
5
+ end
6
+
7
+ factory :authorize_user, :class => :user do
8
+ # name "Tim Example"
9
+ email "a_user@example.com"
10
+ password '123456'
11
+ activated true
12
+ activated_at Time.zone.now
13
+ end
14
+
15
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :welcome do
3
+ greeting "Initial Greeting from FactoryBot"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ require 'rails_helper'
2
+
3
+ # Specs in this file have access to a helper object that includes
4
+ # the WelcomesHelper. For example:
5
+ #
6
+ # describe WelcomesHelper do
7
+ # describe "string concat" do
8
+ # it "concats two strings with spaces" do
9
+ # expect(helper.concat_strings("this","that")).to eq("this that")
10
+ # end
11
+ # end
12
+ # end
13
+ RSpec.describe WelcomesHelper, type: :helper do
14
+ describe "title" do
15
+ it "display greeting" do
16
+ expect(helper.title).to eq "Greeting"
17
+ end
18
+
19
+ it "title with parameter" do
20
+ expect(helper.title("Hola")).to eq "Hola | Greeting"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Welcome, type: :model do
4
+
5
+ context "Created authorize_user using FactoryBot" do
6
+ before do
7
+ @user = FactoryBot.build(:authorize_user)
8
+ @user.save
9
+ end
10
+
11
+ it "Expected valid user created" do
12
+ expect(@user).to be_valid
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,23 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
5
+ require 'rspec/rails'
6
+ require 'spec_helper'
7
+ require 'capybara/rspec'
8
+ require 'simplecov'
9
+ require 'factory_bot'
10
+ SimpleCov.start
11
+
12
+ RSpec.configure do |config|
13
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
14
+ config.infer_spec_type_from_file_location!
15
+ config.filter_rails_from_backtrace!
16
+ # Setup capybara
17
+ #config.include Warden::Test::Helpers #deplecated
18
+ config.include Capybara::DSL
19
+ # config.after :each do
20
+ # Warden.test_reset!
21
+ # end
22
+ # End Setup capybara
23
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "Welcomes", type: :request do
4
+ describe "GET /welcomes" do
5
+ it "email fakeuser when requesting password reset" do
6
+ fakeuser = FactoryBot.create(:authorize_user)
7
+ puts fakeuser.email
8
+ visit new_user_session_path
9
+ click_link "Forgot your password?"
10
+ fill_in "Email", :with => fakeuser.email
11
+ click_button "reset password"
12
+ expect(page).to have_content("email with instructions")
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,96 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # Many RSpec users commonly either run the entire suite or an individual
70
+ # file, and it's useful to allow more verbose output when running an
71
+ # individual spec file.
72
+ if config.files_to_run.one?
73
+ # Use the documentation formatter for detailed output,
74
+ # unless a formatter has already been configured
75
+ # (e.g. via a command-line flag).
76
+ config.default_formatter = "doc"
77
+ end
78
+
79
+ # Print the 10 slowest examples and example groups at the
80
+ # end of the spec run, to help surface which specs are running
81
+ # particularly slow.
82
+ config.profile_examples = 10
83
+
84
+ # Run specs in random order to surface order dependencies. If you find an
85
+ # order dependency and want to debug it, you can fix the order by providing
86
+ # the seed, which is printed after each run.
87
+ # --seed 1234
88
+ config.order = :random
89
+
90
+ # Seed global randomization in this process using the `--seed` CLI option.
91
+ # Setting this allows you to use `--seed` to deterministically reproduce
92
+ # test failures related to randomization by passing the same `--seed` value
93
+ # as the one that triggered the failure.
94
+ Kernel.srand config.seed
95
+ =end
96
+ end
@@ -0,0 +1,12 @@
1
+ #https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs
2
+ module ControllerHelpers
3
+ def sign_in(user = double('user'))
4
+ if user.nil?
5
+ allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})
6
+ allow(controller).to receive(:current_user).and_return(nil)
7
+ else
8
+ allow(request.env['warden']).to receive(:authenticate!).and_return(user)
9
+ allow(controller).to receive(:current_user).and_return(user)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,73 @@
1
+ # Installing database_cleaner:
2
+
3
+ # 0. Check spec/support dir is auto-required in spec/rails_helper.rb.
4
+ #
5
+ # 1. Add database_cleaner to Gemfile:
6
+ #
7
+ # group :test do
8
+ # gem 'database_cleaner'
9
+ # end
10
+
11
+ # 2. IMPORTANT! Delete the "config.use_transactional_fixtures = ..." line
12
+ # in spec/rails_helper.rb (we're going to configure it in this file you're
13
+ # reading instead).
14
+
15
+ # 3. Create a file like this one you're reading in spec/support/database_cleaner.rb:
16
+ RSpec.configure do |config|
17
+
18
+ config.use_transactional_fixtures = false
19
+
20
+ config.before(:suite) do
21
+ if config.use_transactional_fixtures?
22
+
23
+ raise(<<-MSG)
24
+ Delete line `config.use_transactional_fixtures = true` from rails_helper.rb
25
+ (or set it to false) to prevent uncommitted transactions being used in
26
+ JavaScript-dependent specs.
27
+ During testing, the Ruby app server that the JavaScript browser driver
28
+ connects to uses a different database connection to the database connection
29
+ used by the spec.
30
+
31
+ This Ruby app server database connection would not be able to see data that
32
+ has been setup by the spec's database connection inside an uncommitted
33
+ transaction.
34
+ Disabling the use_transactional_fixtures setting helps avoid uncommitted
35
+ transactions in JavaScript-dependent specs, meaning that the Ruby app server
36
+ database connection can see any data set up by the specs.
37
+ MSG
38
+
39
+ end
40
+ end
41
+
42
+ config.before(:suite) do
43
+ DatabaseCleaner.clean_with(:truncation)
44
+ end
45
+
46
+ config.before(:each) do
47
+ DatabaseCleaner.strategy = :truncation
48
+ end
49
+
50
+ config.before(:each, type: :feature) do
51
+ # :rack_test driver's Rack app under test shares database connection
52
+ # with the specs, so we can use transaction strategy for speed.
53
+ driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test
54
+
55
+ if driver_shares_db_connection_with_specs
56
+ DatabaseCleaner.strategy = :truncation
57
+ else
58
+ # Non-:rack_test driver is probably a driver for a JavaScript browser
59
+ # with a Rack app under test that does *not* share a database
60
+ # connection with the specs, so we must use truncation strategy.
61
+ DatabaseCleaner.strategy = :truncation
62
+ end
63
+ end
64
+
65
+ config.before(:each) do
66
+ DatabaseCleaner.start
67
+ end
68
+
69
+ config.after(:each) do
70
+ DatabaseCleaner.clean
71
+ end
72
+
73
+ end
@@ -0,0 +1,8 @@
1
+ #include Devise::TestHelpers
2
+ #require 'support/controller_helpers'
3
+ RSpec.configure do |config|
4
+ # Setup TestHelper for Rails 5
5
+ config.include Devise::Test::ControllerHelpers, type: :controller
6
+ config.include Devise::Test::ControllerHelpers, type: :view
7
+ config.include Devise::Test::IntegrationHelpers, type: :feature
8
+ end
@@ -0,0 +1,86 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe WelcomesController, type: :controller do
4
+
5
+ let(:valid_attributes) {
6
+ {':greeting'=>'Initial Greeting'}
7
+ }
8
+
9
+ let(:invalid_attributes) {
10
+ {':greeting' => nil}
11
+ }
12
+
13
+ let(:valid_session) { {} }
14
+
15
+
16
+ before do
17
+ puts '========>'+' '+ 'Run before of FactoryBot for @welcome'
18
+ @authorize_user = FactoryBot.create(:authorize_user)
19
+ @welcome = FactoryBot.create(:welcome)
20
+ @welcome.save
21
+ end
22
+
23
+
24
+ describe "GET #index success #{200}" do
25
+ it "returns a success response" do
26
+ sign_in(@authorize_user)
27
+ expect(response).to be_success
28
+
29
+ end
30
+ end
31
+
32
+ describe "Sign_in GET #show" do
33
+ it "returns a success response" do
34
+ sign_in(@authorize_user)
35
+ welcome = Welcome.create!(greeting: 'Greeting by FactoryBot')
36
+ get :show, params: {id: welcome.to_param}, session: valid_session
37
+ #expect(response).to be_success
38
+ assert_response :success
39
+ #assert_response :redirect #302 Sign_in
40
+
41
+ end
42
+ end
43
+
44
+ describe "GET #new redirect to Sign_in #302" do
45
+ it "returns a success response" do
46
+ get :new, params: {}, session: valid_session
47
+ assert_response :redirect #302 Sign_in
48
+ end
49
+ end
50
+
51
+ describe "POST #create" do
52
+ context "create welcome redirect to sign_in" do
53
+ it "it redirect to users/sign_in" do
54
+ post :create, params: {welcome: { greeting: "Lorem ipsum" }}, session: valid_session
55
+ expect(response).to redirect_to("/users/sign_in")
56
+ end
57
+ end
58
+
59
+ it "login create welcome expect success" do
60
+ sign_in(@authorize_user)
61
+ welcome = Welcome.create!(greeting: 'Greeting by FactoryBot')
62
+ #post :create, params: {welcome: { greeting: "Lorem ipsum" }}, session: valid_session
63
+ expect(response).to be_success
64
+ end
65
+ end
66
+
67
+
68
+ describe "DELETE #destroy" do
69
+
70
+ it "can not delete then redirects to users/sign_in" do
71
+ delete :destroy, params: {id: 3333}
72
+ expect(response).to redirect_to("/users/sign_in")
73
+ end
74
+ end
75
+
76
+ describe "Login user can delete" do
77
+ it "then returns to welcomes" do
78
+ sign_in(@authorize_user)
79
+ puts '========>'+' '+ @welcome.to_param
80
+ @welcome.reload
81
+ delete :destroy, params: {id: @welcome.to_param}
82
+ expect(response).to redirect_to(welcomes_url)
83
+ end
84
+ end
85
+ end
86
+
@@ -1,3 +1,3 @@
1
1
  module Turbolog
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbolog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateep Kul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-10 00:00:00.000000000 Z
11
+ date: 2018-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,7 @@ files:
164
164
  - ".idea/turbolog.iml"
165
165
  - ".idea/vcs.xml"
166
166
  - ".idea/workspace.xml"
167
+ - ".rspec"
167
168
  - ".travis.yml"
168
169
  - CODE_OF_CONDUCT.md
169
170
  - Gemfile
@@ -176,7 +177,25 @@ files:
176
177
  - bin/setup
177
178
  - lib/generators/turbolog/config_generator.rb
178
179
  - lib/generators/turbolog/install_generator.rb
180
+ - lib/generators/turbolog/templates/.gitignore
181
+ - lib/generators/turbolog/templates/.rspec
179
182
  - lib/generators/turbolog/templates/app/controllers/Users/omniauth_callbacks_controller.rb
183
+ - lib/generators/turbolog/templates/app/models/user.rb
184
+ - lib/generators/turbolog/templates/application_controller_spec.rb
185
+ - lib/generators/turbolog/templates/lib/string_calculator.rb
186
+ - lib/generators/turbolog/templates/routes.rb
187
+ - lib/generators/turbolog/templates/spec/controllers/welcomes_controller_spec.rb
188
+ - lib/generators/turbolog/templates/spec/factories/users.rb
189
+ - lib/generators/turbolog/templates/spec/factories/welcomes.rb
190
+ - lib/generators/turbolog/templates/spec/helpers/welcomes_helper_spec.rb
191
+ - lib/generators/turbolog/templates/spec/models/welcome_spec.rb
192
+ - lib/generators/turbolog/templates/spec/rails_helper.rb
193
+ - lib/generators/turbolog/templates/spec/requests/welcomes_spec.rb
194
+ - lib/generators/turbolog/templates/spec/spec_helper.rb
195
+ - lib/generators/turbolog/templates/spec/support/controller_helper.rb
196
+ - lib/generators/turbolog/templates/spec/support/database_cleaner.rb
197
+ - lib/generators/turbolog/templates/spec/support/devise.rb
198
+ - lib/generators/turbolog/templates/spec/welcomes_controller_spec.rb
180
199
  - lib/tasks/turbolog.rake
181
200
  - lib/turbolog.rb
182
201
  - lib/turbolog/helpers.rb