learn-test 3.3.0.pre.1 → 3.3.0.pre.2

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: 8068b9ca6cd44a8bea55fbe7aff5ec5ee08f811e171021726a6e6364c250a210
4
- data.tar.gz: 2e6ab893c0f4492cae089cb0c08f836a56486c5d3d3a1140cdf7b4172dc6fbff
3
+ metadata.gz: 34479d2b40afafa001626db60d17a0f80273293a0d70817fc46b3c91e01f8b81
4
+ data.tar.gz: 6423442bb278878a96673d8769a81eaa01bbcd56b12a1080b3e696298bb06f01
5
5
  SHA512:
6
- metadata.gz: e409f578b4721d75066dc5430d7c725ca47df693487b1cda69149ba4db5d3ca0e7ae33e61e57150ec43c2aaeb1c3e03e5b66ee1d0ddbf281b3c26b8f423aa087
7
- data.tar.gz: 4a05f33e6601662c068f6d10fb9d225c68f0d60b1edb90dcf195271f4594c426bcf80e99fb987fc49cc69d7f8e723be2fc16f16d4b467f10cd0af103dd043260
6
+ metadata.gz: eedc292d447fcc1732ae73457fae8c1c574db19ddeeea0cd1a42a527d879c4757bd951a2b47af8e1b2913714d74cf5e955ebcb0b8605eb2f4beb3b50fac5a602
7
+ data.tar.gz: d87fdc06850600e77021ac6891122a14a5c69bea2af562304b4d2c9e0345ea56823871f3a0b7f7e64077ee67873fc717662633562575ad6d2af734b75ca21ab1
@@ -45,7 +45,7 @@ module LearnTest
45
45
  @base.diff(new_tree, @wip_branch.parent)
46
46
 
47
47
  # tree_diff = @base.diff(new_tree, @wip_branch.parent)
48
- # raise NoChangesError, @wip_branch if tree_diff.count.zero?
48
+ # raise LearnTest::Git::Wip::NoChangesError, @wip_branch if tree_diff.count.zero?
49
49
 
50
50
  commit = @base.commit_tree(new_tree, parent: @wip_branch.parent)
51
51
 
@@ -17,10 +17,10 @@ module LearnTest
17
17
  @base.revparse(@name)
18
18
  rescue ::Git::GitExecuteError => e
19
19
  if raise_no_commits
20
- raise e.message.match(NoCommitsError::REGEX) ? NoCommitsError.new(@name) : e
20
+ raise e.message.match(LearnTest::Git::Wip::NoCommitsError::REGEX) ? LearnTest::Git::Wip::NoCommitsError.new(@name) : e
21
21
  end
22
22
 
23
- raise unless e.message.match(NoCommitsError::REGEX)
23
+ raise unless e.message.match(LearnTest::Git::Wip::NoCommitsError::REGEX)
24
24
 
25
25
  false
26
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LearnTest
4
- VERSION = '3.3.0.pre.1'
4
+ VERSION = '3.3.0.pre.2'
5
5
  end
@@ -12,9 +12,10 @@ describe 'Running a RSpec Unit Test', type: :aruba do
12
12
  before :each do
13
13
  copy '%/rspec-unit-spec', 'example'
14
14
  cd 'example'
15
- run_command_and_stop 'git init'
16
- run_command_and_stop 'git add .'
17
- run_command_and_stop 'git commit -m "Initial Commit"'
15
+
16
+ git_init
17
+ git_add
18
+ git_commit 'Initial Commit'
18
19
  end
19
20
 
20
21
  def run(flags = '')
@@ -31,11 +31,11 @@ describe LearnTest::Git::Wip::Base do
31
31
  create_directory 'example'
32
32
  cd 'example'
33
33
  write_file 'README.md', 'Hello World'
34
- run_command_and_stop 'git init'
34
+ git_init
35
35
 
36
36
  if commit # rubocop:disable Style/GuardClause
37
- run_command_and_stop 'git add .'
38
- run_command_and_stop 'git commit -m "Initial Commit"'
37
+ git_add
38
+ git_commit 'Initial Commit'
39
39
  end
40
40
  end
41
41
 
@@ -74,8 +74,8 @@ describe LearnTest::Git::Wip::Base do
74
74
  initialize_repo
75
75
  write_file 'test.rb', ''
76
76
 
77
- run_command_and_stop 'git add .'
78
- run_command_and_stop 'git commit -m "foo"'
77
+ git_add
78
+ git_commit 'foo'
79
79
  end
80
80
 
81
81
  it 'should process successfully' do
@@ -96,6 +96,20 @@ describe LearnTest::Reporter do
96
96
  end
97
97
 
98
98
  it 'posts results to the service endpoint' do
99
+ branch = double(LearnTest::Git::Wip::Branch)
100
+ branch_name = 'bar'
101
+
102
+ expect(LearnTest::Git).to receive(:open).and_return(git_base)
103
+ expect(git_base).to receive(:wip).and_return(git_wip)
104
+ expect(git_wip).to receive(:success?).and_return(true)
105
+
106
+ expect(branch).to receive(:to_s).and_return(branch_name)
107
+ expect(git_wip).to receive(:wip_branch).and_return(branch)
108
+
109
+ expect(git_base)
110
+ .to receive(:push)
111
+ .with('origin', "#{branch_name}:refs/heads/fis-wip", { force: true })
112
+
99
113
  reporter.report
100
114
 
101
115
  expect(client).to have_received(:post_results)
@@ -8,6 +8,9 @@ SimpleCov.start
8
8
 
9
9
  require_relative '../lib/learn_test'
10
10
 
11
+ support_dir = File.join('./', 'spec', 'support', '**', '*.rb')
12
+ Dir.glob(support_dir).each { |f| require f }
13
+
11
14
  RSpec.configure do |config|
12
15
  config.expect_with :rspec do |expectations|
13
16
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
@@ -0,0 +1,17 @@
1
+ def git_set_user
2
+ run_command_and_stop 'git config user.email "info@flatironschool.com"'
3
+ run_command_and_stop 'git config user.name "Flatiron School"'
4
+ end
5
+
6
+ def git_init
7
+ run_command_and_stop 'git init'
8
+ git_set_user
9
+ end
10
+
11
+ def git_add(files = '.')
12
+ run_command_and_stop "git add #{files}"
13
+ end
14
+
15
+ def git_commit(msg)
16
+ run_command_and_stop "git commit -m \"#{msg}\""
17
+ 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.1
4
+ version: 3.3.0.pre.2
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-10-15 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -228,6 +228,7 @@ files:
228
228
  - spec/lib/learn_test/strategies/none_spec.rb
229
229
  - spec/repo_parser_spec.rb
230
230
  - spec/spec_helper.rb
231
+ - spec/support/git.rb
231
232
  homepage: https://github.com/learn-co/learn-test
232
233
  licenses:
233
234
  - MIT
@@ -271,3 +272,4 @@ test_files:
271
272
  - spec/lib/learn_test/strategies/none_spec.rb
272
273
  - spec/repo_parser_spec.rb
273
274
  - spec/spec_helper.rb
275
+ - spec/support/git.rb