forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat_spec.rb
More file actions
42 lines (33 loc) · 1.1 KB
/
Copy pathformat_spec.rb
File metadata and controls
42 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# encoding: utf-8
require 'spec_helper'
describe Github::Validations::Format do
let(:validator) { Class.new.extend(described_class) }
context '#_validate_params_values' do
let(:permitted) {
{
'param_a' => ['a', 'b'],
'param_b' => /^github$/
}
}
it 'fails to accept unkown value for a given parameter key' do
actual = { 'param_a' => 'x' }
expect {
validator.assert_valid_values(permitted, actual)
}.to raise_error(Github::Error::UnknownValue)
end
it 'accepts known value for a given parameter key' do
actual = { 'param_a' => 'a'}
validator.assert_valid_values(permitted, actual)
end
it 'fails to match regex value for a given parameter key' do
actual = { 'param_b' => 'xgithub' }
expect {
validator.assert_valid_values(permitted, actual)
}.to raise_error(Github::Error::UnknownValue)
end
it 'matches regex value for a given parameter key' do
actual = { 'param_b' => 'github'}
validator.assert_valid_values(permitted, actual)
end
end
end # Github::Validations::Format