twtest 0.0.7 → 1.0.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
- SHA1:
3
- metadata.gz: d9ad2d1a2918b12694321e2f72eade869df27dd8
4
- data.tar.gz: 95a3f3030bad151b4a15f928ef3f29275894fbbd
2
+ SHA256:
3
+ metadata.gz: afa8600e3d8cf187b14668f6b1204b797f19d411470643796b831da4d1ce4d96
4
+ data.tar.gz: 4fe480482f0ebbbcc75bcf462b87632d7deec8f2acfbf639fb33afcac79d3258
5
5
  SHA512:
6
- metadata.gz: fa1d21028e9ab423cbaf94299569b85d290a6e6ce4520f54fc47052038ef745dc8236c6e5ffb11e086f011e23f4df2d8e58b4e8282aeb955855183e1cab31b6c
7
- data.tar.gz: 831f73f9f2417553e84b341d89b61fb042987d2328ab31243c1dad083a693d035022bdd9b6d559d3a2156b725146e675d7b138f7181b1ef701c5d7da99c4be63
6
+ metadata.gz: 1f72c54e0000392c6fea3fb1e5e56a8e8f64e975f31f4bfea379126668596bd848d4ad017f900889c1846717964502b3b7a974e1fdbc0e922cb5bc62f1f01c42
7
+ data.tar.gz: 768ef77d883fa25012b99e611f6c2da27b750690175c7a1a7ea61cacd33d9a2329392d387fe11eafddc5a9a0d29b75afaa7cc7afd3ca07b55539a8e633790b53
@@ -0,0 +1,175 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5.0
3
+ Include:
4
+ - '**/Gemfile'
5
+ - '**/Rakefile'
6
+ - '**/config.ru'
7
+ - '**/*.rake'
8
+ Exclude:
9
+ - vendor/**/*
10
+ - db/migrations/**/*
11
+ - Brewfile
12
+
13
+ DisplayCopNames:
14
+ Enabled: true
15
+
16
+ DisplayStyleGuide:
17
+ Enabled: true
18
+
19
+ Style/FileName:
20
+ Exclude:
21
+ - Guardfile
22
+
23
+ Metrics/BlockLength:
24
+ Exclude:
25
+ - spec/**/*
26
+
27
+ Lint/AmbiguousRegexpLiteral:
28
+ Enabled: false
29
+
30
+ Lint/HandleExceptions:
31
+ Enabled: true
32
+
33
+ Lint/UnusedBlockArgument:
34
+ Enabled: false
35
+
36
+ Lint/UnusedMethodArgument:
37
+ Enabled: false
38
+
39
+ Metrics/AbcSize:
40
+ Enabled: false
41
+
42
+ Metrics/ClassLength:
43
+ Enabled: false
44
+
45
+ Metrics/CyclomaticComplexity:
46
+ Max: 12
47
+
48
+ Metrics/LineLength:
49
+ Max: 180
50
+
51
+ Metrics/MethodLength:
52
+ Max: 60
53
+
54
+ Metrics/ModuleLength:
55
+ Enabled: false
56
+
57
+ Metrics/ParameterLists:
58
+ Enabled: false
59
+
60
+ Metrics/PerceivedComplexity:
61
+ Enabled: false
62
+
63
+ Performance/Casecmp:
64
+ Enabled: false
65
+
66
+ Performance/Sample:
67
+ Enabled: false
68
+
69
+ Style/Alias:
70
+ EnforcedStyle: prefer_alias_method
71
+
72
+ Style/AlignParameters:
73
+ Enabled: false
74
+
75
+ Style/BlockDelimiters:
76
+ Enabled: false
77
+
78
+ Style/BracesAroundHashParameters:
79
+ Enabled: false
80
+
81
+ Style/ClassAndModuleChildren:
82
+ Enabled: false
83
+
84
+ Style/ClosingParenthesisIndentation:
85
+ Enabled: false
86
+
87
+ Style/Documentation:
88
+ Enabled: false
89
+
90
+ Style/DotPosition:
91
+ EnforcedStyle: trailing
92
+
93
+ Style/DoubleNegation:
94
+ Enabled: false
95
+
96
+ Style/EachWithObject:
97
+ Enabled: false
98
+
99
+ Style/FormatString:
100
+ EnforcedStyle: sprintf
101
+
102
+ Style/GuardClause:
103
+ Enabled: false
104
+
105
+ Style/IfUnlessModifier:
106
+ Enabled: false
107
+
108
+ Style/IndentArray:
109
+ EnforcedStyle: consistent
110
+
111
+ Style/IndentHash:
112
+ Enabled: false
113
+
114
+ Style/Lambda:
115
+ Enabled: false
116
+
117
+ Style/MultilineBlockChain:
118
+ Enabled: false
119
+
120
+ Style/MultilineBlockLayout:
121
+ Enabled: false
122
+
123
+ Style/MultilineOperationIndentation:
124
+ Enabled: false
125
+
126
+ Style/NegatedIf:
127
+ Enabled: false
128
+
129
+ Style/Next:
130
+ Enabled: false
131
+
132
+ Style/NumericLiterals:
133
+ Enabled: false
134
+
135
+ Style/PredicateName:
136
+ Enabled: false
137
+
138
+ Style/RaiseArgs:
139
+ EnforcedStyle: compact
140
+
141
+ Style/RedundantSelf:
142
+ Enabled: false
143
+
144
+ Style/RescueModifier:
145
+ Enabled: false
146
+
147
+ Style/SignalException:
148
+ Enabled: false
149
+
150
+ Style/SingleLineBlockParams:
151
+ Enabled: false
152
+
153
+ Style/SpaceAroundEqualsInParameterDefault:
154
+ EnforcedStyle: no_space
155
+
156
+ Style/StructInheritance:
157
+ Enabled: false
158
+
159
+ Style/TrailingCommaInArguments:
160
+ Enabled: false
161
+
162
+ Style/TrailingCommaInLiteral:
163
+ Enabled: false
164
+
165
+ Style/TrailingUnderscoreVariable:
166
+ Enabled: false
167
+
168
+ Style/TrivialAccessors:
169
+ Enabled: false
170
+
171
+ Style/WordArray:
172
+ Enabled: false
173
+
174
+ Style/ZeroLengthPredicate:
175
+ Enabled: false
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.5.0
@@ -1,13 +1,11 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.4.1
4
+ - 2.5.0
5
5
 
