sfb_scripts 1.4 → 1.5

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
  SHA1:
3
- metadata.gz: aab86c1ecf4b9c1691a7a4e686c823c10f9b6c36
4
- data.tar.gz: b8ad1717e0cc3bbe363db504efb78e655c870d43
3
+ metadata.gz: 4331f2d765b901cc8d384db62ef40894242fdb51
4
+ data.tar.gz: 125839c5dad8e1a67f06843fea59984d59144367
5
5
  SHA512:
6
- metadata.gz: 1765662a968df5a669370bf54287973a8b7726e921e6f1cd809b750387edc3ef39c904f5f5fdc9b8f0bed37e13c95acf87de5e28fb71de23ef27784a81626012
7
- data.tar.gz: 09179f2e6c970043af511743ec2a6ca46793850dc1fb7acb092bcdd251351bb4d3d52e02501d04bfe6f1e5b9dfb4d724765da1392d0ad9828bce06765d34a04f
6
+ metadata.gz: e4723d8f8bae2f59d0227dae4ed102d818d3b8d8e3517cefc18872cb9cee9bde635568c81e3c037e3708f23de9941ce4fdf8132e62a7f6357507bf2f252a25a7
7
+ data.tar.gz: c59b89377676bfa2ddc96544009a095844ffc63d6a939c4bdd15ff4b5dc9c316e3400b648969e35139d0ecf650f4fba8deb421937fa04fad5bbafe8afd8da24e
@@ -2,10 +2,11 @@ class TestCollection
2
2
 
3
3
  MultipleWorkingDirectoriesError = Class.new(StandardError)
4
4
 
5
- attr_reader :tests
5
+ attr_reader :tests, :query
6
6
 
7
- def initialize(tests_data=[])
8
- @tests = tests_data.map do |test_data|
7
+ def initialize(tests_matches: [], query:)
8
+ @query = query
9
+ @tests = tests_matches.map do |test_data|
9
10
  test_data = {file: test_data} if test_data.is_a?(String)
10
11
  TestCase.new(
11
12
  full_path: test_data[:file],
@@ -47,7 +47,7 @@ class TestFinder
47
47
  # git grep returns 1 if no results found
48
48
  end
49
49
 
50
- TestCollection.new(test_matches)
50
+ TestCollection.new(tests_matches: test_matches, query: query)
51
51
  end
52
52
  end
53
53
 
@@ -6,34 +6,44 @@ class TestRunner
6
6
  @all_engines_param = env[:all_engines]
7
7
  end
8
8
 
9
+ # Hack: this could use *a lot* of love
9
10
  # this could use some love
10
11
  def run(tests)
12
+
11
13
  if tests.empty?
12
14
  shell.warn "Unable to identify any tests."
13
15
  exit
16
+
14
17
  elsif tests.is_one_test_method?
15
- run_method(tests.first)
18
+ test = tests.first
19
+ run_method(path: test.relative_path, name: test.test_name, dir: test.working_dir)
20
+
16
21
  elsif tests.in_one_file? && tests.all? {|t| t.is_method? }
17
- shell.notify "Multiple matches in same file. Running that file."
18
- run_files(tests)
19
- elsif tests.in_one_file?
20
- shell.notify "Matched one file."
22
+ shell.notify "Multiple matches in same file. Running those tests"
23
+ test = tests.first
24
+ run_method(path: test.relative_path, name: tests.query, dir: test.working_dir)
25
+
26
+ elsif tests.in_one_file? #catches regex that matched a test file or other regex that matched in the body
27
+ shell.notify "Matched one file. Running that file."
21
28
  run_files(tests)
29
+
22
30
  elsif tests.in_one_engine? && tests.full_paths.size < 4 # hack: maybe should ask here?
23
31
  shell.notify "Multiple matches across files in same engine. Running those files."
24
32
  run_files(tests)
33
+
25
34
  else
26
35
  shell.warn 'Found too many tests:'
27
36
  tests[0..10].each {|t| shell.notify "#{t.full_path}: #{t.test_name}" }
28
37
  shell.notify '...'
29
38
  exit
39
+
30
40
  end
31
41
  end
32
42
 
33
- def run_method(test)
34
- test_runner = named_test_runner(test.working_dir)
43
+ def run_method(path:, name:, dir:)
44
+ test_runner = named_test_runner(dir)
35
45
 
36
- shell.exec("#{test_runner} #{test.relative_path} --name=#{test.test_name}", dir: test.working_dir)
46
+ shell.exec("#{test_runner} #{path} --name=/#{name}/", dir: dir)
37
47
  end
38
48
 
39
49
  def run_files(tests)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfb_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-15 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -60,6 +60,9 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - bin/app_up
64
+ - bin/git_up
65
+ - bin/test_runner
63
66
  - lib/sfb_scripts/bundler/bundle_manager.rb
64
67
  - lib/sfb_scripts/dependency_loader.rb
65
68
  - lib/sfb_scripts/folder_guard.rb
@@ -83,9 +86,6 @@ files:
83
86
  - lib/sfb_scripts/test_running/test_runner.rb
84
87
  - lib/sfb_scripts/tester.rb
85
88
  - lib/sfb_scripts/upper.rb
86
- - bin/test_runner
87
- - bin/app_up
88
- - bin/git_up
89
89
  homepage: http://github.com/petekinnecom/sfb_scripts/
90
90
  licenses:
91
91
  - MIT
@@ -106,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.1.11
109
+ rubygems_version: 2.2.2
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Easily update your rails app and run tests from command line
113
113
  test_files: []
114
- has_rdoc: