learn-test 3.2.1.pre.6 → 3.2.1.pre.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8794c9f5f79754792e07d3d25d4394cb893f1156c2f90ddf49fa791e3295ed5b
4
- data.tar.gz: 106bb411827dd6cc527f5f2703f1720a7cb5abd4f950fae6f9429da46beef4c9
3
+ metadata.gz: 249f2021b3b57e076db38961e1abfb5a8cdedbc7726ee33ad707ac7eea2678ff
4
+ data.tar.gz: 1688198ff9a0a2c5a558385b551db62b9a8d22b8435eb985200c91741d49aa7e
5
5
  SHA512:
6
- metadata.gz: b0499f0e0986bc8e1a2e8425bfdf364c701540b8f7e799055b7929868fecec7a5c4812a0df10deaf310f5efff8d22d7caa5e3b046f96b719757d32c81f2269e8
7
- data.tar.gz: 51369aeb558ad730d61618dbcf426c99250d4368c7b3baec7e0d858e39a29cf18d378cabad353bb2ea13164a3adaa60731ca5ec8de1d3ca6b22cfdacb4eca005
6
+ metadata.gz: bb4e34682cefc0b4e0c07d53a20ec48fe0b97cd4c6f1fac9dc83bf897d641d16cb61366ade6ceb6d641e7562578b7fa3f4ce8beb3ff890c57dcc190a91d6ac10
7
+ data.tar.gz: 1963e7a2d20ff15ff403e933ce85b8d875dc55c8146632d21b70cf4a2b17a565d8acac9509be7b98bb5f03796b8e97bb1fb6768e6f92863532026bd9c7071e6a
@@ -30,7 +30,7 @@ Options for save:
30
30
  'commit.gpgSign = true'
31
31
  "
32
32
 
33
- source "$(git --exec-path)/git-sh-setup"
33
+ . "$(git --exec-path)/git-sh-setup"
34
34
 
35
35
  require_work_tree
36
36
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'git'
4
+ require 'logger'
4
5
 
5
6
  module LearnTest
6
7
  module GitWip
@@ -9,25 +10,23 @@ module LearnTest
9
10
  git = Git.open('./', log: log)
10
11
  working_branch = git.current_branch
11
12
 
12
- Open3.popen3('learn-test-wip save "Automatic test submission" --editor') do |_stdin, stdout, stderr, wait_thr|
13
- while out = stdout.gets do
14
- puts out
15
- end
16
-
17
- while err = stderr.gets do
18
- puts err
19
- end
13
+ commands = [
14
+ 'learn-test-wip save "Automatic test submission" --editor',
15
+ "git push origin wip/#{working_branch}:refs/heads/wip"
16
+ ].join(';')
17
+
18
+ Open3.popen3(commands) do |_stdin, _stdout, _stderr, wait_thr|
19
+ # while out = stdout.gets do; puts out; end
20
+ # while err = stderr.gets do; puts err; end
20
21
 
21
22
  if wait_thr.value.exitstatus.zero?
22
- git.push('origin', "wip/#{working_branch}:refs/heads/wip")
23
23
  git.config['remote.origin.url'].gsub('.git', '/tree/wip')
24
24
  else
25
- puts 'There was an error running learn-test-wip'
25
+ # puts 'There was an error running learn-test-wip'
26
26
  false
27
27
  end
28
28
  end
29
29
  rescue StandardError => e
30
- puts e
31
30
  false
32
31
  end
33
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LearnTest
4
- VERSION = '3.2.1.pre.6'
4
+ VERSION = '3.2.1.pre.7'
5
5
  end
@@ -7,28 +7,35 @@ describe LearnTest::GitWip do
7
7
  let!(:git_url) { 'https://github.com/learn-co/learn-test' }
8
8
  let!(:git_base) { instance_double(Git::Base) }
9
9
 
10
+ let(:wait_thr) { double }
11
+ let(:wait_thr_value) { double }
12
+ let(:stdout_and_stderr) { double }
13
+
10
14
  context 'success' do
11
15
  it 'should return the git url' do
12
16
  expect(Git::Base).to receive(:open).with('./', { log: false }).and_return(git_base)
13
17
  expect(git_base).to receive(:current_branch).and_return(working_branch)
14
18
 
15
- expect(subject).to receive(:`).with(/learn-test-wip save ".+" -u &> \/dev\/null/ )
16
- expect($?).to receive(:success?).and_return(true)
19
+ expect(wait_thr).to receive(:value).and_return(wait_thr_value)
20
+ expect(wait_thr_value).to receive(:exitstatus).and_return(0)
17
21
 
18
- expect(git_base).to receive(:push).with('origin', "wip/#{working_branch}:refs/heads/wip")
19
- expect(git_base).to receive_message_chain(:config, :[]).with('remote.origin.url').and_return("#{git_url}.git")
22
+ expect(Open3).to receive(:popen3).and_yield(nil, nil, nil, wait_thr)
20
23
 
24
+ expect(git_base).to receive_message_chain(:config, :[]).with('remote.origin.url').and_return("#{git_url}.git")
21
25
  expect(subject.run!).to eq("#{git_url}/tree/wip")
22
26
  end
23
27
  end
24
28
 
25
29
  context 'failure' do
26
30
  it 'should return false on process error' do
27
- allow(Git::Base).to receive(:open).and_return(git_base)
28
- allow(git_base).to receive(:current_branch)
29
- allow(subject).to receive(:`)
31
+ expect(Git::Base).to receive(:open).with('./', { log: false }).and_return(git_base)
32
+ expect(git_base).to receive(:current_branch).and_return(working_branch)
33
+
34
+ expect(wait_thr).to receive(:value).and_return(wait_thr_value)
35
+ expect(wait_thr_value).to receive(:exitstatus).and_return(1)
36
+
37
+ expect(Open3).to receive(:popen3).and_yield(nil, nil, nil, wait_thr)
30
38
 
31
- expect($?).to receive(:success?).and_return(false)
32
39
  expect(subject.run!).to eq(false)
33
40
  end
34
41
 
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.2.1.pre.6
4
+ version: 3.2.1.pre.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-25 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake