infinity_test 2.0.0.rc1 → 2.0.0.rc2
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/HISTORY.md +84 -0
- data/README.md +249 -9
- data/TODO.markdown +36 -27
- data/lib/infinity_test/core/auto_discover.rb +3 -3
- data/lib/infinity_test/core/command_runner.rb +16 -40
- data/lib/infinity_test/core/continuous_test_server.rb +18 -0
- data/lib/infinity_test/core/version.rb +1 -1
- data/lib/infinity_test/framework/base.rb +36 -0
- data/lib/infinity_test/framework/django.rb +109 -0
- data/lib/infinity_test/framework/elixir_mix.rb +47 -0
- data/lib/infinity_test/framework/fast_api.rb +104 -0
- data/lib/infinity_test/framework/padrino.rb +5 -8
- data/lib/infinity_test/framework/phoenix.rb +72 -0
- data/lib/infinity_test/framework/python_package.rb +97 -0
- data/lib/infinity_test/framework/rails.rb +5 -14
- data/lib/infinity_test/framework/rocket.rb +70 -0
- data/lib/infinity_test/framework/rust_cargo.rb +69 -0
- data/lib/infinity_test/strategy/base.rb +17 -1
- data/lib/infinity_test/strategy/elixir_default.rb +20 -0
- data/lib/infinity_test/strategy/python_default.rb +22 -0
- data/lib/infinity_test/strategy/rbenv.rb +3 -1
- data/lib/infinity_test/strategy/ruby_default.rb +2 -1
- data/lib/infinity_test/strategy/rust_default.rb +21 -0
- data/lib/infinity_test/strategy/rvm.rb +3 -1
- data/lib/infinity_test/test_framework/cargo_test.rb +49 -0
- data/lib/infinity_test/test_framework/ex_unit.rb +53 -0
- data/lib/infinity_test/test_framework/pytest.rb +65 -0
- data/lib/infinity_test.rb +13 -0
- data/spec/infinity_test/core/auto_discover_spec.rb +29 -3
- data/spec/infinity_test/framework/django_spec.rb +95 -0
- data/spec/infinity_test/framework/elixir_mix_spec.rb +44 -0
- data/spec/infinity_test/framework/fast_api_spec.rb +96 -0
- data/spec/infinity_test/framework/padrino_spec.rb +28 -6
- data/spec/infinity_test/framework/phoenix_spec.rb +85 -0
- data/spec/infinity_test/framework/python_package_spec.rb +95 -0
- data/spec/infinity_test/framework/rails_spec.rb +28 -6
- data/spec/infinity_test/framework/rocket_spec.rb +69 -0
- data/spec/infinity_test/framework/rust_cargo_spec.rb +94 -0
- data/spec/infinity_test/strategy/elixir_default_spec.rb +46 -0
- data/spec/infinity_test/strategy/python_default_spec.rb +56 -0
- data/spec/infinity_test/strategy/rbenv_spec.rb +19 -2
- data/spec/infinity_test/strategy/ruby_default_spec.rb +19 -2
- data/spec/infinity_test/strategy/rust_default_spec.rb +56 -0
- data/spec/infinity_test/strategy/rvm_spec.rb +23 -6
- data/spec/infinity_test/test_framework/cargo_test_spec.rb +145 -0
- data/spec/infinity_test/test_framework/ex_unit_spec.rb +153 -0
- data/spec/infinity_test/test_framework/pytest_spec.rb +182 -0
- metadata +47 -5
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Framework
|
|
5
|
+
describe Phoenix do
|
|
6
|
+
let(:observer) { double('Observer') }
|
|
7
|
+
let(:test_framework) { double('TestFramework', test_dir: 'test', test_helper_file: 'test/test_helper.exs') }
|
|
8
|
+
let(:continuous_test_server) { double('ContinuousTestServer', observer: observer, test_framework: test_framework) }
|
|
9
|
+
subject { Phoenix.new(continuous_test_server) }
|
|
10
|
+
|
|
11
|
+
describe "#heuristics" do
|
|
12
|
+
before do
|
|
13
|
+
allow(subject).to receive(:watch_lib_dirs)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "adds heuristics for lib dirs, test, and test_helper" do
|
|
17
|
+
expect(subject).to receive(:watch_lib_dirs)
|
|
18
|
+
expect(observer).to receive(:watch_dir).with('test', :exs)
|
|
19
|
+
expect(observer).to receive(:watch).with('test/test_helper.exs')
|
|
20
|
+
expect { subject.heuristics }.to_not raise_exception
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "#heuristics!" do
|
|
25
|
+
it "appends .exs extension to hike" do
|
|
26
|
+
hike = double('Hike')
|
|
27
|
+
allow(subject).to receive(:hike).and_return(hike)
|
|
28
|
+
expect(hike).to receive(:append_extension).with('.exs')
|
|
29
|
+
expect(hike).to receive(:append_path).with('test')
|
|
30
|
+
allow(subject).to receive(:heuristics)
|
|
31
|
+
subject.heuristics!
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe "#watch_lib_dirs" do
|
|
36
|
+
context "when lib directory exists with subdirectories" do
|
|
37
|
+
before do
|
|
38
|
+
allow(File).to receive(:directory?).with('lib').and_return(true)
|
|
39
|
+
allow(Dir).to receive(:glob).with('lib/*').and_return(['lib/my_app', 'lib/my_app_web'])
|
|
40
|
+
allow(File).to receive(:directory?).with('lib/my_app').and_return(true)
|
|
41
|
+
allow(File).to receive(:directory?).with('lib/my_app_web').and_return(true)
|
|
42
|
+
allow(Dir).to receive(:glob).with('lib/my_app/**/*.ex').and_return(['lib/my_app/accounts.ex'])
|
|
43
|
+
allow(Dir).to receive(:glob).with('lib/my_app_web/**/*.ex').and_return(['lib/my_app_web/controllers/page_controller.ex'])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "watches all lib subdirectories with .ex files" do
|
|
47
|
+
expect(observer).to receive(:watch_dir).with('lib/my_app', :ex)
|
|
48
|
+
expect(observer).to receive(:watch_dir).with('lib/my_app_web', :ex)
|
|
49
|
+
subject.watch_lib_dirs
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "when lib directory does not exist" do
|
|
54
|
+
before do
|
|
55
|
+
allow(File).to receive(:directory?).with('lib').and_return(false)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "does nothing" do
|
|
59
|
+
expect(observer).not_to receive(:watch_dir)
|
|
60
|
+
subject.watch_lib_dirs
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe ".run?" do
|
|
66
|
+
it "returns true if mix.exs exists and has lib/*_web directory" do
|
|
67
|
+
expect(File).to receive(:exist?).with('mix.exs').and_return(true)
|
|
68
|
+
expect(Dir).to receive(:glob).with('lib/*_web').and_return(['lib/my_app_web'])
|
|
69
|
+
expect(Phoenix).to be_run
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "returns false if mix.exs does not exist" do
|
|
73
|
+
expect(File).to receive(:exist?).with('mix.exs').and_return(false)
|
|
74
|
+
expect(Phoenix).not_to be_run
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it "returns false if no lib/*_web directory exists" do
|
|
78
|
+
expect(File).to receive(:exist?).with('mix.exs').and_return(true)
|
|
79
|
+
expect(Dir).to receive(:glob).with('lib/*_web').and_return([])
|
|
80
|
+
expect(Phoenix).not_to be_run
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Framework
|
|
5
|
+
describe PythonPackage do
|
|
6
|
+
let(:observer) { double('Observer') }
|
|
7
|
+
let(:test_framework) { double('TestFramework', test_dir: 'tests', test_helper_file: 'tests/conftest.py') }
|
|
8
|
+
let(:continuous_test_server) { double('ContinuousTestServer', observer: observer, test_framework: test_framework) }
|
|
9
|
+
subject { PythonPackage.new(continuous_test_server) }
|
|
10
|
+
|
|
11
|
+
describe "#heuristics" do
|
|
12
|
+
before do
|
|
13
|
+
allow(subject).to receive(:watch_python_dirs)
|
|
14
|
+
allow(File).to receive(:exist?).with('tests/conftest.py').and_return(true)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "adds heuristics for python dirs, test, and conftest" do
|
|
18
|
+
expect(subject).to receive(:watch_python_dirs)
|
|
19
|
+
expect(observer).to receive(:watch_dir).with('tests', :py)
|
|
20
|
+
expect(observer).to receive(:watch).with('tests/conftest.py')
|
|
21
|
+
expect { subject.heuristics }.to_not raise_exception
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "#heuristics!" do
|
|
26
|
+
it "appends .py extension to hike" do
|
|
27
|
+
hike = double('Hike')
|
|
28
|
+
allow(subject).to receive(:hike).and_return(hike)
|
|
29
|
+
expect(hike).to receive(:append_extension).with('.py')
|
|
30
|
+
expect(hike).to receive(:append_path).with('tests')
|
|
31
|
+
allow(subject).to receive(:heuristics)
|
|
32
|
+
subject.heuristics!
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe "#watch_python_dirs" do
|
|
37
|
+
context "when src directory exists" do
|
|
38
|
+
before do
|
|
39
|
+
allow(File).to receive(:directory?).with('src').and_return(true)
|
|
40
|
+
allow(File).to receive(:directory?).with('lib').and_return(false)
|
|
41
|
+
allow(Dir).to receive(:glob).with('*/__init__.py').and_return([])
|
|
42
|
+
allow(Dir).to receive(:glob).with('src/**/*.py').and_return(['src/mypackage/utils.py'])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "watches the src directory" do
|
|
46
|
+
expect(observer).to receive(:watch_dir).with('src', :py)
|
|
47
|
+
subject.watch_python_dirs
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "when package directory with __init__.py exists" do
|
|
52
|
+
before do
|
|
53
|
+
allow(File).to receive(:directory?).with('src').and_return(false)
|
|
54
|
+
allow(File).to receive(:directory?).with('lib').and_return(false)
|
|
55
|
+
allow(Dir).to receive(:glob).with('*/__init__.py').and_return(['mypackage/__init__.py'])
|
|
56
|
+
allow(File).to receive(:directory?).with('mypackage').and_return(true)
|
|
57
|
+
allow(Dir).to receive(:glob).with('mypackage/**/*.py').and_return(['mypackage/utils.py'])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "watches the package directory" do
|
|
61
|
+
expect(observer).to receive(:watch_dir).with('mypackage', :py)
|
|
62
|
+
subject.watch_python_dirs
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe ".run?" do
|
|
68
|
+
it "returns true if pyproject.toml exists" do
|
|
69
|
+
expect(File).to receive(:exist?).with('pyproject.toml').and_return(true)
|
|
70
|
+
expect(PythonPackage).to be_run
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "returns true if setup.py exists" do
|
|
74
|
+
expect(File).to receive(:exist?).with('pyproject.toml').and_return(false)
|
|
75
|
+
expect(File).to receive(:exist?).with('setup.py').and_return(true)
|
|
76
|
+
expect(PythonPackage).to be_run
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "returns true if setup.cfg exists" do
|
|
80
|
+
expect(File).to receive(:exist?).with('pyproject.toml').and_return(false)
|
|
81
|
+
expect(File).to receive(:exist?).with('setup.py').and_return(false)
|
|
82
|
+
expect(File).to receive(:exist?).with('setup.cfg').and_return(true)
|
|
83
|
+
expect(PythonPackage).to be_run
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "returns false if no Python package files exist" do
|
|
87
|
+
expect(File).to receive(:exist?).with('pyproject.toml').and_return(false)
|
|
88
|
+
expect(File).to receive(:exist?).with('setup.py').and_return(false)
|
|
89
|
+
expect(File).to receive(:exist?).with('setup.cfg').and_return(false)
|
|
90
|
+
expect(PythonPackage).not_to be_run
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -4,18 +4,40 @@ module InfinityTest
|
|
|
4
4
|
module Framework
|
|
5
5
|
describe Rails do
|
|
6
6
|
let(:observer) { double('Observer') }
|
|
7
|
-
let(:test_framework) { double('TestFramework') }
|
|
7
|
+
let(:test_framework) { double('TestFramework', test_dir: 'spec') }
|
|
8
8
|
let(:continuous_test_server) { double('ContinuousTestServer', observer: observer, test_framework: test_framework) }
|
|
9
9
|
subject { Rails.new(continuous_test_server) }
|
|
10
10
|
|
|
11
11
|
describe "#heuristics" do
|
|
12
|
-
it "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
it "watches lib, test_dir, and test_helper_file" do
|
|
13
|
+
allow(File).to receive(:directory?).with('app').and_return(false)
|
|
14
|
+
|
|
15
|
+
expect(observer).to receive(:watch_dir).with(:lib)
|
|
16
|
+
expect(observer).to receive(:watch_dir).with('spec')
|
|
16
17
|
expect(observer).to receive(:watch)
|
|
17
18
|
expect(test_framework).to receive(:test_helper_file)
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
expect { subject.heuristics }.to_not raise_exception
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "auto-discovers app directories containing ruby files" do
|
|
24
|
+
allow(File).to receive(:directory?).with('app').and_return(true)
|
|
25
|
+
allow(Dir).to receive(:glob).with('app/*').and_return(['app/models', 'app/views', 'app/components'])
|
|
26
|
+
allow(File).to receive(:directory?).with('app/models').and_return(true)
|
|
27
|
+
allow(File).to receive(:directory?).with('app/views').and_return(true)
|
|
28
|
+
allow(File).to receive(:directory?).with('app/components').and_return(true)
|
|
29
|
+
allow(Dir).to receive(:glob).with('app/models/**/*.rb').and_return(['app/models/user.rb'])
|
|
30
|
+
allow(Dir).to receive(:glob).with('app/views/**/*.rb').and_return([])
|
|
31
|
+
allow(Dir).to receive(:glob).with('app/components/**/*.rb').and_return(['app/components/button.rb'])
|
|
32
|
+
|
|
33
|
+
# Should watch models and components (have .rb files), skip views (no .rb files)
|
|
34
|
+
expect(observer).to receive(:watch_dir).with('app/models')
|
|
35
|
+
expect(observer).to receive(:watch_dir).with('app/components')
|
|
36
|
+
expect(observer).to receive(:watch_dir).with(:lib)
|
|
37
|
+
expect(observer).to receive(:watch_dir).with('spec')
|
|
38
|
+
expect(observer).to receive(:watch)
|
|
39
|
+
expect(test_framework).to receive(:test_helper_file)
|
|
40
|
+
|
|
19
41
|
expect { subject.heuristics }.to_not raise_exception
|
|
20
42
|
end
|
|
21
43
|
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Framework
|
|
5
|
+
describe Rocket do
|
|
6
|
+
let(:observer) { double('Observer') }
|
|
7
|
+
let(:test_framework) { double('TestFramework', test_dir: 'tests', test_helper_file: 'Cargo.toml') }
|
|
8
|
+
let(:continuous_test_server) { double('ContinuousTestServer', observer: observer, test_framework: test_framework) }
|
|
9
|
+
subject { Rocket.new(continuous_test_server) }
|
|
10
|
+
|
|
11
|
+
describe "#heuristics" do
|
|
12
|
+
before do
|
|
13
|
+
allow(File).to receive(:directory?).with('tests').and_return(true)
|
|
14
|
+
allow(File).to receive(:exist?).with('Rocket.toml').and_return(true)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "adds heuristics for src, tests, Cargo.toml, and Rocket.toml" do
|
|
18
|
+
expect(observer).to receive(:watch_dir).with(:src, :rs)
|
|
19
|
+
expect(observer).to receive(:watch_dir).with('tests', :rs)
|
|
20
|
+
expect(observer).to receive(:watch).with('Cargo.toml')
|
|
21
|
+
expect(observer).to receive(:watch).with('Rocket.toml')
|
|
22
|
+
expect { subject.heuristics }.to_not raise_exception
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe "#heuristics!" do
|
|
27
|
+
it "appends .rs extension to hike" do
|
|
28
|
+
hike = double('Hike')
|
|
29
|
+
allow(subject).to receive(:hike).and_return(hike)
|
|
30
|
+
allow(File).to receive(:directory?).with('tests').and_return(true)
|
|
31
|
+
expect(hike).to receive(:append_extension).with('.rs')
|
|
32
|
+
expect(hike).to receive(:append_path).with('tests')
|
|
33
|
+
allow(subject).to receive(:heuristics)
|
|
34
|
+
subject.heuristics!
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe "#run_module_tests" do
|
|
39
|
+
let(:changed_file) { double('ChangedFile', name: 'src/routes.rs', path: 'routes') }
|
|
40
|
+
|
|
41
|
+
it "runs tests matching the module name" do
|
|
42
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('routes')
|
|
43
|
+
subject.run_module_tests(changed_file)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe ".run?" do
|
|
48
|
+
it "returns true if Cargo.toml exists with rocket dependency" do
|
|
49
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
50
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
51
|
+
expect(File).to receive(:read).with('Cargo.toml').and_return('rocket = "0.5"')
|
|
52
|
+
expect(Rocket).to be_run
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "returns false if Cargo.toml does not exist" do
|
|
56
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(false)
|
|
57
|
+
expect(Rocket).not_to be_run
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "returns false if Cargo.toml does not contain rocket" do
|
|
61
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
62
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
63
|
+
expect(File).to receive(:read).with('Cargo.toml').and_return('[dependencies]')
|
|
64
|
+
expect(Rocket).not_to be_run
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Framework
|
|
5
|
+
describe RustCargo do
|
|
6
|
+
let(:observer) { double('Observer') }
|
|
7
|
+
let(:test_framework) { double('TestFramework', test_dir: 'tests', test_helper_file: 'Cargo.toml') }
|
|
8
|
+
let(:continuous_test_server) { double('ContinuousTestServer', observer: observer, test_framework: test_framework) }
|
|
9
|
+
subject { RustCargo.new(continuous_test_server) }
|
|
10
|
+
|
|
11
|
+
describe "#heuristics" do
|
|
12
|
+
before do
|
|
13
|
+
allow(File).to receive(:directory?).with('tests').and_return(true)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "adds heuristics for src, tests, and Cargo.toml" do
|
|
17
|
+
expect(observer).to receive(:watch_dir).with(:src, :rs)
|
|
18
|
+
expect(observer).to receive(:watch_dir).with('tests', :rs)
|
|
19
|
+
expect(observer).to receive(:watch).with('Cargo.toml')
|
|
20
|
+
expect { subject.heuristics }.to_not raise_exception
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "#heuristics!" do
|
|
25
|
+
it "appends .rs extension to hike" do
|
|
26
|
+
hike = double('Hike')
|
|
27
|
+
allow(subject).to receive(:hike).and_return(hike)
|
|
28
|
+
allow(File).to receive(:directory?).with('tests').and_return(true)
|
|
29
|
+
expect(hike).to receive(:append_extension).with('.rs')
|
|
30
|
+
expect(hike).to receive(:append_path).with('tests')
|
|
31
|
+
allow(subject).to receive(:heuristics)
|
|
32
|
+
subject.heuristics!
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe "#run_module_tests" do
|
|
37
|
+
let(:changed_file) { double('ChangedFile', name: 'src/user.rs', path: 'user') }
|
|
38
|
+
|
|
39
|
+
it "runs tests matching the module name" do
|
|
40
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('user')
|
|
41
|
+
subject.run_module_tests(changed_file)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context "when lib.rs is changed" do
|
|
45
|
+
let(:lib_file) { double('ChangedFile', name: 'src/lib.rs', path: 'lib') }
|
|
46
|
+
|
|
47
|
+
it "runs all tests" do
|
|
48
|
+
expect(subject).to receive(:run_all)
|
|
49
|
+
subject.run_module_tests(lib_file)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "when main.rs is changed" do
|
|
54
|
+
let(:main_file) { double('ChangedFile', name: 'src/main.rs', path: 'main') }
|
|
55
|
+
|
|
56
|
+
it "runs all tests" do
|
|
57
|
+
expect(subject).to receive(:run_all)
|
|
58
|
+
subject.run_module_tests(main_file)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe "#run_integration_test" do
|
|
64
|
+
let(:changed_file) { double('ChangedFile', name: 'tests/integration_test.rs') }
|
|
65
|
+
|
|
66
|
+
it "runs the specific integration test" do
|
|
67
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('--test integration_test')
|
|
68
|
+
subject.run_integration_test(changed_file)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe ".run?" do
|
|
73
|
+
it "returns true if Cargo.toml exists and is not a Rocket project" do
|
|
74
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
75
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
76
|
+
expect(File).to receive(:read).with('Cargo.toml').and_return('[dependencies]')
|
|
77
|
+
expect(RustCargo).to be_run
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "returns false if Cargo.toml does not exist" do
|
|
81
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(false)
|
|
82
|
+
expect(RustCargo).not_to be_run
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "returns false if it is a Rocket project" do
|
|
86
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
87
|
+
expect(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
88
|
+
expect(File).to receive(:read).with('Cargo.toml').and_return('rocket = "0.5"')
|
|
89
|
+
expect(RustCargo).not_to be_run
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Strategy
|
|
5
|
+
describe ElixirDefault do
|
|
6
|
+
let(:base) { BaseFixture.new }
|
|
7
|
+
let(:continuous_test_server) { Core::ContinuousTestServer.new(base) }
|
|
8
|
+
subject { ElixirDefault.new(continuous_test_server) }
|
|
9
|
+
it_should_behave_like 'a infinity test strategy'
|
|
10
|
+
|
|
11
|
+
describe ".run?" do
|
|
12
|
+
it "returns true when mix.exs exists" do
|
|
13
|
+
allow(File).to receive(:exist?).with('mix.exs').and_return(true)
|
|
14
|
+
expect(ElixirDefault).to be_run
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "returns false when mix.exs does not exist" do
|
|
18
|
+
allow(File).to receive(:exist?).with('mix.exs').and_return(false)
|
|
19
|
+
expect(ElixirDefault).not_to be_run
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '#run!' do
|
|
24
|
+
before { base.test_framework = :ex_unit }
|
|
25
|
+
|
|
26
|
+
it 'returns the mix test command' do
|
|
27
|
+
expect(subject.run!).to eq 'mix test test'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'with specific options' do
|
|
31
|
+
before do
|
|
32
|
+
Core::Base.specific_options = '--trace'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
after do
|
|
36
|
+
Core::Base.specific_options = ''
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'includes the options' do
|
|
40
|
+
expect(subject.run!).to eq 'mix test test --trace'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Strategy
|
|
5
|
+
describe PythonDefault do
|
|
6
|
+
let(:base) { BaseFixture.new }
|
|
7
|
+
let(:continuous_test_server) { Core::ContinuousTestServer.new(base) }
|
|
8
|
+
subject { PythonDefault.new(continuous_test_server) }
|
|
9
|
+
it_should_behave_like 'a infinity test strategy'
|
|
10
|
+
|
|
11
|
+
describe ".run?" do
|
|
12
|
+
it "returns true when pyproject.toml exists" do
|
|
13
|
+
allow(File).to receive(:exist?).with('pyproject.toml').and_return(true)
|
|
14
|
+
expect(PythonDefault).to be_run
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "returns true when setup.py exists" do
|
|
18
|
+
allow(File).to receive(:exist?).with('pyproject.toml').and_return(false)
|
|
19
|
+
allow(File).to receive(:exist?).with('setup.py').and_return(true)
|
|
20
|
+
expect(PythonDefault).to be_run
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "returns false when no Python package files exist" do
|
|
24
|
+
allow(File).to receive(:exist?).with('pyproject.toml').and_return(false)
|
|
25
|
+
allow(File).to receive(:exist?).with('setup.py').and_return(false)
|
|
26
|
+
allow(File).to receive(:exist?).with('setup.cfg').and_return(false)
|
|
27
|
+
expect(PythonDefault).not_to be_run
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe '#run!' do
|
|
32
|
+
before { base.test_framework = :pytest }
|
|
33
|
+
|
|
34
|
+
it 'returns the pytest command' do
|
|
35
|
+
allow(File).to receive(:exist?).with('tests').and_return(true)
|
|
36
|
+
expect(subject.run!).to eq 'pytest tests'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context 'with specific options' do
|
|
40
|
+
before do
|
|
41
|
+
Core::Base.specific_options = '-v --tb=short'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
after do
|
|
45
|
+
Core::Base.specific_options = ''
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'includes the options' do
|
|
49
|
+
allow(File).to receive(:exist?).with('tests').and_return(true)
|
|
50
|
+
expect(subject.run!).to eq 'pytest tests -v --tb=short'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -44,8 +44,25 @@ module InfinityTest
|
|
|
44
44
|
allow(Core::Base).to receive(:rubies).and_return(['2.7.0', '3.0.0'])
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
context 'with bundler' do
|
|
48
|
+
before do
|
|
49
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(true)
|
|
50
|
+
allow(File).to receive(:exist?).with('Gemfile').and_return(true)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'returns the command for multiple ruby versions with bundle exec' do
|
|
54
|
+
expect(subject.run!).to eq 'RBENV_VERSION=2.7.0 bundle exec rspec spec && RBENV_VERSION=3.0.0 bundle exec rspec spec'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context 'without bundler' do
|
|
59
|
+
before do
|
|
60
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(false)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'returns the command for multiple ruby versions without bundle exec' do
|
|
64
|
+
expect(subject.run!).to eq 'RBENV_VERSION=2.7.0 rspec spec && RBENV_VERSION=3.0.0 rspec spec'
|
|
65
|
+
end
|
|
49
66
|
end
|
|
50
67
|
end
|
|
51
68
|
end
|
|
@@ -23,8 +23,25 @@ module InfinityTest
|
|
|
23
23
|
describe '#run!' do
|
|
24
24
|
before { base.test_framework = :rspec }
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
context 'with bundler' do
|
|
27
|
+
before do
|
|
28
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(true)
|
|
29
|
+
allow(File).to receive(:exist?).with('Gemfile').and_return(true)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'returns the command with bundle exec' do
|
|
33
|
+
expect(subject.run!).to eq 'bundle exec rspec spec'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'without bundler' do
|
|
38
|
+
before do
|
|
39
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(false)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'returns the command without bundle exec' do
|
|
43
|
+
expect(subject.run!).to eq 'rspec spec'
|
|
44
|
+
end
|
|
28
45
|
end
|
|
29
46
|
end
|
|
30
47
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Strategy
|
|
5
|
+
describe RustDefault do
|
|
6
|
+
let(:base) { BaseFixture.new }
|
|
7
|
+
let(:continuous_test_server) { Core::ContinuousTestServer.new(base) }
|
|
8
|
+
subject { RustDefault.new(continuous_test_server) }
|
|
9
|
+
it_should_behave_like 'a infinity test strategy'
|
|
10
|
+
|
|
11
|
+
describe ".run?" do
|
|
12
|
+
it "returns true when Cargo.toml exists" do
|
|
13
|
+
allow(File).to receive(:exist?).with('Cargo.toml').and_return(true)
|
|
14
|
+
expect(RustDefault).to be_run
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "returns false when Cargo.toml does not exist" do
|
|
18
|
+
allow(File).to receive(:exist?).with('Cargo.toml').and_return(false)
|
|
19
|
+
expect(RustDefault).not_to be_run
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '#run!' do
|
|
24
|
+
before { base.test_framework = :cargo_test }
|
|
25
|
+
|
|
26
|
+
it 'returns the cargo test command' do
|
|
27
|
+
expect(subject.run!).to eq 'cargo test'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'with test files specified' do
|
|
31
|
+
before do
|
|
32
|
+
allow(continuous_test_server).to receive(:test_files).and_return('user')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'includes the test name' do
|
|
36
|
+
expect(subject.run!).to eq 'cargo test user'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'with specific options' do
|
|
41
|
+
before do
|
|
42
|
+
Core::Base.specific_options = '-- --nocapture'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
after do
|
|
46
|
+
Core::Base.specific_options = ''
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'includes the options' do
|
|
50
|
+
expect(subject.run!).to eq 'cargo test -- --nocapture'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -50,17 +50,34 @@ module InfinityTest
|
|
|
50
50
|
allow(Core::Base).to receive(:gemset).and_return(nil)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
context 'with bundler' do
|
|
54
|
+
before do
|
|
55
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(true)
|
|
56
|
+
allow(File).to receive(:exist?).with('Gemfile').and_return(true)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'returns the command for multiple ruby versions with bundle exec' do
|
|
60
|
+
expect(subject.run!).to eq 'rvm 2.7.0 do bundle exec rspec spec && rvm 3.0.0 do bundle exec rspec spec'
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context 'with gemset' do
|
|
64
|
+
before do
|
|
65
|
+
allow(Core::Base).to receive(:gemset).and_return('infinity_test')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'includes gemset in the command' do
|
|
69
|
+
expect(subject.run!).to eq 'rvm 2.7.0@infinity_test do bundle exec rspec spec && rvm 3.0.0@infinity_test do bundle exec rspec spec'
|
|
70
|
+
end
|
|
71
|
+
end
|
|
55
72
|
end
|
|
56
73
|
|
|
57
|
-
context '
|
|
74
|
+
context 'without bundler' do
|
|
58
75
|
before do
|
|
59
|
-
allow(Core::Base).to receive(:
|
|
76
|
+
allow(Core::Base).to receive(:using_bundler?).and_return(false)
|
|
60
77
|
end
|
|
61
78
|
|
|
62
|
-
it '
|
|
63
|
-
expect(subject.run!).to eq 'rvm 2.7.0
|
|
79
|
+
it 'returns the command for multiple ruby versions without bundle exec' do
|
|
80
|
+
expect(subject.run!).to eq 'rvm 2.7.0 do rspec spec && rvm 3.0.0 do rspec spec'
|
|
64
81
|
end
|
|
65
82
|
end
|
|
66
83
|
end
|