learn-test 3.3.0.pre.2 → 3.3.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
2
  SHA256:
3
- metadata.gz: 34479d2b40afafa001626db60d17a0f80273293a0d70817fc46b3c91e01f8b81
4
- data.tar.gz: 6423442bb278878a96673d8769a81eaa01bbcd56b12a1080b3e696298bb06f01
3
+ metadata.gz: f2c7dd60c1cafe4bd233f4a199c25e434761404f8bfb1404aed7f3252b16c99a
4
+ data.tar.gz: 5a43ca3b2d74d0a0107221d8436e4067e84ae53358ebaac7fddacd76cc868b94
5
5
  SHA512:
6
- metadata.gz: eedc292d447fcc1732ae73457fae8c1c574db19ddeeea0cd1a42a527d879c4757bd951a2b47af8e1b2913714d74cf5e955ebcb0b8605eb2f4beb3b50fac5a602
7
- data.tar.gz: d87fdc06850600e77021ac6891122a14a5c69bea2af562304b4d2c9e0345ea56823871f3a0b7f7e64077ee67873fc717662633562575ad6d2af734b75ca21ab1
6
+ metadata.gz: a72c51120e794a2f9e19109dcad02bc633f974ad57880bd319b7e07b832d705a0b5465e6ca3f8cc225dad4d70227b9a65c5c887ccd53437a5982bee6dc7cf7ab
7
+ data.tar.gz: b12583db44d75295101f9ebf904c395de1b2d943d6beec8b8c2ca007d5ec3bfc8ee5ee62a369b5b4a3a0cb8d6a6a1eebbc7b9ca699352a96b3d09dc0f7a5f4a4
@@ -8,7 +8,9 @@ require 'zeitwerk'
8
8
  loader = Zeitwerk::Loader.for_gem
9
9
  loader.inflector.inflect(
10
10
  'csharp' => 'CSharp',
11
- 'csharp_nunit' => 'CSharpNunit'
11
+ 'csharp_nunit' => 'CSharpNunit',
12
+ 'nodejs' => 'NodeJS',
13
+ 'phantomjs' => 'PhantomJS'
12
14
  )
13
15
  loader.setup
14
16
 
@@ -10,7 +10,6 @@ module LearnTest
10
10
  module Wip
11
11
  class Base < ::Git::Path
12
12
  TEMPFILE = '.wip'
13
- PREFIX = 'refs/wip/'
14
13
 
15
14
  attr_reader :working_branch, :wip_branch
16
15
 
@@ -21,11 +20,11 @@ module LearnTest
21
20
 
22
21
  current_branch = @base.current_branch
23
22
 
24
- raise NoCommitsError, 'master' if current_branch.nil? # TODO: Swap to `main`?
23
+ raise Errors::NoCommitsError, 'master' if current_branch.nil? # TODO: Swap to `main`?
25
24
 
26
25
  @tmp = Tempfile.new(TEMPFILE)
27
26
  @working_branch = Branch.new(base: @base, name: current_branch)
28
- @wip_branch = Branch.new(base: @base, name: "#{PREFIX}#{current_branch}")
27
+ @wip_branch = Reference.new(base: @base, name: current_branch)
29
28
  end
30
29
 
31
30
  def process!
@@ -44,9 +43,6 @@ module LearnTest
44
43
  new_tree = build_new_tree(@wip_branch.parent)
45
44
  @base.diff(new_tree, @wip_branch.parent)
46
45
 
47
- # tree_diff = @base.diff(new_tree, @wip_branch.parent)
48
- # raise LearnTest::Git::Wip::NoChangesError, @wip_branch if tree_diff.count.zero?
49
-
50
46
  commit = @base.commit_tree(new_tree, parent: @wip_branch.parent)
51
47
 
52
48
  @base.lib.send(:command, 'update-ref', ['-m', @message, @wip_branch, commit.objectish])
@@ -16,11 +16,13 @@ module LearnTest
16
16
  begin
17
17
  @base.revparse(@name)
18
18
  rescue ::Git::GitExecuteError => e
19
+ regex = Errors::NoCommitsError::REGEX
20
+
19
21
  if raise_no_commits
20
- raise e.message.match(LearnTest::Git::Wip::NoCommitsError::REGEX) ? LearnTest::Git::Wip::NoCommitsError.new(@name) : e
22
+ raise e.message.match(regex) ? Errors::NoCommitsError.new(@name) : e
21
23
  end
22
24
 
23
- raise unless e.message.match(LearnTest::Git::Wip::NoCommitsError::REGEX)
25
+ raise unless e.message.match(regex)
24
26
 
25
27
  false
