|
4 | 4 | # Copyright, 2024, by Samuel Williams. |
5 | 5 |
|
6 | 6 | require 'async/service/configuration' |
| 7 | +require "async/service/good_interface" |
7 | 8 |
|
8 | 9 | describe Async::Service::Configuration do |
9 | 10 | with '.build' do |
|
29 | 30 | end |
30 | 31 | end |
31 | 32 |
|
| 33 | + with "null serice configuration file" do |
| 34 | + let(:configuration_path) {File.join(__dir__, '.configurations', 'null.rb')} |
| 35 | + |
| 36 | + let(:configuration) do |
| 37 | + subject.new.tap do |configuration| |
| 38 | + configuration.load_file(configuration_path) |
| 39 | + end |
| 40 | + end |
| 41 | + |
| 42 | + it 'can load configuration' do |
| 43 | + expect(configuration).not.to be(:empty?) |
| 44 | + |
| 45 | + environment = configuration.environments.first |
| 46 | + evaluator = environment.evaluator |
| 47 | + expect(evaluator.name).to be == 'null' |
| 48 | + |
| 49 | + expect(configuration.services.to_a).to be(:empty?) |
| 50 | + end |
| 51 | + end |
| 52 | + |
| 53 | + with "implementing service configuration file" do |
| 54 | + let(:configuration_path) {File.join(__dir__, '.configurations', 'implementing.rb')} |
| 55 | + |
| 56 | + let(:configuration) do |
| 57 | + subject.new.tap do |configuration| |
| 58 | + configuration.load_file(configuration_path) |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + it "can select services by implementing module" do |
| 63 | + expect(configuration).not.to be(:empty?) |
| 64 | + |
| 65 | + expect(configuration.services(implementing: Async::Service::GoodInterface).to_a).not.to be(:empty?) |
| 66 | + end |
| 67 | + end |
| 68 | + |
32 | 69 | with 'sleep service configuration file' do |
33 | 70 | let(:configuration_path) {File.join(__dir__, '.configurations', 'sleep.rb')} |
34 | 71 | let(:configuration_root) {File.join(File.realpath(__dir__), '.configurations')} |
|
0 commit comments