tuberack 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b313e6029eb93ebf2553b04efcb728b60c63bdc
4
- data.tar.gz: 29717d3e5512921e77240fd61bb25a609b5e44c9
3
+ metadata.gz: 0d385d441d70dd40d21e118d9336586e900baa86
4
+ data.tar.gz: 2f72aafccce0780d405bb1630abe422eb4abeff3
5
5
  SHA512:
6
- metadata.gz: ee07aea2793c5262d59af29a46a5ec45930501aec7a29cd4b0b3f85ffd76f8672fe7e552ae1432824c23fc09c43f4adfb6abea0cd0b38144039d90804f2df61e
7
- data.tar.gz: cd3b4f04ac8a4178f53b7acd817027aa5b1e86d0f843dfd6031a22ca0cca777ba3a504e46dd905f14374872b9643dbf388f1606ad45adcdd20dc60f55a268386
6
+ metadata.gz: 2945bc8d1115d978b66329e0a8711b73731b9f848cf06d3b85d61ddc429fb9fbdd3f9eac91d0ba18f932df40c0167d0e1746590d890b54610b46db786b080124
7
+ data.tar.gz: 73b916b2d89c02adf26377c6747926f0cefddccd9a9927db336156f3f377cfa7f9ec7b0bf09a19ae7e9a2bdb1d9ce5191974e31e4f3e55cee6c274c7326f4766
data/Readme.md CHANGED
@@ -37,4 +37,12 @@ Now you are able to test your application with
37
37
  * Mocha
38
38
  * FactoryGirl
39
39
  * LetterOpener
40
- * Cell tests
40
+ * Cell tests
41
+
42
+ # Set app user
43
+
44
+ You can easily set current user with user ability with cell. Just load it in your view and point current user instance
45
+
46
+ ```ruby
47
+ = render_cell 'tuberack/switcher', :show, current_user
48
+ ```
@@ -8,8 +8,8 @@ module Tuberack
8
8
  prepend_file 'test/test_helper.rb' do
9
9
  <<-EOH
10
10
 
11
- Coveralls.wear! if Coveralls.should_run?
12
- # Coveralls.wear!('rails') if Coveralls.should_run? # For RailsApp
11
+ Coveralls.wear! if Coveralls.should_run? if TUBERACK.include?(:coveralls)
12
+ # Coveralls.wear!('rails') # For RailsApp
13
13
 
14
14
  EOH
15
15
  end
@@ -21,7 +21,7 @@ Coveralls.wear! if Coveralls.should_run?
21
21
  <<-EOH
22
22
 
23
23
  # Don't forget set token
24
- CodeClimate::TestReporter.start
24
+ CodeClimate::TestReporter.start if TUBERACK.include?(:codeclimate)
25
25
  EOH
26
26
  end
27
27
  end
@@ -31,23 +31,18 @@ CodeClimate::TestReporter.start
31
31
  prepend_file 'test/test_helper.rb' do
32
32
  <<-EOH
33
33
  # Keep it on top, don't change positions
34
- require 'simplecov'
35
- require 'coveralls'
36
- require 'codeclimate-test-reporter'
34
+ require 'tuberack/codeclimate'
35
+ require 'tuberack/simplecov'
36
+ require 'tuberack/coveralls'
37
37
  EOH
38
38
  end
39
39
  end
40
40
 
41
- desc "Install Cucumber BDD"
42
- def generate_cucumber
43
- generate 'cucumber:install'
44
- end
45
-
46
- desc "Implement SimpleCov into Cucumber"
47
- def simplecov_cucumber
48
- prepend_file 'features/support/env.rb' do
41
+ desc "Enabled services"
42
+ def enabled_services
43
+ prepend_file 'test/test_helper.rb' do
49
44
  <<-EOH
50
- require 'simplecov'
45
+ TUBERACK = [ :minitest, :shoulda, :mocha, :cell, :factory_girl, :webmock, :capybara, :simplecov, :codeclimate, :coveralls ]
51
46
 
52
47
  EOH
53
48
  end
