Sha256: d8066bde017d5b2fed8e25445dfc44257a85f111edc0722fe5be3a41c7f83610
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' describe Alephant::Broker::Request do describe "#initialize(path, querystring)" do let(:component_id) { 'foo' } let(:querystring) { 'variant=test' } it "Sets the component id" do instance = Alephant::Broker::Request.new("/component/#{component_id}", '') expect(instance.component_id).to eq(component_id) end it "Sets the request type to asset" do instance = Alephant::Broker::Request.new("/component/#{component_id}", '') expect(instance.type).to eq(:asset) expect(instance.options).to eq({}) end it "Sets the request type to asset with parsed options" do instance = Alephant::Broker::Request.new("/component/#{component_id}", querystring) expect(instance.type).to eq(:asset) expect(instance.options).to eq({ :variant => 'test' }) end it "Sets the request type to status" do instance = Alephant::Broker::Request.new("/status", '') expect(instance.type).to eq(:status) end it "Sets the default extension" do instance = Alephant::Broker::Request.new("/component/blah", '') expect(instance.extension).to eq(:html) end it "Sets the extension from the path" do instance = Alephant::Broker::Request.new("/component/blah.json", '') expect(instance.extension).to eq(:json) end it "Sets the content type to default if the extension does not exist" do instance = Alephant::Broker::Request.new("/component/blah.test", '') expect(instance.content_type).to eq('text/html') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-0.0.3 | spec/request_spec.rb |