twtest 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +1 -2
- data/Gemfile +0 -2
- data/README.md +8 -0
- data/lib/twtest.rb +1 -2
- data/lib/twtest/testcase.rb +18 -10
- data/lib/twtest/version.rb +1 -1
- data/test/test_helper.rb +1 -0
- data/test/unit/test_testcase.rb +9 -8
- data/twtest.gemspec +3 -4
- metadata +22 -45
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d9ad2d1a2918b12694321e2f72eade869df27dd8
|
4
|
+
data.tar.gz: 95a3f3030bad151b4a15f928ef3f29275894fbbd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fa1d21028e9ab423cbaf94299569b85d290a6e6ce4520f54fc47052038ef745dc8236c6e5ffb11e086f011e23f4df2d8e58b4e8282aeb955855183e1cab31b6c
|
7
|
+
data.tar.gz: 831f73f9f2417553e84b341d89b61fb042987d2328ab31243c1dad083a693d035022bdd9b6d559d3a2156b725146e675d7b138f7181b1ef701c5d7da99c4be63
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -29,3 +29,11 @@ Have a look at the [example](/nerab/twtest/blob/master/test/unit/test_example.rb
|
|
29
29
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
30
30
|
4. Push to the branch (`git push origin my-new-feature`)
|
31
31
|
5. Create new Pull Request
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
If you hack on a project and find the need to use a custom version of `twtest`, configure *your* project to prefer a local git clone over the gem:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
bundle config local.twtest ../twtest
|
39
|
+
```
|
data/lib/twtest.rb
CHANGED
data/lib/twtest/testcase.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module TaskWarrior
|
2
4
|
module Test
|
3
5
|
module Integration
|
4
6
|
class TestCase < ::Test::Unit::TestCase
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
@taskrc_file = nil
|
10
|
+
@data_dir = nil
|
11
|
+
end
|
12
|
+
|
5
13
|
def setup
|
6
14
|
assert(task('--version') =~ /2\.\d\.\d/, "The TaskWarrior binary '#{TASK}' must be available and at least v2.0.")
|
7
15
|
@data_dir = Dir.mktmpdir
|
@@ -12,14 +20,14 @@ module TaskWarrior
|
|
12
20
|
FileUtils.rm_r(@data_dir) if @data_dir && Dir.exist?(@data_dir)
|
13
21
|
File.delete(@taskrc_file) if @taskrc_file && File.exist?(@taskrc_file)
|
14
22
|
end
|
15
|
-
|
23
|
+
|
16
24
|
protected
|
17
25
|
def export_tasks(args = {})
|
18
26
|
json = task('export', args)
|
19
27
|
raise "Empty JSON returned by task command" if json.nil? || json.empty?
|
20
|
-
|
28
|
+
JSON.parse(json)
|
21
29
|
end
|
22
|
-
|
30
|
+
|
23
31
|
def task(cmd, args = {})
|
24
32
|
ENV['TASKRC'] = @taskrc_file
|
25
33
|
%x[#{build_line(cmd, args)}]
|
@@ -33,16 +41,16 @@ module TaskWarrior
|
|
33
41
|
line.reject!{|part| part.empty?}
|
34
42
|
}.join(' ')
|
35
43
|
end
|
36
|
-
|
44
|
+
|
37
45
|
def build_taskrc(options = {})
|
38
|
-
|
46
|
+
taskrc = Tempfile.new('taskrc')
|
39
47
|
data_dir = options[:data_dir]
|
40
|
-
|
48
|
+
|
41
49
|
begin
|
42
|
-
|
43
|
-
return
|
50
|
+
taskrc.write(ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'taskrc.erb')), 0, "%<>").result(binding))
|
51
|
+
return taskrc.path
|
44
52
|
ensure
|
45
|
-
|
53
|
+
taskrc.close
|
46
54
|
end
|
47
55
|
end
|
48
56
|
|
@@ -51,4 +59,4 @@ module TaskWarrior
|
|
51
59
|
end
|
52
60
|
end
|
53
61
|
end
|
54
|
-
end
|
62
|
+
end
|
data/lib/twtest/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/unit/test_testcase.rb
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
class TestTestCase < TaskWarrior::Test::Integration::TestCase
|
4
5
|
def test_empty
|
5
6
|
# http://taskwarrior.org/issues/1017
|
6
7
|
# assert_empty(export_tasks)
|
7
|
-
|
8
|
+
|
8
9
|
# Use a placeholder as workaround
|
9
10
|
task("add placeholder")
|
10
11
|
assert_equal(1, export_tasks.size)
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
def test_import
|
14
15
|
contents = {:description => "foobar"}
|
15
16
|
input_file = Tempfile.new('test_simple')
|
16
|
-
|
17
|
+
|
17
18
|
begin
|
18
|
-
input_file.write(
|
19
|
+
input_file.write(JSON.dump(contents))
|
19
20
|
input_file.close
|
20
|
-
|
21
|
+
|
21
22
|
# TODO Replace temp file with in-process version
|
22
|
-
# task("import <(echo '#{
|
23
|
+
# task("import <(echo '#{JSON.dump(contents)}')")
|
23
24
|
task("import #{input_file.path}")
|
24
|
-
|
25
|
+
|
25
26
|
tasks = export_tasks
|
26
27
|
assert_equal(1, tasks.size)
|
27
28
|
assert_equal('foobar', tasks.first['description'])
|
@@ -29,4 +30,4 @@ class TestTestCase < TaskWarrior::Test::Integration::TestCase
|
|
29
30
|
input_file.unlink
|
30
31
|
end
|
31
32
|
end
|
32
|
-
end
|
33
|
+
end
|
data/twtest.gemspec
CHANGED
@@ -14,8 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.version = TaskWarrior::Test::Integration::VERSION
|
16
16
|
|
17
|
-
gem.add_development_dependency '
|
18
|
-
gem.add_development_dependency 'guard-
|
19
|
-
gem.add_development_dependency '
|
20
|
-
gem.add_development_dependency 'rake', '~> 0.9'
|
17
|
+
gem.add_development_dependency 'guard-test'
|
18
|
+
gem.add_development_dependency 'guard-bundler'
|
19
|
+
gem.add_development_dependency 'rake'
|
21
20
|
end
|
metadata
CHANGED
@@ -1,80 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nicholas E. Rabenau
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-06-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: multi_json
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.3'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.3'
|
30
13
|
- !ruby/object:Gem::Dependency
|
31
14
|
name: guard-test
|
32
15
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
16
|
requirements:
|
35
|
-
- -
|
17
|
+
- - ">="
|
36
18
|
- !ruby/object:Gem::Version
|
37
|
-
version: '0
|
19
|
+
version: '0'
|
38
20
|
type: :development
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - ">="
|
44
25
|
- !ruby/object:Gem::Version
|
45
|
-
version: '0
|
26
|
+
version: '0'
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: guard-bundler
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
|
-
- -
|
31
|
+
- - ">="
|
52
32
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
33
|
+
version: '0'
|
54
34
|
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
|
-
- -
|
38
|
+
- - ">="
|
60
39
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
40
|
+
version: '0'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
42
|
name: rake
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - ">="
|
68
46
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
47
|
+
version: '0'
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - ">="
|
76
53
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0
|
54
|
+
version: '0'
|
78
55
|
description: Provides helpers for writing TaskWarrior integration tests in Ruby
|
79
56
|
email:
|
80
57
|
- nerab@gmx.net
|
@@ -82,8 +59,9 @@ executables: []
|
|
82
59
|
extensions: []
|
83
60
|
extra_rdoc_files: []
|
84
61
|
files:
|
85
|
-
- .gitignore
|
86
|
-
- .
|
62
|
+
- ".gitignore"
|
63
|
+
- ".ruby-version"
|
64
|
+
- ".travis.yml"
|
87
65
|
- Gemfile
|
88
66
|
- Guardfile
|
89
67
|
- LICENSE
|
@@ -100,27 +78,26 @@ files:
|
|
100
78
|
- twtest.gemspec
|
101
79
|
homepage:
|
102
80
|
licenses: []
|
81
|
+
metadata: {}
|
103
82
|
post_install_message:
|
104
83
|
rdoc_options: []
|
105
84
|
require_paths:
|
106
85
|
- lib
|
107
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
87
|
requirements:
|
110
|
-
- -
|
88
|
+
- - ">="
|
111
89
|
- !ruby/object:Gem::Version
|
112
90
|
version: '0'
|
113
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
92
|
requirements:
|
116
|
-
- -
|
93
|
+
- - ">="
|
117
94
|
- !ruby/object:Gem::Version
|
118
95
|
version: '0'
|
119
96
|
requirements: []
|
120
97
|
rubyforge_project:
|
121
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.6.11
|
122
99
|
signing_key:
|
123
|
-
specification_version:
|
100
|
+
specification_version: 4
|
124
101
|
summary: Helpers for writing TaskWarrior tests in Ruby
|
125
102
|
test_files:
|
126
103
|
- test/test_helper.rb
|