26
28
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LearnTest
4
+ module Git
5
+ module Wip
6
+ module Errors
7
+ class BaseError < StandardError; end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LearnTest
4
+ module Git
5
+ module Wip
6
+ module Errors
7
+ class NoChangesError < BaseError
8
+ def initialize(branch)
9
+ super "No changes found on `#{branch}`"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LearnTest
4
+ module Git
5
+ module Wip
6
+ module Errors
7
+ class NoCommitsError < BaseError
8
+ REGEX = /unknown revision or path not in the working tree/i.freeze
9
+
10
+ def initialize(branch)
11
+ super "Branch `#{branch}` doesn't have any commits. Please commit and try again."
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module LearnTest
6
+ module Git
7
+ module Wip
8
+ class Reference < Branch
9
+ attr_accessor :parent
10
+
11
+ PREFIX = 'refs/wip/'
12
+
13
+ def initialize(base:, name:)
14
+ dir = File.join(base.repo.path, PREFIX)
15
+ file = File.join(dir, name)
16
+ sha = base.log(1)[0].sha
17
+
18
+ FileUtils.mkdir_p(dir, { mode: 0755 }) unless Dir.exist?(dir)
19
+ File.open(file, 'w+') { |f| f.puts sha } unless File.exist?(file)
20
+
21
+ super(base: base, name: "#{PREFIX}#{name}")
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -68,7 +68,7 @@ module LearnTest
68
68
  repo.push('origin', "#{res.wip_branch}:refs/heads/fis-wip", { force: true })
69
69
  rescue ::Git::GitExecuteError => e
70
70
  if @debug
71
- puts 'There was a problem connecting to Github. Not pushing current branch state.'.red
71
+ puts 'There was a problem connecting to GitHub. Not pushing current branch state.'.red
72
72
  puts e.message
73
73
  end
74
74
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LearnTest
4
- VERSION = '3.3.0.pre.2'
4
+ VERSION = '3.3.0'
5
5
  end
@@ -39,19 +39,24 @@ describe LearnTest::Git::Wip::Base do
39
39
  end
40
40
  end
41
41
 
42
- context 'no commits' do
43
- before(:each) { initialize_repo(commit: false) }
42
+ context 'no refs/wip' do
43
+ before(:each) { initialize_repo }
44
44
 
45
- it 'should raise' do
46
- expect { instance.process! }.to raise_error(LearnTest::Git::Wip::NoCommitsError)
45
+ it 'should create refs/wip' do
46
+ expect(FileUtils)
47
+ .to receive(:mkdir_p)
48
+ .with("#{path}/.git/refs/wip/", { mode: 0755 })
49
+ .and_call_original
50
+
51
+ instance.process!
47
52
  end
48
53
  end
49
54
 
50
- xcontext 'no changes' do
51
- before(:each) { initialize_repo }
55
+ context 'no commits' do
56
+ before(:each) { initialize_repo(commit: false) }
52
57
 
53
58
  it 'should raise' do
54
- expect { instance.process! }.to raise_error(LearnTest::Git::Wip::NoChangesError)
59
+ expect { instance.process! }.to raise_error(LearnTest::Git::Wip::Errors::NoCommitsError)
55
60
  end
56
61
  end
57
62
 
@@ -91,7 +91,7 @@ describe LearnTest::Git::Wip::Branch do
91
91
  expect do
92
92
  branch.last_revision(raise_no_commits: true)
93
93
  end.to raise_error(
94
- LearnTest::Git::Wip::NoCommitsError, "Branch `#{name}` doesn't have any commits. Please commit and try again."
94
+ LearnTest::Git::Wip::Errors::NoCommitsError, "Branch `#{name}` doesn't have any commits. Please commit and try again."
95
95
  )
96
96
  end
97
97
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe LearnTest::Git::Wip::Errors::BaseError do
4
+ it 'should inherit from StandardError' do
5
+ expect(described_class).to be < StandardError
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe LearnTest::Git::Wip::Errors::NoChangesError do
4
+ let(:branch) { rand(0..999_999).to_s }
5
+
6
+ it 'should inherit from Error' do
7
+ expect(described_class).to be < LearnTest::Git::Wip::Errors::BaseError
8
+ end
9
+
10
+ it 'should require a branch' do
11
+ expect { described_class.new }.to raise_error(ArgumentError)
12
+ end
13
+
14
+ it 'should have the correct messaging' do
15
+ error = described_class.new(branch)
16
+ expect(error.message).to eq "No changes found on `#{branch}`"
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe LearnTest::Git::Wip::Errors::NoCommitsError do
4
+ let(:branch) { rand(0..999_999).to_s }
5
+
6
+ it 'should inherit from Error' do
7
+ expect(described_class).to be < LearnTest::Git::Wip::Errors::BaseError
8
+ end
9
+
10
+ it 'should require a branch' do
11
+ expect { described_class.new }.to raise_error(ArgumentError)
12
+ end
13
+
14
+ it 'should have the correct messaging' do
15
+ error = described_class.new(branch)
16
+ expect(error.message).to eq "Branch `#{branch}` doesn't have any commits. Please commit and try again."
17
+ end
18
+ end
@@ -12,6 +12,8 @@ support_dir = File.join('./', 'spec', 'support', '**', '*.rb')
12
12
  Dir.glob(support_dir).each { |f| require f }
13
13
 
14
14
  RSpec.configure do |config|
15
+ config.filter_run focus: true
16
+
15
17
  config.expect_with :rspec do |expectations|
16
18
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
17
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0.pre.2
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-16 00:00:00.000000000 Z
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 2.4.0
153
- description:
153
+ description:
154
154
  email:
