rails_test_shortcuts 0.1.0
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.
- data/.gitignore +1 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/lib/rails_test_shortcuts/railtie.rb +7 -0
- data/lib/rails_test_shortcuts.rb +5 -0
- data/lib/tasks/testing.rake +42 -0
- data/rails_test_shortcuts.gemspec +16 -0
- metadata +72 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Sergey Kojin
|
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/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
Set of rake tasks that let's you type less to run tests.
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
gem 'rails_test_shortcuts', :group => :development
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Shortcuts to standarts tasks
|
16
|
+
|
17
|
+
rake u # alias for rake test:units
|
18
|
+
rake f # alias for rake test:functionals
|
19
|
+
rake i # alias for rake test:integration
|
20
|
+
rake uf # run units and functionals tests only
|
21
|
+
|
22
|
+
### Run single test or set of tests by mask
|
23
|
+
|
24
|
+
Syntax: `rake t u=[file name] n=[test name]`
|
25
|
+
|
26
|
+
`rake t` task allows running tests by file name and test name. Add `u=user` parameter to run only the tests that have 'user' in name. Also available `f=` for functional tests, `i=` for integration tests and 't=' for any tests.
|
27
|
+
|
28
|
+
|
29
|
+
rake t u=user # test/units/*user*.rb tests
|
30
|
+
rake t f=session # test/functional/*session*.rb tests
|
31
|
+
rake t i=login # test/integration/*login*.rb tests
|
32
|
+
rake t t=user # test/**/*user*.rb tests, all tests that have 'user' in filename
|
33
|
+
|
34
|
+
`n=testname` parameter allows executing only the tests that matches /testname/
|
35
|
+
|
36
|
+
rake t u=user n=create # test/units/*user*.rb individual tests that have 'create' in test name
|
37
|
+
|
38
|
+
Also note that `rake t` task skips db:test:prepare database initialization task, so it executes a bit faster, but if your database schema changed, run once `rake u` or `rake tests` to prepare db.
|
39
|
+
|
40
|
+
## See Also
|
41
|
+
|
42
|
+
https://github.com/grosser/single_test
|
@@ -0,0 +1,42 @@
|
|
1
|
+
desc "Shortcut for functional tests"
|
2
|
+
task :f => "test:functionals"
|
3
|
+
|
4
|
+
desc "Shortcut for unit tests"
|
5
|
+
task :u => "test:units"
|
6
|
+
|
7
|
+
desc "Shortcut for integration tests"
|
8
|
+
task :i => "test:integration"
|
9
|
+
|
10
|
+
desc "Run unit and functional tests"
|
11
|
+
task :uf => ["test:units", "test:functionals"]
|
12
|
+
|
13
|
+
desc "Run single test, syntax: rake t t=[file_name] n=[test_name] ."
|
14
|
+
task :t
|
15
|
+
|
16
|
+
Rake::TestTask.new(:t) do |t|
|
17
|
+
if ARGV[1]
|
18
|
+
# take the first parameter and grab everything right of '=' sign, ignore .rb if it exists in parameter
|
19
|
+
file_pattern = ARGV[1].sub(/^(.*)=/, '')
|
20
|
+
test_type = $1
|
21
|
+
folder = case test_type
|
22
|
+
when 'u' then 'unit/'
|
23
|
+
when 'f' then 'functional/'
|
24
|
+
when 'i' then 'integration/'
|
25
|
+
else ''
|
26
|
+
end
|
27
|
+
file_pattern.gsub!('.rb', "")
|
28
|
+
filelist = FileList["test/#{folder}**/*#{file_pattern}*.rb"]
|
29
|
+
puts filelist.inspect
|
30
|
+
|
31
|
+
t.test_files = filelist
|
32
|
+
t.libs << "test"
|
33
|
+
t.verbose = true
|
34
|
+
|
35
|
+
# filter by test name
|
36
|
+
if ARGV[2] && ARGV[2][0..1] == 'n='
|
37
|
+
t.options = "--name='/#{ARGV[2].split('=').last}/'"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Sergey Kojin"]
|
5
|
+
gem.email = ["sergey.kojin@gmail.com"]
|
6
|
+
gem.description = %q{Set of rake tasksе that let's you type less to run tests. }
|
7
|
+
gem.summary = %q{Shortcuts for rails tests}
|
8
|
+
gem.homepage = "https://github.com/skojin/rails_test_shortcuts"
|
9
|
+
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = "rails_test_shortcuts"
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = '0.1.0'
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_test_shortcuts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Sergey Kojin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-06-22 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: "Set of rake tasks\xD0\xB5 that let's you type less to run tests. "
|
22
|
+
email:
|
23
|
+
- sergey.kojin@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- LICENSE
|
33
|
+
- README.md
|
34
|
+
- lib/rails_test_shortcuts.rb
|
35
|
+
- lib/rails_test_shortcuts/railtie.rb
|
36
|
+
- lib/tasks/testing.rake
|
37
|
+
- rails_test_shortcuts.gemspec
|
38
|
+
homepage: https://github.com/skojin/rails_test_shortcuts
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.8.11
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Shortcuts for rails tests
|
71
|
+
test_files: []
|
72
|
+
|