6
6
  before_script:
7
7
  - mkdir ~/.task
8
8
  - echo data.location=~/.task > ~/.taskrc
9
9
 
10
10
  before_install:
11
- - echo | sudo add-apt-repository ppa:ultrafredde/ppa
12
- - sudo apt-get update
13
11
  - sudo apt-get install task
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
data/Guardfile CHANGED
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard 'bundler' do
2
4
  watch('Gemfile')
3
5
  watch(/^.+\.gemspec/)
4
6
  end
5
7
 
6
- guard :test, :test_paths => ['test/unit', 'test/integration'] do
7
- watch('lib/twdeps.rb'){"test"}
8
- watch(%r{^lib/twdeps/(.+)\.rb$}){|m| "test/unit/test_#{m[1]}.rb"}
8
+ guard :test, test_paths: ['test/unit', 'test/integration'] do
9
+ watch('lib/twdeps.rb') { 'test' }
10
+ watch(%r{^lib/twdeps/(.+)\.rb$}) { |m| "test/unit/test_#{m[1]}.rb" }
9
11
  watch(%r{^test/unit/test_(.+)\.rb$})
10
- watch('test/test_helper.rb'){"test"}
11
- watch('test/helpers/**/*'){"test"}
12
+ watch('test/test_helper.rb') { 'test' }
13
+ watch('test/helpers/**/*') { 'test' }
12
14
  end
data/Rakefile CHANGED
@@ -1,10 +1,14 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
3
4
  require 'rake/testtask'
4
5
 
6
+ require 'rubocop/rake_task'
7
+ RuboCop::RakeTask.new
8
+
5
9
  Rake::TestTask.new(:test) do |test|
6
10
  test.libs << 'lib' << 'test' << 'test/helpers'
7
11
  test.test_files = FileList['test/**/test_*.rb']
8
12
  end
9
13
 
10
- task :default => :test
14
+ task default: %i[rubocop test]
@@ -1,11 +1,13 @@
1
- require 'test/unit'
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest'
2
4
  require 'tmpdir'
3
5
  require 'erb'
4
6
  require 'shellwords'
5
7
  require 'tempfile'
6
8
 
7
- require "twtest/version"
8
- require "twtest/testcase"
9
+ require 'twtest/version'
10
+ require 'twtest/test'
9
11
 
10
12
  module TaskWarrior
