Skip to content

Commit 26193e8

Browse files
committed
Exclude validation tests for older version of Ruby
1 parent 1615355 commit 26193e8

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

spec/validation_spec.rb

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
11
require 'spec_helper'
22

3-
describe Config do
4-
context 'validation' do
5-
around(:each) do |example|
6-
Config.reset
7-
example.run
8-
Config.reset
9-
end
3+
if RUBY_VERSION >= '2.1'
4+
describe Config do
5+
context 'validation' do
6+
around(:each) do |example|
7+
Config.reset
8+
example.run
9+
Config.reset
10+
end
1011

11-
it 'should raise if schema is present and validation fails' do
12-
Config.setup do |config|
13-
config.schema do
14-
required(:youtube).schema do
15-
required(:nonexist_field).filled
12+
it 'should raise if schema is present and validation fails' do
13+
Config.setup do |config|
14+
config.schema do
15+
required(:youtube).schema do
16+
required(:nonexist_field).filled
17+
end
1618
end
1719
end
18-
end
1920

20-
expect { Config.load_files("#{fixture_path}/validation/config.yml") }.
21-
to raise_error(Config::Validation::Error, /youtube.nonexist_field: is missing/)
22-
end
21+
expect { Config.load_files("#{fixture_path}/validation/config.yml") }.
22+
to raise_error(Config::Validation::Error, /youtube.nonexist_field: is missing/)
23+
end
2324

24-
it 'should work if validation passes' do
25-
Config.setup do |config|
26-
config.schema do
27-
required(:youtube).schema do
28-
required(:api_key).filled
25+
it 'should work if validation passes' do
26+
Config.setup do |config|
27+
config.schema do
28+
required(:youtube).schema do
29+
required(:api_key).filled
30+
end
2931
end
3032
end
31-
end
3233

33-
expect { Config.load_files("#{fixture_path}/validation/config.yml") }.
34-
to_not raise_error
34+
expect { Config.load_files("#{fixture_path}/validation/config.yml") }.
35+
to_not raise_error
36+
end
3537
end
3638
end
3739
end

0 commit comments

Comments
 (0)