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 +4 -4
- data/bin/learn-test-wip +1 -1
- data/lib/learn_test/git_wip.rb +10 -11
- data/lib/learn_test/version.rb +1 -1
- data/spec/learn_test/git_spec.rb +15 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 249f2021b3b57e076db38961e1abfb5a8cdedbc7726ee33ad707ac7eea2678ff
|
4
|
+
data.tar.gz: 1688198ff9a0a2c5a558385b551db62b9a8d22b8435eb985200c91741d49aa7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4e34682cefc0b4e0c07d53a20ec48fe0b97cd4c6f1fac9dc83bf897d641d16cb61366ade6ceb6d641e7562578b7fa3f4ce8beb3ff890c57dcc190a91d6ac10
|
7
|
+
data.tar.gz: 1963e7a2d20ff15ff403e933ce85b8d875dc55c8146632d21b70cf4a2b17a565d8acac9509be7b98bb5f03796b8e97bb1fb6768e6f92863532026bd9c7071e6a
|
data/bin/learn-test-wip
CHANGED
data/lib/learn_test/git_wip.rb
CHANGED
@@ -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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
data/lib/learn_test/version.rb
CHANGED
data/spec/learn_test/git_spec.rb
CHANGED
@@ -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(
|
16
|
-
expect(
|
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(
|
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
|
-
|
28
|
-
|
29
|
-
|
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.
|
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-
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|