Skip to content

Commit 206ad31

Browse files
author
Kevin Paulisse
committed
Add simple unit test for API fact override
1 parent 6a574b6 commit 206ad31

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../../spec_helper'
4+
5+
require OctocatalogDiff::Spec.require_path('/api/v1/fact_override')
6+
7+
describe OctocatalogDiff::API::V1::FactOverride do
8+
describe '#new' do
9+
it 'should raise error if key is not supplied' do
10+
expect { described_class.new(value: 'bar') }.to raise_error(KeyError, /key/)
11+
end
12+
13+
it 'should raise error if value is not supplied' do
14+
expect { described_class.new(key: 'bar') }.to raise_error(KeyError, /value/)
15+
end
16+
end
17+
18+
describe '#key' do
19+
it 'should return key' do
20+
testobj = described_class.new(key: 'foo', value: 'bar')
21+
expect(testobj.key).to eq('foo')
22+
end
23+
end
24+
25+
describe '#value' do
26+
it 'should return value' do
27+
testobj = described_class.new(key: 'foo', value: 'bar')
28+
expect(testobj.value).to eq('bar')
29+
end
30+
end
31+
end

0 commit comments

Comments
 (0)