Sha256: a0ced9e9e6ce73498ee69f2355a75ed3f558d086514efda9196fcb2faf1aee63

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

describe SocialAvatarProxy::Config do
  subject { SocialAvatarProxy::Config }
  
  after(:each) do
    subject.default_image = nil
  end

  describe "::default_image" do
    it "should default to nil" do
      expect(subject.default_image).to be_nil
    end

    it "should store a path" do
      subject.default_image = "/test.jpg"
      expect(subject.default_image).to eq "/test.jpg"
    end
  end
  
  describe "::default_image_content_type" do
    context "with a JPEG" do
      it "should return image/jpeg" do
        subject.default_image = "/test.JPG"
        expect(subject.default_image_content_type).to eq "image/jpeg"
      end
    end
    
    context "with a PNG" do
      it "should return image/png" do
        subject.default_image = "/test.png"
        expect(subject.default_image_content_type).to eq "image/png"
      end
    end
    
    context "with a GIF" do
      it "should return image/gif" do
        subject.default_image = "/test.gif"
        expect(subject.default_image_content_type).to eq "image/gif"
      end
    end
    
    context "with a SVG" do
      it "should return image/svg+xml" do
        subject.default_image = "/test.svg"
        expect(subject.default_image_content_type).to eq "image/svg+xml"
      end
    end
    
    context "with an unknown type" do
      it "should return application/octet-stream" do
        subject.default_image = "/test"
        expect(subject.default_image_content_type).to eq "application/octet-stream"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
social-avatar-proxy-1.2.0 spec/social_avatar_proxy/config_spec.rb