delta_test 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +22 -34
  4. data/Rakefile +5 -2
  5. data/bin/delta_test +1 -1
  6. data/circle.yml +5 -1
  7. data/delta_test.gemspec +1 -1
  8. data/lib/delta_test/cli/command_base.rb +114 -0
  9. data/lib/delta_test/cli/exec_command.rb +95 -0
  10. data/lib/delta_test/cli/help_command.rb +38 -0
  11. data/lib/delta_test/cli/specs_command.rb +43 -0
  12. data/lib/delta_test/cli/stats_clean_command.rb +20 -0
  13. data/lib/delta_test/cli/stats_save_command.rb +67 -0
  14. data/lib/delta_test/cli/stats_show_command.rb +46 -0
  15. data/lib/delta_test/cli/version_command.rb +13 -0
  16. data/lib/delta_test/cli.rb +22 -296
  17. data/lib/delta_test/configuration.rb +57 -42
  18. data/lib/delta_test/errors.rb +24 -0
  19. data/lib/delta_test/generator.rb +4 -24
  20. data/lib/delta_test/git.rb +161 -80
  21. data/lib/delta_test/profiler.rb +8 -0
  22. data/lib/delta_test/related_spec_list.rb +14 -9
  23. data/lib/delta_test/stats.rb +41 -0
  24. data/lib/delta_test/version.rb +2 -2
  25. data/lib/delta_test.rb +14 -9
  26. data/spec/lib/delta_test/cli/command_base_spec.rb +164 -0
  27. data/spec/lib/delta_test/cli/exec_command_spec.rb +128 -0
  28. data/spec/lib/delta_test/cli/help_command_spec.rb +17 -0
  29. data/spec/lib/delta_test/cli/specs_command_spec.rb +54 -0
  30. data/spec/lib/delta_test/cli/stats_clean_command_spec.rb +39 -0
  31. data/spec/lib/delta_test/cli/stats_save_command_spec.rb +207 -0
  32. data/spec/lib/delta_test/cli/stats_show_command_spec.rb +52 -0
  33. data/spec/lib/delta_test/cli/version_command_spec.rb +17 -0
  34. data/spec/lib/delta_test/cli_spec.rb +47 -386
  35. data/spec/lib/delta_test/configuration_spec.rb +99 -47
  36. data/spec/lib/delta_test/dependencies_table_spec.rb +1 -1
  37. data/spec/lib/delta_test/generator_spec.rb +3 -3
  38. data/spec/lib/delta_test/git_spec.rb +291 -50
  39. data/spec/lib/delta_test/profiler_spec.rb +3 -3
  40. data/spec/lib/delta_test/related_spec_list_spec.rb +12 -14
  41. data/spec/lib/delta_test/stats_spec.rb +89 -0
  42. data/spec/lib/delta_test/utils_spec.rb +4 -4
  43. data/spec/lib/delta_test_spec.rb +13 -4
  44. data/spec/rails/Gemfile.lock +5 -2
  45. data/spec/rails/app/models/category.rb +4 -0
  46. data/spec/rails/delta_test.yml +4 -3
  47. data/spec/rails/spec/models/category_spec.rb +4 -0
  48. data/spec/spec_helper.rb +9 -2
  49. data/spec/supports/create_table_file.rb +11 -1
  50. data/visual.jpg +0 -0
  51. metadata +32 -4
@@ -1,6 +1,6 @@
1
1
  describe DeltaTest do
2
2
 
3
- describe '::configure' do
3
+ describe '.configure' do
4
4
 
5
5
  it 'should change option values inside a block' do