@@ -63,11 +58,17 @@ require 'simplecov'
63
58
  def capybara_test_help
64
59
  append_file 'test/test_helper.rb' do
65
60
  <<-EOH
61
+ # Capybara must be required directly
62
+ if TUBERACK.include?(:capybara)
63
+ begin
64
+ require 'capybara/rails'
65
+ rescue LoadError
66
+ puts "You must put `gem 'capybara'` into your Gemfile and `bundle install` to use Capybara"
67
+ end
66
68
 
67
- require 'capybara/rails' # Capybara must be required directly
68
-
69
- class ActionDispatch::IntegrationTest
70
- include Capybara::DSL
69
+ class ActionDispatch::IntegrationTest
70
+ include Capybara::DSL
71
+ end
71
72
  end
72
73
  EOH
73
74
  end
@@ -75,7 +76,7 @@ end
75
76
 
76
77
  desc "Implement testable into tests"
77
78
  def tuberack_test_help
78
- file = File.read('test/test_helper.rb').sub(/require ("|')rails\/test_help("|')\n/, "require 'rails\/test_help'\nrequire 'tuberack'\n")
79
+ file = File.read('test/test_helper.rb').sub(/require ("|')rails\/test_help("|')\n/, "require 'rails\/test_help'\nrequire 'tuberack/test_help'\n")
79
80
  File.write('test/test_helper.rb', file)
80
81
 
81
82
  append_file 'test/test_helper.rb' do
@@ -99,7 +100,7 @@ end
99
100
  def webmock_test_help
100
101
  append_file 'test/test_helper.rb' do
101
102
  <<-EOH
102
- WebMock.disable_net_connect! allow: %w(coveralls.io)
103
+ WebMock.disable_net_connect! allow: %w(coveralls.io) if TUBERACK.include?(:webmock)
103
104
  EOH
104
105
  end
105
106
  end
@@ -1,12 +1,4 @@
1
1
  require 'tuberack/engine'
2
- require 'tuberack/dummy_controller'
3
- require 'tuberack/dummy_user'
4
-
5
- if ENV['RAILS_ENV'] == 'test'
6
- require 'tuberack/requirements'
7
- require 'tuberack/helpers'
8
- require 'tuberack/test_help'
9
- end
10
2
 
11
3
  module Tuberack
12
4
  end
@@ -0,0 +1,7 @@
1
+ if TUBERACK.include?(:codeclimate)
2
+ begin
3
+ require 'codeclimate-test-reporter'
4
+ rescue LoadError
5
+ puts "You must put `gem 'codeclimate-test-reporter'` into your Gemfile and `bundle install` to use Codeclimate service"
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ if TUBERACK.include?(:coveralls)
2
+ begin
3
+ require 'coveralls'
4
+ rescue LoadError
5
+ puts "You must put `gem 'coveralls'` into your Gemfile and `bundle install` to use Coveralls service"
6
+ end
7
+ end
@@ -7,6 +7,7 @@ module Tuberack
7
7
  def current_user
8
8
  @@current_user ||= DummyUser.new
9
9
  end
10
+ helper_method :current_user
10
11
 
11
12
  def xeditable? object
12
13
  current_user.xeditable?
@@ -21,8 +22,8 @@ module Tuberack
21
22
  private
22
23
  def changes
23
24
  @@current_user = set_user if params[:user]
24
- current_user.manage = params[:manage] =~ /(true|1)/ ? true : false if params[:manage]
25
- current_user.xeditable = params[:xeditable] =~ /(true|1)/ ? true : false if params[:xeditable]
25
+ current_user.manage = params[:manage] =~ /(true|1|on)/ ? true : false if params[:manage]
26
+ current_user.xeditable = params[:xeditable] =~ /(true|1|on)/ ? true : false if params[:xeditable]
26
27
  current_user.roles = params[:role] == 'clear' ? nil : params[:role] if params[:role]
27
28
  end
28
29
 
@@ -2,26 +2,74 @@
2
2
  require 'rails/generators/test_case'
3
3
 
4
4
  # MiniTest for Rails
5
- require 'minitest/rails'
6
- require 'minitest/pride'
5
+ if TUBERACK.include?(:minitest)
6
+ begin
7
+ require 'minitest/rails'
8
+ require 'minitest/pride'
9
+ rescue LoadError
10
+ puts "You must put `gem 'minitest-rails'` into your Gemfile and `bundle install` to use MiniTest"
11
+ end
12
+ end
7
13
 
8
14
  # Shoulda matchers
9
- require 'shoulda'
15
+ if TUBERACK.include?(:shoulda)
16
+ begin
17
+ require 'shoulda'
18
+ rescue LoadError
19
+ puts "You must put `gem 'shoulda'` into your Gemfile and `bundle install` to use Shoulda"
20
+ end
21
+ end
10
22
 
11
23
  # Stubbing and mocking
12
- require 'mocha/setup'
24
+ if TUBERACK.include?(:mocha)
25
+ begin
26
+ require 'mocha/setup'
27
+ rescue LoadError
28
+ puts "You must put `gem 'mocha'` into your Gemfile and `bundle install` to use Mocha"
29
+ end
30
+ end
13
31
 
14
32
  # Test Cells
15
- require 'cell/test_case' if defined? Cell
33
+ if TUBERACK.include?(:cell)
34
+ begin
35
+ require 'cell/test_case'
36
+ rescue LoadError
37
+ puts "You must put `gem 'cell'` into your Gemfile and `bundle install` to use Cells"
38
+ end
39
+ end
16
40
 
17
41
  # Replace fixtures with FactoryGirl
18
- require 'factory_girl_rails'
42
+ if TUBERACK.include?(:factory_girl)
43
+ begin
44
+ require 'factory_girl_rails'
45
+ rescue LoadError
46
+ puts "You must put `gem 'factory_girl_rails'` into your Gemfile and `bundle install` to use FactoryGirl"
47
+ end
48
+ end
19
49
 
20
50
  # Open Letter in browser
21
- require 'letter_opener'
51
+ if TUBERACK.include?(:letter_opener)
52
+ begin
53
+ require 'letter_opener'
54
+ rescue LoadError
55
+ puts "You must put `gem 'letter_opener'` into your Gemfile and `bundle install` to use LetterOpenner"
56
+ end
57
+ end
22
58
 
23
59
  # Clean database
24
- require 'database_cleaner'
60
+ if TUBERACK.include?(:database_cleaner)
61
+ begin
62
+ require 'database_cleaner'
63
+ rescue LoadError
64
+ puts "You must put `gem 'database_cleaner'` into your Gemfile and `bundle install` to use DatabaseCleaner"
65
+ end
66
+ end
25
67
 
26
68
  # Stub Web requests
27
- require 'webmock/minitest'
69
+ if TUBERACK.include?(:webmock)
70
+ begin
71
+ require 'webmock/minitest'
72
+ rescue LoadError
73
+ puts "You must put `gem 'webmock'` into your Gemfile and `bundle install` to use Webmock"
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ if TUBERACK.include?(:simplecov)
2
+ begin
3
+ require 'simplecov'
4
+ rescue LoadError
5
+ puts "You must put `gem 'simplecov'` into your Gemfile and `bundle install` to use Codeclimate service"
6
+ end
7
+ end
@@ -1,10 +1,20 @@
1
+ require 'tuberack/dummy_controller'
2
+ require 'tuberack/dummy_user'
3
+
4
+ if ENV['RAILS_ENV'] == 'test'
5
+ require 'tuberack/requirements'
6
+ require 'tuberack/helpers'
7
+ end
8
+
1
9
  # Default and model tests
2
10
  class ActiveSupport::TestCase
3
- include FactoryGirl::Syntax::Methods
11
+ include FactoryGirl::Syntax::Methods if TUBERACK.include?(:factory_girl)
4
12
  end
5
13
 
6
- Minitest::Spec.register_spec_type(/Cell$/, Cell::TestCase) if defined? Cell
7
- Minitest::Spec.register_spec_type(/Feature$/, ActionDispatch::IntegrationTest)
14
+ if TUBERACK.include?(:minitest)
15
+ Minitest::Spec.register_spec_type(/Cell$/, Cell::TestCase) if TUBERACK.include?(:cell)
16
+ Minitest::Spec.register_spec_type(/Feature$/, ActionDispatch::IntegrationTest)
17
+ end
8
18
 
9
19
  # Integration tests
10
20
  class ActionDispatch::IntegrationTest
@@ -1,3 +1,3 @@
1
1
  module Tuberack
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuberack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - JiriKolarik
7
+ - Jiri Kolarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-15 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,42 +38,14 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: minitest-rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.0.0.beta1
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 2.0.0.beta1
69
- - !ruby/object:Gem::Dependency
70
- name: capybara
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - ">="
74
46
  - !ruby/object:Gem::Version
75
47
  version: '0'
76
- type: :runtime
48
+ type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
@@ -87,35 +59,7 @@ dependencies:
87
59
  - - ">="
88
60
  - !ruby/object:Gem::Version
89
61
  version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: shoulda
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: factory_girl_rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
62
+ type: :development
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
@@ -129,63 +73,7 @@ dependencies:
129
73
  - - ">="
130
74
  - !ruby/object:Gem::Version
131
75
  version: '0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: cucumber-rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: database_cleaner
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: letter_opener
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :runtime
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: codeclimate-test-reporter
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :runtime
76
+ type: :development
189
77
  prerelease: false
190
78
  version_requirements: !ruby/object:Gem::Requirement
191
79
  requirements:
@@ -199,21 +87,7 @@ dependencies:
199
87
  - - ">="
200
88
  - !ruby/object:Gem::Version
201
89
  version: '0'
202
- type: :runtime
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: webmock
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :runtime
90
+ type: :development
217
91
  prerelease: false
218
92
  version_requirements: !ruby/object:Gem::Requirement
219
93
  requirements:
@@ -221,21 +95,7 @@ dependencies:
221
95
  - !ruby/object:Gem::Version
222
96
  version: '0'
223
97
  - !ruby/object:Gem::Dependency
224
- name: bundler
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: '1.5'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: '1.5'
237
- - !ruby/object:Gem::Dependency
238
- name: cells
98
+ name: codeclimate-test-reporter
239
99
  requirement: !ruby/object:Gem::Requirement
240
100
  requirements:
241
101
  - - ">="
@@ -248,9 +108,9 @@ dependencies:
248
108
  - - ">="
249
109
  - !ruby/object:Gem::Version
250
110
  version: '0'
251
- description: Test your application better
111
+ description: Tuberack for testing services
252
112
  email:
253
- - jiri.kolarik@imin.cz
113
+ - jiri.kolarik@wereinhq.com
254
114
  executables: []
255
115
  extensions: []
256
116
  extra_rdoc_files: []
@@ -260,14 +120,17 @@ files:
260
120
  - Readme.md
261
121
  - lib/generators/tuberack/install_generator.rb
262
122
  - lib/tuberack.rb
123
+ - lib/tuberack/codeclimate.rb
124
+ - lib/tuberack/coveralls.rb
263
125
  - lib/tuberack/dummy_controller.rb
264
126
  - lib/tuberack/dummy_user.rb
265
127
  - lib/tuberack/engine.rb
266
128
  - lib/tuberack/helpers.rb
267
129
  - lib/tuberack/requirements.rb
130
+ - lib/tuberack/simplecov.rb
268
131
  - lib/tuberack/test_help.rb
269
132
  - lib/tuberack/version.rb
270
- homepage: http://werein.cz
133
+ homepage: http://wereinhq.com
271
134
  licenses:
272
135
  - MIT
273
136
  metadata: {}
@@ -290,6 +153,5 @@ rubyforge_project:
290
153
  rubygems_version: 2.2.2
291
154
  signing_key:
292
155
  specification_version: 4
293
- summary: Test your application with MiniTest::Spec, Cucumber, SimpleCover coverage
294
- and more
156
+ summary: Handle your testing libraries easier
295
157
  test_files: []