tuberack 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3c6ff124a759448ed7469bde7ec2f6076c1efa33
4
+ data.tar.gz: ed65434076ae0481395d1a627aa657cff051e916
5
+ SHA512:
6
+ metadata.gz: e897b7cebbd86d50be0f9d7d128af583757827c636fd61f774b5a6741777906550653cee0c076a398d3f6a5e8e067123f7fd5cbd6e4167bd112f75203e62bd43
7
+ data.tar.gz: 4af07a0226276b83b26f06b1e072959966f07a94e6b0f441ce95821ce0b77eb324aff5127b9e0c4db14fdb5376b5f16a39a7cd40f267e2c302f263dca5d2833e
data/License.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 JiriKolarik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/Readme.md ADDED
@@ -0,0 +1,40 @@
1
+ # TubeRack
2
+
3
+ Test your application better
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'testable', group: [:development, :test], require: false
11
+ ```
12
+
13
+ into your my_gem.gemspec, when building gem:
14
+ ```ruby
15
+ s.add_development_dependency 'tuberack'
16
+ ```
17
+
18
+ Or install it yourself as:
19
+
20
+ gem install tuberack
21
+
22
+ After that install TubeRack into your application
23
+
24
+ rails g tuberack:install
25
+
26
+ ## Usage
27
+
28
+ 1. Uncomment and change engine name in `test/test_help.rb` if are you building gem
29
+ 2. Change name of your app in `.simplecov` or remove everything inside block
30
+
31
+ Now you are able to test your application with
32
+
33
+ * MiniTest Spec
34
+ * Cucumber
35
+ * SimpleCov
36
+ * Shoulda
37
+ * Mocha
38
+ * FactoryGirl
39
+ * LetterOpener
40
+ * Cell tests
@@ -0,0 +1,73 @@
1
+ module Tuberack
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Install Cucumber BDD"
7
+ def generate_cucumber
8
+ generate 'cucumber:install'
9
+ end
10
+
11
+ desc "Install SimpleCov"
12
+ def copy_simplecov
13
+ template ".simplecov", ".simplecov"
14
+ end
15
+
16
+ desc "Implement SimpleCov into Cucumber"
17
+ def simplecov_cucumber
18
+ prepend_file 'features/support/env.rb' do
19
+ <<-EOH
20
+ require 'simplecov'
21
+
22
+ EOH
23
+ end
24
+ end
25
+
26
+ desc "Implement SimpleCov into tests"
27
+ def simplecov_test_help
28
+ prepend_file 'test/test_helper.rb' do
29
+ <<-EOH
30
+ require 'simplecov'
31
+
32
+ EOH
33
+ end
34
+ end
35
+
36
+ desc "Implement Capybara into tests"
37
+ def capybara_test_help
38
+ append_file 'test/test_helper.rb' do
39
+ <<-EOH
40
+
41
+ require 'capybara/rails' # Capybara must be required directly
42
+
43
+ class ActionDispatch::IntegrationTest
44
+ include Capybara::DSL
45
+ end
46
+ EOH
47
+ end
48
+ end
49
+
50
+ desc "Implement testable into tests"
51
+ def testable_test_help
52
+ append_file 'test/test_helper.rb' do
53
+ <<-EOH
54
+
55
+ require 'tuberack'
56
+
57
+ include Tuberack::Helpers
58
+ EOH
59
+ end
60
+
61
+ append_file 'test/test_helper.rb' do
62
+ <<-EOH
63
+
64
+ class ActiveSupport::TestCase
65
+ # Uncomment if are you using Rails engine
66
+ # include MyEngine::Engine.routes.url_helpers
67
+ end
68
+ EOH
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
data/lib/tuberack.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'tuberack/requirements'
2
+ require 'tuberack/helpers'
3
+ require 'tuberack/test_help'
4
+
5
+ module Tuberack
6
+ end
@@ -0,0 +1,31 @@
1
+ module Tuberack
2
+ module Helpers
3
+ def integration_login
4
+ current_user.stubs(:has_role?).returns(true)
5
+ login_as current_user
6
+ end
7
+
8
+ def user_ability role
9
+ current_user.stubs(:has_role?).returns(false)
10
+ current_user.stubs(:has_role?).with(role).returns(true)
11
+ current_user
12
+ end
13
+
14
+ def ability
15
+ @ability = Object.new
16
+ @ability.extend(CanCan::Ability)
17
+ @controller.stubs(:current_user).returns(current_user)
18
+ @controller.stubs(:current_ability).returns(@ability)
19
+ end
20
+
21
+ def can object
22
+ ability unless defined? @ability
23
+ @ability.can :manage, object
24
+ end
25
+
26
+ def cannot object
27
+ ability unless defined? @ability
28
+ @ability.cannot :manage, object
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ # MiniTest for Rails
2
+ require 'minitest/spec'
3
+ require 'minitest/pride'
4
+
5
+ # Shoulda matchers
6
+ require 'shoulda'
7
+
8
+ # Stubbing and mocking
9
+ require 'mocha/setup'
10
+
11
+ # Test Cells
12
+ require 'cell/test_case' if defined? Cell
13
+
14
+ # Replace fixtures with FactoryGirl
15
+ require 'factory_girl_rails'
16
+
17
+ # Open Letter in browser
18
+ require 'letter_opener'
19
+
20
+ # Clean database
21
+ require 'database_cleaner'
@@ -0,0 +1,41 @@
1
+ # Default and model tests
2
+ class ActiveSupport::TestCase
3
+ extend MiniTest::Spec::DSL
4
+
5
+ include FactoryGirl::Syntax::Methods
6
+
7
+ class << self
8
+ remove_method :describe
9
+ end
10
+
11
+ register_spec_type self do |desc|
12
+ desc < ActiveRecord::Base if desc.is_a? Class
13
+ end
14
+ end
15
+
16
+ # View tests
17
+ class ActionView::TestCase
18
+ register_spec_type(/Helper/, self)
19
+ end
20
+
21
+ # Controller tests
22
+ class ActionController::TestCase
23
+ register_spec_type(/Controller$/, self)
24
+ end
25
+
26
+ # Cell tests
27
+ class Cell::TestCase
28
+ register_spec_type(/Cell$/, self)
29
+ end if defined? Cell
30
+
31
+ # Integration tests
32
+ class ActionDispatch::IntegrationTest
33
+ include RailsAdmin::Engine.routes.url_helpers if defined? RailsAdmin
34
+ register_spec_type(/Feature$/, self)
35
+ end
36
+
37
+ # Switching to Warden test mode
38
+ if defined? Warden
39
+ include Warden::Test::Helpers
40
+ Warden.test_mode!
41
+ end
@@ -0,0 +1,3 @@
1
+ module Tuberack
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,222 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tuberack
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - JiriKolarik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
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
+ - !ruby/object:Gem::Dependency
56
+ name: capybara
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: shoulda
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ 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: factory_girl_rails
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: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: cucumber-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ 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: database_cleaner
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: letter_opener
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: bundler
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.5'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.5'
181
+ description: Test your application better
182
+ email:
183
+ - jiri.kolarik@imin.cz
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - License.txt
189
+ - Rakefile
190
+ - Readme.md
191
+ - lib/generators/tuberack/install_generator.rb
192
+ - lib/tuberack.rb
193
+ - lib/tuberack/helpers.rb
194
+ - lib/tuberack/requirements.rb
195
+ - lib/tuberack/test_help.rb
196
+ - lib/tuberack/version.rb
197
+ homepage: http://werein.cz
198
+ licenses:
199
+ - MIT
200
+ metadata: {}
201
+ post_install_message:
202
+ rdoc_options: []
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ requirements: []
216
+ rubyforge_project:
217
+ rubygems_version: 2.2.2
218
+ signing_key:
219
+ specification_version: 4
220
+ summary: Test your application with MiniTest::Spec, Cucumber, SimpleCover coverage
221
+ and more
222
+ test_files: []