spec/unit/rom/http/gateway_spec.rb in rom-http-0.1.0 vs spec/unit/rom/http/gateway_spec.rb in rom-http-0.1.1
- old
+ new
@@ -27,11 +27,45 @@
it 'returns false if a table does not exist' do
expect(gateway.dataset?(:not_here)).to be(false)
end
end
- describe 'required config' do
- it 'errors if config does not meet requirements' do
- expect { ROM::HTTP::Gateway.new({}) }.to raise_error(ROM::HTTP::GatewayConfigurationError)
+ describe '#dataset' do
+ subject { gateway.dataset(:name) }
+
+ context 'when extended' do
+ let(:gateway) { Test::Gateway.new({}) }
+
+ before do
+ module Test
+ class Gateway < ROM::HTTP::Gateway; end
+ end
+ end
+
+ context 'when no Dataset defined in the same namespace' do
+ it 'returns ROM::HTTP::Dataset' do
+ is_expected.to be_kind_of(ROM::HTTP::Dataset)
+ end
+ end
+
+ context 'when Dataset defined in the same namespace' do
+ before do
+ module Test
+ class Dataset < ROM::HTTP::Dataset; end
+ end
+ end
+
+ it 'returns ROM::HTTP::Dataset' do
+ is_expected.to be_kind_of(Test::Dataset)
+ end
+ end
+ end
+
+ context 'when not extended' do
+ let(:gateway) { ROM::HTTP::Gateway.new({}) }
+
+ it 'returns ROM::HTTP::Dataset' do
+ is_expected.to be_kind_of(ROM::HTTP::Dataset)
+ end
end
end
end