155
155
  - learn@flatironschool.com
156
156
  executables:
@@ -184,7 +184,10 @@ files:
184
184
  - lib/learn_test/git.rb
185
185
  - lib/learn_test/git/wip/base.rb
186
186
  - lib/learn_test/git/wip/branch.rb
187
- - lib/learn_test/git/wip/error.rb
187
+ - lib/learn_test/git/wip/errors/base_error.rb
188
+ - lib/learn_test/git/wip/errors/no_changes_error.rb
189
+ - lib/learn_test/git/wip/errors/no_commits_error.rb
190
+ - lib/learn_test/git/wip/reference.rb
188
191
  - lib/learn_test/github_interactor.rb
189
192
  - lib/learn_test/js_strategy.rb
190
193
  - lib/learn_test/learn_oauth_token_parser.rb
@@ -220,7 +223,9 @@ files:
220
223
  - spec/fixtures/rspec-unit-spec/spec/spec_helper.rb
221
224
  - spec/learn_test/git/wip/base_spec.rb
222
225
  - spec/learn_test/git/wip/branch_spec.rb
223
- - spec/learn_test/git/wip/error_spec.rb
226
+ - spec/learn_test/git/wip/errors/base_error_spec.rb
227
+ - spec/learn_test/git/wip/errors/no_changes_error_spec.rb
228
+ - spec/learn_test/git/wip/errors/no_commits_error_spec.rb
224
229
  - spec/learn_test/git_spec.rb
225
230
  - spec/learn_test/reporter_spec.rb
226
231
  - spec/learn_test/username_parser_spec.rb
@@ -233,7 +238,7 @@ homepage: https://github.com/learn-co/learn-test
233
238
  licenses:
234
239
  - MIT
235
240
  metadata: {}
236
- post_install_message:
241
+ post_install_message:
237
242
  rdoc_options: []
238
243
  require_paths:
239
244
  - lib
@@ -245,12 +250,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
250
  version: 2.5.0
246
251
  required_rubygems_version: !ruby/object:Gem::Requirement
247
252
  requirements:
248
- - - ">"
253
+ - - ">="
249
254
  - !ruby/object:Gem::Version
250
- version: 1.3.1
255
+ version: '0'
251
256
  requirements: []
252
- rubygems_version: 3.1.2
253
- signing_key:
257
+ rubygems_version: 3.0.3
258
+ signing_key:
254
259
  specification_version: 4
255
260
  summary: Runs RSpec, Karma, Mocha, and Python Pytest Test builds and pushes JSON output
256
261
  to Learn.
@@ -264,7 +269,9 @@ test_files:
264
269
  - spec/fixtures/rspec-unit-spec/spec/spec_helper.rb
265
270
  - spec/learn_test/git/wip/base_spec.rb
266
271
  - spec/learn_test/git/wip/branch_spec.rb
267
- - spec/learn_test/git/wip/error_spec.rb
272
+ - spec/learn_test/git/wip/errors/base_error_spec.rb
273
+ - spec/learn_test/git/wip/errors/no_changes_error_spec.rb
274
+ - spec/learn_test/git/wip/errors/no_commits_error_spec.rb
268
275
  - spec/learn_test/git_spec.rb
269
276
  - spec/learn_test/reporter_spec.rb
270
277
  - spec/learn_test/username_parser_spec.rb
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LearnTest
4
- module Git
5
- module Wip
6
- class Error < StandardError; end
7
-
8
- class NoChangesError < Error
9
- def initialize(branch)
10
- super "No changes found on `#{branch}`"
11
- end
12
- end
13
-
14
- class NoCommitsError < Error
15
- REGEX = /unknown revision or path not in the working tree/i.freeze
16
-
17
- def initialize(branch)
18
- super "Branch `#{branch}` doesn't have any commits. Please commit and try again."
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe LearnTest::Git::Wip do
4
- let(:branch) { rand(0..999_999).to_s }
5
-
6
- describe LearnTest::Git::Wip::Error do
7
- it 'should inherit from StandardError' do
8
- expect(described_class).to be < StandardError
9
- end
10
- end
11
-
12
- describe LearnTest::Git::Wip::NoChangesError do
13
- it 'should inherit from Error' do
14
- expect(described_class).to be < LearnTest::Git::Wip::Error
15
- end
16
-
17
- it 'should require a branch' do
18
- expect { described_class.new }.to raise_error(ArgumentError)
19
- end
20
-
21
- it 'should have the correct messaging' do
22
- error = described_class.new(branch)
23
- expect(error.message).to eq "No changes found on `#{branch}`"
24
- end
25
- end
26
-
27
- describe LearnTest::Git::Wip::NoCommitsError do
28
- it 'should inherit from Error' do
29
- expect(described_class).to be < LearnTest::Git::Wip::Error
30
- end
31
-
32
- it 'should require a branch' do
33
- expect { described_class.new }.to raise_error(ArgumentError)
34
- end
35
-
36
- it 'should have the correct messaging' do
37
- error = described_class.new(branch)
38
- expect(error.message).to eq "Branch `#{branch}` doesn't have any commits. Please commit and try again."
39
- end
40
- end
41
- end