proxy_tester 0.0.7 → 0.0.8
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.
- data/lib/proxy_tester/cli/test.rb +1 -1
- data/lib/proxy_tester/rspec_runner.rb +16 -7
- data/lib/proxy_tester/version.rb +1 -1
- data/spec/rspec_runner_spec.rb +25 -6
- metadata +1 -1
@@ -15,7 +15,7 @@ module ProxyTester
|
|
15
15
|
ProxyTester.ui_logger.level = ProxyTester.config.log_level
|
16
16
|
ProxyTester.enable_debug_mode if ProxyTester.config.debug_mode
|
17
17
|
|
18
|
-
ProxyTester::RspecRunner.new
|
18
|
+
ProxyTester::RspecRunner.new(options[:tags]).run
|
19
19
|
end
|
20
20
|
|
21
21
|
desc 'url', 'Fetch url'
|
@@ -5,31 +5,40 @@ module ProxyTester
|
|
5
5
|
class RspecRunner
|
6
6
|
private
|
7
7
|
|
8
|
-
attr_reader :test_cases_directory
|
8
|
+
attr_reader :test_cases_directory, :tags
|
9
9
|
|
10
10
|
public
|
11
11
|
|
12
12
|
def initialize(options = {})
|
13
13
|
@test_cases_directory = options.fetch(:test_cases_directory, ProxyTester.config.test_cases_directory)
|
14
|
+
@tags = options.fetch(:tags, [])
|
14
15
|
end
|
15
16
|
|
16
17
|
def run(tags)
|
17
18
|
ProxyTester.load_user_database
|
18
19
|
ProxyTester.clear_environment
|
19
|
-
|
20
|
+
|
21
|
+
$LOAD_PATH << test_cases_directory
|
22
|
+
RSpec::Core::Runner.run(arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
arguments.join(" ")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def arguments
|
20
32
|
options = []
|
21
33
|
options << '--color'
|
22
34
|
options = options + ['--format', 'Fuubar' ]
|
23
35
|
options = options + ['--order', 'rand' ]
|
24
36
|
|
25
|
-
tags.each { |t| options << '--tag'; options << t }
|
37
|
+
Array(tags).each { |t| options << '--tag'; options << t }
|
26
38
|
|
27
|
-
|
28
|
-
RSpec::Core::Runner.run(options + spec_files)
|
39
|
+
options + spec_files
|
29
40
|
end
|
30
41
|
|
31
|
-
private
|
32
|
-
|
33
42
|
def to_filter(a)
|
34
43
|
Hash[*a.collect { |e| e.to_sym }.zip([true] * a.size).flatten]
|
35
44
|
end
|
data/lib/proxy_tester/version.rb
CHANGED
data/spec/rspec_runner_spec.rb
CHANGED
@@ -3,12 +3,31 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe RspecRunner do
|
5
5
|
context '#initialize' do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
it 'accepts a config' do
|
7
|
+
config = double('config')
|
8
|
+
allow(config).to receive(:fetch)
|
9
|
+
|
10
|
+
expect {
|
11
|
+
RspecRunner.new(config)
|
12
|
+
}.not_to raise_error
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context '#to_s' do
|
17
|
+
it 'returns command string' do
|
18
|
+
runner = RspecRunner.new(test_cases_directory: working_directory)
|
19
|
+
expect(runner.to_s).to eq('--color --format Fuubar --order rand')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'uses tag if given' do
|
23
|
+
runner = RspecRunner.new(test_cases_directory: working_directory, tags: 'my_tag')
|
24
|
+
expect(runner.to_s).to eq('--color --format Fuubar --order rand --tag my_tag')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'uses multiple tags if given' do
|
28
|
+
runner = RspecRunner.new(test_cases_directory: working_directory, tags: ['my_tag', 'new_tag'])
|
29
|
+
expect(runner.to_s).to eq('--color --format Fuubar --order rand --tag my_tag --tag new_tag')
|
30
|
+
end
|
12
31
|
end
|
13
32
|
|
14
33
|
#context '#run' do
|