11
13
  module Test
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module TaskWarrior
4
6
  module Test
5
7
  module Integration
6
- class TestCase < ::Test::Unit::TestCase
8
+ class Test < MiniTest::Test
7
9
  def initialize(*args)
8
10
  super
9
11
  @taskrc_file = nil
@@ -13,7 +15,7 @@ module TaskWarrior
13
15
  def setup
14
16
  assert(task('--version') =~ /2\.\d\.\d/, "The TaskWarrior binary '#{TASK}' must be available and at least v2.0.")
15
17
  @data_dir = Dir.mktmpdir
16
- @taskrc_file = build_taskrc(:data_dir => @data_dir)
18
+ @taskrc_file = build_taskrc(data_dir: @data_dir)
17
19
  end
18
20
 
19
21
  def teardown
@@ -21,40 +23,40 @@ module TaskWarrior
21
23
  File.delete(@taskrc_file) if @taskrc_file && File.exist?(@taskrc_file)
22
24
  end
23
25
 
24
- protected
25
- def export_tasks(args = {})
26
+ protected
27
+
28
+ def export_tasks(args={})
26
29
  json = task('export', args)
27
- raise "Empty JSON returned by task command" if json.nil? || json.empty?
30
+ raise 'Empty JSON returned by task command' if json.nil? || json.empty?
28
31
  JSON.parse(json)
29
32
  end
30
33
 
31
- def task(cmd, args = {})
34
+ def task(cmd, args={})
32
35
  ENV['TASKRC'] = @taskrc_file
33
- %x[#{build_line(cmd, args)}]
36
+ `#{build_line(cmd, args)}`
34
37
  end
35
38
 
36
- def build_line(cmd, args = {})
37
- [].tap{|line|
39
+ def build_line(cmd, args={})
40
+ [].tap { |line|
38
41
  line << TASK
39
- line << args.map{|k,v| "#{Shellwords.escape(k.strip)}=#{Shellwords.escape(v.strip)}"}.join(' ')
42
+ line << args.map { |k, v| "#{Shellwords.escape(k.strip)}=#{Shellwords.escape(v.strip)}" }.join(' ')
40
43
  line << cmd.strip
41
- line.reject!{|part| part.empty?}
44
+ line.reject!(&:empty?)
42
45
  }.join(' ')
43
46
  end
44
47
 
45
- def build_taskrc(options = {})
48
+ def build_taskrc(options={})
46
49
  taskrc = Tempfile.new('taskrc')
47
- data_dir = options[:data_dir]
50
+ @data_dir = options[:data_dir]
48
51
 
49
52
  begin
50
- taskrc.write(ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'taskrc.erb')), 0, "%<>").result(binding))
53
+ taskrc.write(ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'taskrc.erb')), 0, '%<>').result(binding))
51
54
  return taskrc.path
52
55
  ensure
53
56
  taskrc.close
54
57
  end
55
58
  end
56
59
 
57
- private
58
60
  TASK = 'task'
59
61
  end
60
62
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module TaskWarrior
2
4
  module Test
3
5
  module Integration
4
- VERSION = '0.0.7'
6
+ VERSION = '1.0.0'
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
- data.location=<%= data_dir %>
1
+ data.location=<%= @data_dir %>
2
2
  json.array=on
3
3
  verbose=off
@@ -1,5 +1,5 @@
1
- require 'bundler'
2
- Bundler.require
1
+ # frozen_string_literal: true
3
2
 
3
+ require 'minitest/autorun'
4
4
  require 'json'
5
5
  require 'twtest'
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
- class TestCommandLine < TaskWarrior::Test::Integration::TestCase
5
+ class TestCommandLine < TaskWarrior::Test::Integration::Test
4
6
  def test_plain
5
7
  assert_equal('task foo', build_line('foo'))
6
8
  end
@@ -20,4 +22,4 @@ class TestCommandLine < TaskWarrior::Test::Integration::TestCase
20
22
  def test_command_with_blanks
21
23
  assert_equal('task something', build_line(' something '))
22
24
  end
23
- end
25
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'twtest'
2
4
 
3
- class ExampleTest < TaskWarrior::Test::Integration::TestCase
4
- GTD = "get things done"
5
+ class ExampleTest < TaskWarrior::Test::Integration::Test
6
+ GTD = 'get things done'
5
7
 
6
8
  def test_empty
7
9
  task("add #{GTD}")
