spec/hyperdrive/dsl_spec.rb in hyperdrive-0.0.15 vs spec/hyperdrive/dsl_spec.rb in hyperdrive-0.0.16
- old
+ new
@@ -9,10 +9,13 @@
description 'Example Description'
vendor 'example'
media_types %w(json)
cors({ origins: '*', allow_headers: %w(Accept), test: 'test'})
resource(:thing) {}
+ per_page '0'
+ ssl true
+ instrumenter Hyperdrive::Instrumenters::Memory.new
end
end
after do
hyperdrive.send(:reset!)
@@ -36,17 +39,34 @@
it "registers a resource" do
hyperdrive.resources[:thing].must_be_instance_of ::Hyperdrive::Resource
end
- it "can configure cors options" do
+ it "configures cors options" do
hyperdrive.config[:cors][:allow_headers].must_equal ['Accept']
end
it "ensures missing options have default values" do
hyperdrive.config[:cors][:credentials].must_equal 'false'
end
it "removes unsupported cors options" do
hyperdrive.config[:cors].key?(:test).must_equal false
+ end
+
+ it "configures the default per_page option" do
+ hyperdrive.config[:per_page].must_equal 20
+ end
+
+ it "configures ssl option" do
+ hyperdrive.config[:ssl].must_equal true
+ end
+
+ it "configures instrumenter option" do
+ hyperdrive.config[:instrumenter].must_be_instance_of Hyperdrive::Instrumenters::Memory
+ end
+
+ it "can call the instrumenter" do
+ hyperdrive.instrument('instrumentation', 'measurement') { |payload| payload + '1' }
+ hyperdrive.config[:instrumenter].events.size.must_be :>, 0
end
end