Skip to content

Commit b52dc92

Browse files
committed
add specs for LibrarySourceConfig
1 parent a44cbde commit b52dc92

19 files changed

+87
-5
lines changed

lib/bashly/library_source_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def assert_root(path, value)
3030

3131
def assert_lib(key, value)
3232
assert_string "#{key}.help", value['help']
33-
33+
3434
assert_optional_string "#{key}.usage", value['usage']
3535
assert_optional_string "#{key}.handler", value['handler']
3636
assert_optional_string "#{key}.post_install_message", value['post_install_message']
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/files_array.yml] database.files must be an array>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/files_source.yml] database.files[0].source must be a string>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/files_target.yml] database.files[0].target must be a string>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/handler_string.yml] database.handler must be a string>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/help_string.yml] database.help must be a string>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/message_string.yml] database.post_install_message must be a string>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: spec/fixtures/libraries/errors/root_hash.yml must be a hash>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#<Bashly::ConfigurationError: [spec/fixtures/libraries/errors/usage_string.yml] database.usage must be a string>

spec/bashly/config_validator_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
describe ConfigValidator do
22
fixtures = load_fixture 'script/validations'
3-
subject { described_class.new options }
43

54
describe '#validate' do
65
fixtures.each do |fixture, options|
7-
context "with :#{fixture}" do
8-
let(:options) { options }
6+
validator = described_class.new options
97

8+
context "with :#{fixture}" do
109
it 'raises an error' do
11-
expect { subject.validate }.to raise_approval("validations/#{fixture}")
10+
expect { validator.validate }.to raise_approval("validations/#{fixture}")
1211
end
1312
end
1413
end

0 commit comments

Comments
 (0)