infinity_test 1.0.3 → 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 +7 -0
- data/.github/workflows/ci.yml +31 -0
- data/.gitignore +3 -0
- data/.rspec +2 -2
- data/AI_INTEGRATION_IDEAS.md +203 -0
- data/Gemfile +3 -15
- data/HISTORY.md +84 -0
- data/History.markdown +82 -0
- data/{.infinity_test → INFINITY_TEST} +18 -15
- data/LICENSE.txt +2 -2
- data/README.md +867 -0
- data/Rakefile +1 -65
- data/TODO.markdown +38 -24
- data/bin/infinity_test +1 -4
- data/images/fuuu/pending.png +0 -0
- data/images/fuuu/success.png +0 -0
- data/infinity_test.gemspec +41 -189
- data/lib/infinity_test/core/auto_discover.rb +67 -0
- data/lib/infinity_test/core/base.rb +369 -0
- data/lib/infinity_test/core/callback.rb +59 -0
- data/lib/infinity_test/core/changed_file.rb +13 -0
- data/lib/infinity_test/core/command_builder.rb +48 -0
- data/lib/infinity_test/core/command_runner.rb +38 -0
- data/lib/infinity_test/core/configuration_merge.rb +37 -0
- data/lib/infinity_test/core/continuous_test_server.rb +124 -0
- data/lib/infinity_test/core/load_configuration.rb +48 -0
- data/lib/infinity_test/core/notifier.rb +59 -0
- data/lib/infinity_test/core/options.rb +134 -0
- data/lib/infinity_test/core/runner.rb +18 -0
- data/lib/infinity_test/core/version.rb +5 -0
- data/lib/infinity_test/framework/base.rb +93 -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 +30 -0
- 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 +26 -0
- data/lib/infinity_test/framework/rocket.rb +70 -0
- data/lib/infinity_test/framework/rubygems.rb +29 -0
- data/lib/infinity_test/framework/rust_cargo.rb +69 -0
- data/lib/infinity_test/framework/shared_example.rb +47 -0
- data/lib/infinity_test/observer/base.rb +40 -0
- data/lib/infinity_test/observer/filewatcher.rb +72 -0
- data/lib/infinity_test/observer/listen.rb +74 -0
- data/lib/infinity_test/observer/shared_example.rb +35 -0
- data/lib/infinity_test/old_dsl/configuration.rb +26 -0
- data/lib/infinity_test/strategy/base.rb +50 -0
- 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 +34 -0
- data/lib/infinity_test/strategy/ruby_default.rb +21 -0
- data/lib/infinity_test/strategy/rust_default.rb +21 -0
- data/lib/infinity_test/strategy/rvm.rb +52 -0
- data/lib/infinity_test/strategy/shared_example.rb +32 -0
- data/lib/infinity_test/test_framework/base.rb +64 -0
- 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/test_framework/rspec.rb +48 -0
- data/lib/infinity_test/test_framework/shared_example.rb +56 -0
- data/lib/infinity_test/test_framework/test_unit.rb +57 -0
- data/lib/infinity_test.rb +66 -35
- data/spec/infinity_test/core/auto_discover_spec.rb +175 -0
- data/spec/infinity_test/core/base_spec.rb +240 -0
- data/spec/infinity_test/core/callback_spec.rb +89 -0
- data/spec/infinity_test/core/changed_file_spec.rb +26 -0
- data/spec/infinity_test/core/command_builder_spec.rb +38 -0
- data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
- data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
- data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
- data/spec/infinity_test/core/notifier_spec.rb +151 -0
- data/spec/infinity_test/core/options_spec.rb +168 -0
- data/spec/infinity_test/core/runner_spec.rb +17 -0
- data/spec/infinity_test/framework/base_spec.rb +55 -0
- 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 +58 -0
- 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 +58 -0
- data/spec/infinity_test/framework/rocket_spec.rb +69 -0
- data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
- data/spec/infinity_test/framework/rust_cargo_spec.rb +94 -0
- data/spec/infinity_test/observer/base_spec.rb +78 -0
- data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
- data/spec/infinity_test/observer/listen_spec.rb +50 -0
- data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
- 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 +70 -0
- data/spec/infinity_test/strategy/ruby_default_spec.rb +49 -0
- data/spec/infinity_test/strategy/rust_default_spec.rb +56 -0
- data/spec/infinity_test/strategy/rvm_spec.rb +86 -0
- 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
- data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
- data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
- data/spec/spec_helper.rb +34 -119
- metadata +315 -177
- data/.rvmrc +0 -1
- data/Gemfile.lock +0 -62
- data/Readme.markdown +0 -147
- data/Tasks +0 -4
- data/VERSION.yml +0 -5
- data/buzz_images/buzz_lightyear.jpg +0 -0
- data/buzz_images/buzz_lightyear_continencia.gif +0 -0
- data/buzz_images/to_infinity_and_beyond.png +0 -0
- data/features/heuristics.feature +0 -23
- data/features/support/env.rb +0 -2
- data/images/fuuu/sucess.png +0 -0
- data/lib/infinity_test/application.rb +0 -362
- data/lib/infinity_test/application_library/rails.rb +0 -94
- data/lib/infinity_test/application_library/rubygems.rb +0 -43
- data/lib/infinity_test/binary_path.rb +0 -43
- data/lib/infinity_test/builder.rb +0 -66
- data/lib/infinity_test/command.rb +0 -58
- data/lib/infinity_test/configuration.rb +0 -277
- data/lib/infinity_test/continuous_testing.rb +0 -40
- data/lib/infinity_test/dependencies.rb +0 -80
- data/lib/infinity_test/environment.rb +0 -15
- data/lib/infinity_test/heuristics.rb +0 -36
- data/lib/infinity_test/heuristics_helper.rb +0 -9
- data/lib/infinity_test/options.rb +0 -96
- data/lib/infinity_test/runner.rb +0 -38
- data/lib/infinity_test/test_framework.rb +0 -110
- data/lib/infinity_test/test_library/bacon.rb +0 -55
- data/lib/infinity_test/test_library/cucumber.rb +0 -22
- data/lib/infinity_test/test_library/rspec.rb +0 -60
- data/lib/infinity_test/test_library/test_unit.rb +0 -52
- data/lib/infinity_test/test_unit_loader.rb +0 -5
- data/spec/factories/buzz/lib/buzz.rb +0 -0
- data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
- data/spec/factories/company/Gemfile +0 -0
- data/spec/factories/company/lib/company.rb +0 -0
- data/spec/factories/company/test/company_test.rb +0 -0
- data/spec/factories/images/failure.png +0 -0
- data/spec/factories/images/pending.png +0 -0
- data/spec/factories/images/sucess.png +0 -0
- data/spec/factories/infinity_test +0 -5
- data/spec/factories/infinity_test_example +0 -7
- data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
- data/spec/factories/travel/lib/travel.rb +0 -0
- data/spec/factories/travel/test/partner_test.rb +0 -0
- data/spec/factories/travel/test/travel_test.rb +0 -0
- data/spec/factories/wood/lib/wood.rb +0 -0
- data/spec/factories/wood/spec/wood_spec.rb +0 -0
- data/spec/infinity_test/application_library/rails_spec.rb +0 -140
- data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
- data/spec/infinity_test/application_spec.rb +0 -434
- data/spec/infinity_test/binary_path_spec.rb +0 -72
- data/spec/infinity_test/command_spec.rb +0 -53
- data/spec/infinity_test/configuration_spec.rb +0 -382
- data/spec/infinity_test/continuous_testing_spec.rb +0 -25
- data/spec/infinity_test/environment_spec.rb +0 -23
- data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
- data/spec/infinity_test/heuristics_spec.rb +0 -127
- data/spec/infinity_test/options_spec.rb +0 -111
- data/spec/infinity_test/runner_spec.rb +0 -42
- data/spec/infinity_test/test_framework_spec.rb +0 -127
- data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
- data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
- data/spec/infinity_test/test_library/rspec_spec.rb +0 -189
- data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
- data/spec/infinity_test_spec.rb +0 -40
- /data/images/faces/{sucess.png → success.png} +0 -0
- /data/images/hands/{sucess.png → success.png} +0 -0
- /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
- /data/images/rails/{sucess.png → success.png} +0 -0
- /data/images/rubies/{sucess.png → success.png} +0 -0
- /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
- /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
- /data/images/toy_story/{sucess.png → success.png} +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Core
|
|
5
|
+
describe ConfigurationMerge do
|
|
6
|
+
let(:base) do
|
|
7
|
+
OpenStruct.new(
|
|
8
|
+
:bundler => true,
|
|
9
|
+
:verbose => true,
|
|
10
|
+
:strategy => :auto_discover,
|
|
11
|
+
:observer => :watchr,
|
|
12
|
+
:rubies => [],
|
|
13
|
+
:specific_options => '',
|
|
14
|
+
:framework => :auto_discover,
|
|
15
|
+
:test_framework => :auto_discover,
|
|
16
|
+
:infinity_and_beyond => true
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
let(:options) { Options.new([]) }
|
|
21
|
+
subject { ConfigurationMerge.new(base, options) }
|
|
22
|
+
|
|
23
|
+
describe "#merge!" do
|
|
24
|
+
it "keeps the strategy when options strategy is blank" do
|
|
25
|
+
subject.merge!
|
|
26
|
+
expect(base.strategy).to be :auto_discover
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "merges the strategies" do
|
|
30
|
+
expect(options).to receive(:strategy).twice.and_return(:rbenv)
|
|
31
|
+
subject.merge!
|
|
32
|
+
expect(base.strategy).to be :rbenv
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "keeps the rubies when options rubies is nil" do
|
|
36
|
+
base.rubies = %w(jruby ree)
|
|
37
|
+
expect(options).to receive(:rubies).and_return(nil)
|
|
38
|
+
subject.merge!
|
|
39
|
+
expect(base.rubies).to eq %w(jruby ree)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "overwrites the rubies when options rubies is empty" do
|
|
43
|
+
base.rubies = %w(jruby ree)
|
|
44
|
+
expect(options).to receive(:rubies).twice.and_return([])
|
|
45
|
+
subject.merge!
|
|
46
|
+
expect(base.rubies).to be_blank
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "merges the rubies" do
|
|
50
|
+
expect(options).to receive(:rubies).twice.and_return(%w(ree jruby))
|
|
51
|
+
subject.merge!
|
|
52
|
+
expect(base.rubies).to eql %w(ree jruby)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "keeps the test framework when options test framework is blank" do
|
|
56
|
+
subject.merge!
|
|
57
|
+
expect(base.test_framework).to be :auto_discover
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "merges the test library" do
|
|
61
|
+
expect(options).to receive(:test_framework).twice.and_return(:rspec)
|
|
62
|
+
subject.merge!
|
|
63
|
+
expect(base.test_framework).to be :rspec
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "keeps the framework when options framework is blank" do
|
|
67
|
+
subject.merge!
|
|
68
|
+
expect(base.framework).to be :auto_discover
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "merges the framework" do
|
|
72
|
+
expect(options).to receive(:framework).twice.and_return(:rails)
|
|
73
|
+
subject.merge!
|
|
74
|
+
expect(base.framework).to be :rails
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it "keeps the specific option when options specific is blank" do
|
|
78
|
+
subject.merge!
|
|
79
|
+
expect(base.specific_options).to eql ''
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "merges the specific options" do
|
|
83
|
+
expect(options).to receive(:specific_options).twice.and_return('-J -Ilib -Itest')
|
|
84
|
+
subject.merge!
|
|
85
|
+
expect(base.specific_options).to eql '-J -Ilib -Itest'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "merges with the infinity test and beyond" do
|
|
89
|
+
expect(options).to receive(:infinity_and_beyond).twice.and_return(false)
|
|
90
|
+
subject.merge!
|
|
91
|
+
expect(base.infinity_and_beyond).to be false
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "keeps the base default if option infinity test and beyond is nil" do
|
|
95
|
+
expect(options).to receive(:infinity_and_beyond).and_return(nil)
|
|
96
|
+
subject.merge!
|
|
97
|
+
expect(base.infinity_and_beyond).to be true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "keeps the verbose mode when verbose mode is blank" do
|
|
101
|
+
subject.merge!
|
|
102
|
+
expect(base.verbose).to be true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "merges the verbose mode" do
|
|
106
|
+
expect(options).to receive(:verbose).twice.and_return(false)
|
|
107
|
+
subject.merge!
|
|
108
|
+
expect(base.verbose).to be false
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "keeps the bundler default when bundler is blank" do
|
|
112
|
+
subject.merge!
|
|
113
|
+
expect(base.bundler).to be true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it "merges the bundler mode" do
|
|
117
|
+
expect(options).to receive(:bundler).twice.and_return(false)
|
|
118
|
+
subject.merge!
|
|
119
|
+
expect(base.bundler).to be false
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Core
|
|
5
|
+
describe ContinuousTestServer do
|
|
6
|
+
let(:base) { Core::Base }
|
|
7
|
+
let(:continuous_test_server) { ContinuousTestServer.new(base) }
|
|
8
|
+
|
|
9
|
+
describe '#start!' do
|
|
10
|
+
it 'runs strategy and starts observer' do
|
|
11
|
+
expect(continuous_test_server).to receive(:run_strategy)
|
|
12
|
+
expect(continuous_test_server).to receive(:start_observer)
|
|
13
|
+
continuous_test_server.start
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#start_observer' do
|
|
18
|
+
context 'when base configuration as infinity and beyond' do
|
|
19
|
+
before do
|
|
20
|
+
expect(base).to receive(:infinity_and_beyond).and_return(true)
|
|
21
|
+
allow(base).to receive(:framework).and_return(:rails)
|
|
22
|
+
allow(base).to receive(:observer).and_return(:listen)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'adds framework heuristics and starts the observer' do
|
|
26
|
+
expect(continuous_test_server.framework).to receive(:heuristics!)
|
|
27
|
+
expect(continuous_test_server.observer).to receive(:start!)
|
|
28
|
+
continuous_test_server.start_observer
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context 'when base configuration is not infinity and beyond' do
|
|
33
|
+
before do
|
|
34
|
+
expect(base).to receive(:infinity_and_beyond).and_return(false)
|
|
35
|
+
allow(base).to receive(:framework).and_return(:rails)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'does not start the observer' do
|
|
39
|
+
expect(continuous_test_server.framework).to_not receive(:heuristics!)
|
|
40
|
+
expect(continuous_test_server.observer).to_not receive(:start!)
|
|
41
|
+
continuous_test_server.start_observer
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe '#notify' do
|
|
47
|
+
let(:continuous_test_server) { ContinuousTestServer.new(base) }
|
|
48
|
+
let(:test_message) { '200 examples, 0 failures, 0 pending' }
|
|
49
|
+
|
|
50
|
+
context 'when have notification library' do
|
|
51
|
+
let(:test_framework) { double }
|
|
52
|
+
let(:base) { double(notifications: :auto_discover) }
|
|
53
|
+
|
|
54
|
+
before do
|
|
55
|
+
expect(continuous_test_server).to receive(:test_framework).exactly(:twice).and_return(test_framework)
|
|
56
|
+
expect(test_framework).to receive(:test_message=).with(test_message)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'instantiates a notifier passing the strategy result and the continuous server' do
|
|
60
|
+
expect(Core::Notifier).to receive(:new).and_return(double(notify: true))
|
|
61
|
+
continuous_test_server.notify(test_message)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context 'when do not have notification library' do
|
|
66
|
+
let(:base) { double(notifications: nil) }
|
|
67
|
+
|
|
68
|
+
it 'does not instantiate a notifier' do
|
|
69
|
+
expect(Core::Notifier).to_not receive(:new)
|
|
70
|
+
continuous_test_server.notify(test_message)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe '#rerun_strategy' do
|
|
76
|
+
let(:test_framework) { double }
|
|
77
|
+
|
|
78
|
+
before do
|
|
79
|
+
expect(continuous_test_server).to receive(:test_framework).twice.and_return(test_framework)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'runs strategy again and ensures the test files is nil after' do
|
|
83
|
+
expect(test_framework).to receive(:test_files=).twice
|
|
84
|
+
expect(continuous_test_server).to receive(:run_strategy)
|
|
85
|
+
continuous_test_server.rerun_strategy('base_test.py')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe '#strategy' do
|
|
90
|
+
subject { continuous_test_server.strategy }
|
|
91
|
+
before { expect(base).to receive(:strategy).and_return(:ruby_default) }
|
|
92
|
+
|
|
93
|
+
it { should be_instance_of InfinityTest::Strategy::RubyDefault }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe '#test_framework' do
|
|
97
|
+
subject { continuous_test_server.test_framework }
|
|
98
|
+
before { expect(base).to receive(:test_framework).and_return(:rspec) }
|
|
99
|
+
|
|
100
|
+
it { should be_instance_of InfinityTest::TestFramework::Rspec }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
describe '#binary' do
|
|
104
|
+
subject { continuous_test_server }
|
|
105
|
+
|
|
106
|
+
it { should respond_to :binary }
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
describe '#test_files' do
|
|
110
|
+
subject { continuous_test_server }
|
|
111
|
+
|
|
112
|
+
it { should respond_to :test_files }
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
describe LoadConfiguration do
|
|
5
|
+
describe "#load!" do
|
|
6
|
+
it "loads global file and project file" do
|
|
7
|
+
expect(subject).to receive(:load_global_file!).and_return(true)
|
|
8
|
+
expect(subject).to receive(:load_project_file!).and_return(true)
|
|
9
|
+
subject.load!
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "#load_global_file!" do
|
|
14
|
+
it "loads the global file" do
|
|
15
|
+
subject.global_file = 'foo'
|
|
16
|
+
expect(subject).to receive(:load_file).with('foo').and_return(true)
|
|
17
|
+
subject.load_global_file!
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "#load_project_file!" do
|
|
22
|
+
it "loads the project file" do
|
|
23
|
+
subject.project_file = 'bar'
|
|
24
|
+
expect(subject).to receive(:load_file).with('bar').and_return(true)
|
|
25
|
+
subject.load_project_file!
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "#load_file" do
|
|
30
|
+
it "loads if file exists" do
|
|
31
|
+
expect(File).to receive(:exist?).with('bar').and_return(true)
|
|
32
|
+
expect(subject).to receive(:load).with('bar').and_return(true)
|
|
33
|
+
expect(subject.load_file('bar')).to be true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "does not load if file does not exist" do
|
|
37
|
+
expect(File).to receive(:exist?).with('baz').and_return(false)
|
|
38
|
+
expect(subject).to_not receive(:load)
|
|
39
|
+
subject.load_file('baz')
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Core
|
|
5
|
+
describe Notifier do
|
|
6
|
+
let(:test_framework) { double }
|
|
7
|
+
|
|
8
|
+
subject(:notifier) { Notifier.new(test_framework: test_framework, library: :auto_discover) }
|
|
9
|
+
|
|
10
|
+
describe '#image' do
|
|
11
|
+
before do
|
|
12
|
+
expect(Core::Base).to receive(:mode).and_return(:simpson)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context 'when success tests' do
|
|
16
|
+
before do
|
|
17
|
+
expect(test_framework).to receive(:success?).and_return(true)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'returns the success image' do
|
|
21
|
+
expect(notifier.image).to include 'success'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context 'when pending tests' do
|
|
26
|
+
before do
|
|
27
|
+
expect(test_framework).to receive(:success?).and_return(false)
|
|
28
|
+
expect(test_framework).to receive(:failure?).and_return(false)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'returns the pending image' do
|
|
32
|
+
expect(notifier.image).to include 'pending'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
context 'when failing tests' do
|
|
37
|
+
before do
|
|
38
|
+
expect(test_framework).to receive(:success?).and_return(false)
|
|
39
|
+
expect(test_framework).to receive(:failure?).and_return(true)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'returns the failure image' do
|
|
43
|
+
expect(notifier.image).to include 'failure'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe '#library' do
|
|
49
|
+
it 'returns the primitive value' do
|
|
50
|
+
expect(notifier.library).to be :auto_discover
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe '#test_message' do
|
|
55
|
+
it 'respond to' do
|
|
56
|
+
expect(notifier).to respond_to(:test_message)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe '#images_dir' do
|
|
61
|
+
context 'when is default infinity test dir' do
|
|
62
|
+
before do
|
|
63
|
+
expect(Core::Base).to receive(:mode).and_return(:simpson)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'returns the dir with the base mode' do
|
|
67
|
+
expect(notifier.images_dir).to include '/images/simpson'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
context 'when is pre defined images dir' do
|
|
72
|
+
before do
|
|
73
|
+
expect(Core::Base).to receive(:mode).and_return('/my_images_dir')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'returns the user dir expanded path' do
|
|
77
|
+
expect(notifier.images_dir).to eq '/my_images_dir'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe '#success_image' do
|
|
83
|
+
context 'when core base image is blank' do
|
|
84
|
+
it 'find a image inside mode dir' do
|
|
85
|
+
expect(notifier).to receive(:find_image).with(:success)
|
|
86
|
+
notifier.success_image
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'when core base has a image' do
|
|
91
|
+
it 'returns core base image' do
|
|
92
|
+
expect(Core::Base).to receive(:success_image).and_return('some_image.png')
|
|
93
|
+
expect(notifier.success_image).to eq 'some_image.png'
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
describe '#failure_image' do
|
|
99
|
+
context 'when core base image is blank' do
|
|
100
|
+
it 'find a image inside mode dir' do
|
|
101
|
+
expect(notifier).to receive(:find_image).with(:failure)
|
|
102
|
+
notifier.failure_image
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context 'when core base has a image' do
|
|
107
|
+
it 'returns core base image' do
|
|
108
|
+
expect(Core::Base).to receive(:failure_image).and_return('some_image.png')
|
|
109
|
+
expect(notifier.failure_image).to eq 'some_image.png'
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
describe '#pending_image' do
|
|
115
|
+
context 'when core base image is blank' do
|
|
116
|
+
it 'find a image inside mode dir' do
|
|
117
|
+
expect(notifier).to receive(:find_image).with(:pending)
|
|
118
|
+
notifier.pending_image
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context 'when core base has a image' do
|
|
123
|
+
it 'returns core base image' do
|
|
124
|
+
expect(Core::Base).to receive(:pending_image).and_return('some_image.png')
|
|
125
|
+
expect(notifier.pending_image).to eq 'some_image.png'
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe '#notify' do
|
|
131
|
+
let(:notification_builder) { double }
|
|
132
|
+
|
|
133
|
+
before do
|
|
134
|
+
expect(Core::Base).to receive(:mode).and_return(:simpson)
|
|
135
|
+
expect(test_framework).to receive(:success?).and_return(true)
|
|
136
|
+
expect(test_framework).to receive(:test_message).and_return('5 examples, 0 failures')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'sends a notification with title, message and image' do
|
|
140
|
+
expect(notifier).to receive(:auto_discover).and_return(notification_builder)
|
|
141
|
+
expect(notification_builder).to receive(:title).with(RUBY_VERSION).and_return(notification_builder)
|
|
142
|
+
expect(notification_builder).to receive(:message).with('5 examples, 0 failures').and_return(notification_builder)
|
|
143
|
+
expect(notification_builder).to receive(:image).and_return(notification_builder)
|
|
144
|
+
expect(notification_builder).to receive(:notify)
|
|
145
|
+
|
|
146
|
+
notifier.notify
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
describe Options do
|
|
5
|
+
describe "#parse!" do
|
|
6
|
+
describe "#strategy" do
|
|
7
|
+
it "parses the --ruby options with rvm" do
|
|
8
|
+
expect(parse('--ruby', 'rvm').strategy).to be :rvm
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "parses the --ruby options with rbenv" do
|
|
12
|
+
expect(parse('--ruby', 'rbenv').strategy).to be :rbenv
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "#rubies" do
|
|
17
|
+
it "passes the ruby versions" do
|
|
18
|
+
expect(parse('--rubies=ree,jruby').rubies).to eql %w(ree jruby)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "has empty rubies when pass rubies= without versions" do
|
|
22
|
+
expect(parse('--rubies=').rubies).to eql []
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "is nil when rubies option is not passed" do
|
|
26
|
+
expect(parse.rubies).to be_nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "#infinity_and_beyond" do
|
|
31
|
+
it "returns false when setting --no-infinity-and-beyond" do
|
|
32
|
+
expect(parse('--no-infinity-and-beyond').infinity_and_beyond).to equal false
|
|
33
|
+
expect(parse('-n').infinity_and_beyond).to equal false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "returns nil when not setting the --no-infinity-and-beyond" do
|
|
37
|
+
expect(parse.infinity_and_beyond).to be_nil
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe "#specific_options" do
|
|
42
|
+
it "parses the options" do
|
|
43
|
+
expect(parse('--options=-J-Ilib-Itest').specific_options).to eql '-J -Ilib -Itest'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "#test_framework" do
|
|
48
|
+
it "parses the test framework as rspec" do
|
|
49
|
+
expect(parse('--test', 'rspec').test_framework).to be :rspec
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "parses the test framework as test_unit" do
|
|
53
|
+
expect(parse('--test', 'test_unit').test_framework).to be :test_unit
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "parses the test framework as other" do
|
|
57
|
+
expect(parse('--test', 'other').test_framework).to be :other
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "#framework" do
|
|
62
|
+
it "parses the app framework as rails" do
|
|
63
|
+
expect(parse('--framework', 'rails').framework).to be :rails
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "parses the app framework as rubygems" do
|
|
67
|
+
expect(parse('--framework', 'rubygems').framework).to be :rubygems
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "parses the app framework as other" do
|
|
71
|
+
expect(parse('--framework', 'other').framework).to be :other
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe "#verbose?" do
|
|
76
|
+
it "returns nil when nothing is passed" do
|
|
77
|
+
expect(parse.verbose?).to be_nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "is not verbose when passing the option --no-verbose" do
|
|
81
|
+
expect(parse('--no-verbose')).not_to be_verbose
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "#bundler?" do
|
|
86
|
+
it "does not use bundler when passing this option" do
|
|
87
|
+
expect(parse('--no-bundler')).not_to be_bundler
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "returns nil when nothing is passed" do
|
|
91
|
+
expect(parse.bundler?).to be_nil
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe "#notifications" do
|
|
96
|
+
it "parses the notifications library as auto_discover" do
|
|
97
|
+
expect(parse('--notifications', 'auto_discover').notifications).to be :auto_discover
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "parses the notifications library as osascript" do
|
|
101
|
+
expect(parse('--notifications', 'osascript').notifications).to be :osascript
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "parses the notifications library as terminal_notifier" do
|
|
105
|
+
expect(parse('--notifications', 'terminal_notifier').notifications).to be :terminal_notifier
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it "returns nil when nothing is passed" do
|
|
109
|
+
expect(parse.notifications).to be_nil
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe "#mode" do
|
|
114
|
+
it "parses the image mode as simpson" do
|
|
115
|
+
expect(parse('--mode', 'simpson').mode).to be :simpson
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "parses the image mode as faces" do
|
|
119
|
+
expect(parse('--mode', 'faces').mode).to be :faces
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "parses the image mode as rails" do
|
|
123
|
+
expect(parse('--mode', 'rails').mode).to be :rails
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "returns nil when nothing is passed" do
|
|
127
|
+
expect(parse.mode).to be_nil
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
describe "#just_watch" do
|
|
132
|
+
it "returns true when setting --just-watch" do
|
|
133
|
+
expect(parse('--just-watch').just_watch).to eq true
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it "returns true when setting -j" do
|
|
137
|
+
expect(parse('-j').just_watch).to eq true
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it "returns nil when nothing is passed" do
|
|
141
|
+
expect(parse.just_watch).to be_nil
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
describe "#focus" do
|
|
146
|
+
it "parses --focus with file path" do
|
|
147
|
+
expect(parse('--focus', 'spec/models/user_spec.rb').focus).to eq 'spec/models/user_spec.rb'
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it "parses -f with file path" do
|
|
151
|
+
expect(parse('-f', 'spec/models/user_spec.rb').focus).to eq 'spec/models/user_spec.rb'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it "parses --focus failures as symbol" do
|
|
155
|
+
expect(parse('--focus', 'failures').focus).to eq :failures
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it "returns nil when nothing is passed" do
|
|
159
|
+
expect(parse.focus).to be_nil
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def parse(*args)
|
|
165
|
+
InfinityTest::Options.new(args.flatten).parse!
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
describe Runner do
|
|
5
|
+
let(:runner) { Runner.new('--ruby', 'rvm') }
|
|
6
|
+
|
|
7
|
+
describe '#start' do
|
|
8
|
+
it 'load configuration, merge with command line, find user libraries and start continuous server' do
|
|
9
|
+
expect_any_instance_of(Core::LoadConfiguration).to receive(:load!)
|
|
10
|
+
expect(Core::Base).to receive(:merge!).with(runner.options)
|
|
11
|
+
expect_any_instance_of(Core::AutoDiscover).to receive(:discover_libraries)
|
|
12
|
+
expect_any_instance_of(ContinuousTestServer).to receive(:start)
|
|
13
|
+
runner.start
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module InfinityTest
|
|
4
|
+
module Framework
|
|
5
|
+
describe Base do
|
|
6
|
+
subject(:base) { Base.new(continuous_test_server) }
|
|
7
|
+
let(:continuous_test_server) { double(extension: :rb) }
|
|
8
|
+
|
|
9
|
+
describe '#run_all' do
|
|
10
|
+
it 'call run strategy to continuous test server' do
|
|
11
|
+
expect(continuous_test_server).to receive(:run_strategy)
|
|
12
|
+
base.run_all
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#run_test' do
|
|
17
|
+
let(:test_framework) { double(test_dir: 'test') }
|
|
18
|
+
|
|
19
|
+
before do
|
|
20
|
+
expect(base).to receive(:test_framework).and_return(test_framework)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'find a file' do
|
|
24
|
+
it 'call run strategy to continuous test server' do
|
|
25
|
+
expect(base.hike).to receive(:find).with('framework/base_test.rb').and_return('framework/base_test.rb')
|
|
26
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('framework/base_test.rb')
|
|
27
|
+
base.run_test(double(path: 'framework/base'))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'use the extension name from core base' do
|
|
31
|
+
expect(base).to receive(:extension).and_return('py')
|
|
32
|
+
expect(base.hike).to receive(:find).with('framework/base_test.py').and_return('framework/base_test.py')
|
|
33
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('framework/base_test.py')
|
|
34
|
+
base.run_test(double(path: 'framework/base'))
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context 'when do not find any files' do
|
|
39
|
+
it 'do not call rerun strategy' do
|
|
40
|
+
expect(base.hike).to receive(:find).with('test_framework/rspec_test.rb').and_return(nil)
|
|
41
|
+
expect(continuous_test_server).to_not receive(:rerun_strategy)
|
|
42
|
+
base.run_test(double(path: 'test_framework/rspec'))
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe '#run_file' do
|
|
48
|
+
it 'rerun strategy passing the changed file path' do
|
|
49
|
+
expect(continuous_test_server).to receive(:rerun_strategy).with('base_spec.rb')
|
|
50
|
+
base.run_file(double(name: 'base_spec.rb', path: 'base_spec'))
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|