@@ -1,26 +1,27 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
  require 'json'
3
5
 
4
- class TestTestCase < TaskWarrior::Test::Integration::TestCase
6
+ class TestTest < TaskWarrior::Test::Integration::Test
5
7
  def test_empty
6
- # http://taskwarrior.org/issues/1017
7
- # assert_empty(export_tasks)
8
+ assert_empty(export_tasks)
8
9
 
9
10
  # Use a placeholder as workaround
10
- task("add placeholder")
11
+ task('add placeholder')
11
12
  assert_equal(1, export_tasks.size)
12
13
  end
13
14
 
14
15
  def test_import
15
- contents = {:description => "foobar"}
16
+ contents = { description: 'foobar' }
16
17
  input_file = Tempfile.new('test_simple')
17
18
 
18
19
  begin
19
20
  input_file.write(JSON.dump(contents))
20
21
  input_file.close
21
22
 
22
- # TODO Replace temp file with in-process version
23
- # task("import <(echo '#{JSON.dump(contents)}')")
23
+ # TODO: Replace temp file with in-process version
24
+ # task("import <(echo '#{JSON.dump(contents)}')")
24
25
  task("import #{input_file.path}")
25
26
 
26
27
  tasks = export_tasks
@@ -1,20 +1,24 @@
1
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
2
3
  require File.expand_path('../lib/twtest/version', __FILE__)
3
4
 
4
5
  Gem::Specification.new do |gem|
5
- gem.authors = ["Nicholas E. Rabenau"]
6
- gem.email = ["nerab@gmx.net"]
7
- gem.description = %q{Provides helpers for writing TaskWarrior integration tests in Ruby}
8
- gem.summary = %q{Helpers for writing TaskWarrior tests in Ruby}
6
+ gem.authors = ['Nicholas E. Rabenau']
7
+ gem.email = ['nerab@gmx.net']
8
+ gem.description = 'Provides helpers for writing TaskWarrior integration tests in Ruby'
9
+ gem.summary = 'Helpers for writing TaskWarrior tests in Ruby'
9
10
 
10
- gem.files = `git ls-files`.split($\)
11
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
12
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
- gem.name = "twtest"
14
- gem.require_paths = ["lib"]
14
+ gem.name = 'twtest'
15
+ gem.require_paths = ['lib']
15
16
  gem.version = TaskWarrior::Test::Integration::VERSION
16
17
 
17
- gem.add_development_dependency 'guard-test'
18
+ gem.add_dependency 'minitest'
19
+
18
20
  gem.add_development_dependency 'guard-bundler'
21
+ gem.add_development_dependency 'guard-minitest'
19
22
  gem.add_development_dependency 'rake'
23
+ gem.add_development_dependency 'rubocop'
20
24
  end
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas E. Rabenau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2018-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: guard-test
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :development
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: Provides helpers for writing TaskWarrior integration tests in Ruby
56
84
  email:
57
85
  - nerab@gmx.net
@@ -60,6 +88,7 @@ extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - ".gitignore"
91
+ - ".rubocop.yml"
63
92
  - ".ruby-version"
64
93
  - ".travis.yml"
65
94
  - Gemfile
@@ -68,13 +97,13 @@ files:
68
97
  - README.md
69
98
  - Rakefile
70
99
  - lib/twtest.rb
71
- - lib/twtest/testcase.rb
100
+ - lib/twtest/test.rb
72
101
  - lib/twtest/version.rb
73
102
  - templates/taskrc.erb
74
103
  - test/test_helper.rb
75
104
  - test/unit/test_commandline.rb
76
105
  - test/unit/test_example.rb
77
- - test/unit/test_testcase.rb
106
+ - test/unit/test_test.rb
78
107
  - twtest.gemspec
79
108
  homepage:
80
109
  licenses: []
@@ -95,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
124
  version: '0'
96
125
  requirements: []
97
126
  rubyforge_project:
98
- rubygems_version: 2.6.11
127
+ rubygems_version: 2.7.3
99
128
  signing_key:
100
129
  specification_version: 4
101
130
  summary: Helpers for writing TaskWarrior tests in Ruby
@@ -103,4 +132,4 @@ test_files:
103
132
  - test/test_helper.rb
104
133
  - test/unit/test_commandline.rb
105
134
  - test/unit/test_example.rb
106
- - test/unit/test_testcase.rb
135
+ - test/unit/test_test.rb