6
6
  expect {
@@ -12,7 +12,7 @@ describe DeltaTest do
12
12
 
13
13
  end
14
14
 
15
- describe '::active?' do
15
+ describe '.active?' do
16
16
 
17
17
  context 'Initial' do
18
18
 
@@ -48,7 +48,7 @@ describe DeltaTest do
48
48
 
49
49
  end
50
50
 
51
- describe '::verbose?' do
51
+ describe '.verbose?' do
52
52
 
53
53
  context 'Initial' do
54
54
 
@@ -84,7 +84,7 @@ describe DeltaTest do
84
84
 
85
85
  end
86
86
 
87
- describe '::log' do
87
+ describe '.log' do
88
88
 
89
89
  context 'In verbose mode' do
90
90
 
@@ -116,4 +116,13 @@ describe DeltaTest do
116
116
 
117
117
  end
118
118
 
119
+ describe '.tester_id' do
120
+
121
+ it 'should return an unique id for process' do
122
+ expect(DeltaTest.tester_id).to be_a(String)
123
+ expect(DeltaTest.tester_id).to match(/\Ap\d+t\d+n\d+\z/)
124
+ end
125
+
126
+ end
127
+
119
128
  end
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: ../..
13
13
  specs:
14
- delta_test (0.1.0)
14
+ delta_test (1.0.0)
15
15
 
16
16
  GEM
17
17
  remote: https://rubygems.org/
@@ -86,7 +86,7 @@ GEM
86
86
  ruby_parser (~> 3.5)
87
87
  i18n (0.7.0)
88
88
  json (1.8.2)
89
- libv8 (3.16.14.7)
89
+ libv8 (3.16.14.13)
90
90
  loofah (2.0.1)
91
91
  nokogiri (>= 1.5.9)
92
92
  mail (2.6.3)
@@ -195,3 +195,6 @@ DEPENDENCIES
195
195
  spring
196
196
  sqlite3
197
197
  therubyracer
198
+
199
+ BUNDLED WITH
200
+ 1.10.6
@@ -11,4 +11,8 @@ class Category < ActiveRecord::Base
11
11
  presence: true,
12
12
  length: { maximum: 100 }
13
13
 
14
+ def test
15
+ true
16
+ end
17
+
14
18
  end
@@ -1,5 +1,6 @@
1
- table_file: tmp/.delta_test_dt
1
+ base_path: ../..
2
+ stats_path: tmp/delta_test_stats
2
3
 
3
4
  patterns:
4
- - app/**/*.rb
5
- - config/locales/**/*.yml
5
+ - spec/rails/app/**/*.rb
6
+ - spec/rails/config/locales/**/*.yml
@@ -1,3 +1,7 @@
1
1
  describe Category do
2
2
 
3
+ it 'should be able to create new model' do
4
+ expect{ Category.new(name: 'test').test }.not_to raise_error
5
+ end
6
+
3
7
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec'
2
+ require 'pry'
2
3
  require 'fakefs/spec_helpers'
3
4
  require 'codeclimate-test-reporter'
4
5
 
@@ -7,6 +8,8 @@ require 'delta_test'
7
8
  Dir["#{File.dirname(__FILE__)}/fixtures/**/*.rb"].each { |f| require f }
8
9
  Dir["#{File.dirname(__FILE__)}/supports/**/*.rb"].each { |f| require f }
9
10
 
11
+ Pry.config.history.should_load = false
12
+ Pry.config.history.should_save = false
10
13
 
11
14
  module DeltaTestSpecHelper
12
15
 
@@ -25,17 +28,21 @@ RSpec.configure do |config|
25
28
 
26
29
  config.expect_with :rspec do |expectations|
27
30
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ expectations.warn_about_potential_false_positives = false
28
32
  end
29
33
 
30
34
  config.mock_with :rspec do |mocks|
31
35
  mocks.verify_partial_doubles = true
32
36
  end
33
37
 
34
- config.after do
38
+ config.before do
35
39
  DeltaTest.active = false
36
40
  DeltaTest.verbose = false
37
41
 
38
- DeltaTest.setup
42
+ allow_any_instance_of(DeltaTest::Git).to receive(:git_repo?).and_return(true)
43
+
44
+ allow($stdout).to receive(:puts).with(any_args).and_return(nil)
45
+ allow($stderr).to receive(:puts).with(any_args).and_return(nil)
39
46
  end
40
47
 
41
48
  end
@@ -1,6 +1,15 @@
1
1
  shared_examples :defer_create_table_file do
2
2
 
3
- let(:table_file_path) { "/base_path/table_file" }
3
+ let(:stats_path) { '/base_path/stats_path' }
4
+ let(:tmp_stats_file_path) { [stats_path, 'tmp', DeltaTest.tester_id].join('/') }
5
+
6
+ let(:table_file_path) { Pathname.new('/base_path/file_path') }
7
+
8
+ let(:tmp_stats_file) do
9
+ file = FakeFS::FakeFile.new
10
+ FakeFS::FileSystem.add(tmp_stats_file_path, file)
11
+ file
12
+ end
4
13
 
5
14
  let(:table_file) do
6
15
  file = FakeFS::FakeFile.new
@@ -15,6 +24,7 @@ shared_examples :create_table_file do
15
24
  include_examples :defer_create_table_file
16
25
 
17
26
  before do
27
+ tmp_stats_file
18
28
  table_file
19
29
  end
20
30
 
data/visual.jpg ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delta_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Iwanaga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '3.4'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '3.4'
111
111
  description: delta_test analyzes your tests and runs only related tests for your file
112
112
  changes
113
113
  email:
@@ -134,6 +134,14 @@ files:
134
134
  - ext/delta_test/extconf.rb
135
135
  - lib/delta_test.rb
136
136
  - lib/delta_test/cli.rb
137
+ - lib/delta_test/cli/command_base.rb
138
+ - lib/delta_test/cli/exec_command.rb
139
+ - lib/delta_test/cli/help_command.rb
140
+ - lib/delta_test/cli/specs_command.rb
141
+ - lib/delta_test/cli/stats_clean_command.rb
142
+ - lib/delta_test/cli/stats_save_command.rb
143
+ - lib/delta_test/cli/stats_show_command.rb
144
+ - lib/delta_test/cli/version_command.rb
137
145
  - lib/delta_test/configuration.rb
138
146
  - lib/delta_test/dependencies_table.rb
139
147
  - lib/delta_test/errors.rb
@@ -142,11 +150,20 @@ files:
142
150
  - lib/delta_test/profiler.rb
143
151
  - lib/delta_test/related_spec_list.rb
144
152
  - lib/delta_test/spec_helpers.rb
153
+ - lib/delta_test/stats.rb
145
154
  - lib/delta_test/utils.rb
146
155
  - lib/delta_test/version.rb
147
156
  - spec/fixtures/sample/alpha.rb
148
157
  - spec/fixtures/sample/beta.rb
149
158
  - spec/fixtures/sample/gamma.rb
159
+ - spec/lib/delta_test/cli/command_base_spec.rb
160
+ - spec/lib/delta_test/cli/exec_command_spec.rb
161
+ - spec/lib/delta_test/cli/help_command_spec.rb
162
+ - spec/lib/delta_test/cli/specs_command_spec.rb
163
+ - spec/lib/delta_test/cli/stats_clean_command_spec.rb
164
+ - spec/lib/delta_test/cli/stats_save_command_spec.rb
165
+ - spec/lib/delta_test/cli/stats_show_command_spec.rb
166
+ - spec/lib/delta_test/cli/version_command_spec.rb
150
167
  - spec/lib/delta_test/cli_spec.rb
151
168
  - spec/lib/delta_test/configuration_spec.rb
152
169
  - spec/lib/delta_test/dependencies_table_spec.rb
@@ -155,6 +172,7 @@ files:
155
172
  - spec/lib/delta_test/profiler_spec.rb
156
173
  - spec/lib/delta_test/related_spec_list_spec.rb
157
174
  - spec/lib/delta_test/spec_helpers_spec.rb
175
+ - spec/lib/delta_test/stats_spec.rb
158
176
  - spec/lib/delta_test/utils_spec.rb
159
177
  - spec/lib/delta_test_spec.rb
160
178
  - spec/rails/.gitignore
@@ -230,6 +248,7 @@ files:
230
248
  - spec/rails/vendor/assets/stylesheets/.keep
231
249
  - spec/spec_helper.rb
232
250
  - spec/supports/create_table_file.rb
251
+ - visual.jpg
233
252
  homepage: http://github.com/creasty/delta_test
234
253
  licenses:
235
254
  - MIT
@@ -258,6 +277,14 @@ test_files:
258
277
  - spec/fixtures/sample/alpha.rb
259
278
  - spec/fixtures/sample/beta.rb
260
279
  - spec/fixtures/sample/gamma.rb
280
+ - spec/lib/delta_test/cli/command_base_spec.rb
281
+ - spec/lib/delta_test/cli/exec_command_spec.rb
282
+ - spec/lib/delta_test/cli/help_command_spec.rb
283
+ - spec/lib/delta_test/cli/specs_command_spec.rb
284
+ - spec/lib/delta_test/cli/stats_clean_command_spec.rb
285
+ - spec/lib/delta_test/cli/stats_save_command_spec.rb
286
+ - spec/lib/delta_test/cli/stats_show_command_spec.rb
287
+ - spec/lib/delta_test/cli/version_command_spec.rb
261
288
  - spec/lib/delta_test/cli_spec.rb
262
289
  - spec/lib/delta_test/configuration_spec.rb
263
290
  - spec/lib/delta_test/dependencies_table_spec.rb
@@ -266,6 +293,7 @@ test_files:
266
293
  - spec/lib/delta_test/profiler_spec.rb
267
294
  - spec/lib/delta_test/related_spec_list_spec.rb
268
295
  - spec/lib/delta_test/spec_helpers_spec.rb
296
+ - spec/lib/delta_test/stats_spec.rb
269
297
  - spec/lib/delta_test/utils_spec.rb
270
298
  - spec/lib/delta_test_spec.rb
271
299
  - spec/rails/.gitignore