Sha256: b837ae6e8a01832b60a3b96d6c6721649d26f0c3b737c799ade10fe4c21c2aaf

Contents?: true

Size: 1.21 KB

Versions: 19

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Alchemy::Picture do

	describe '#suffix' do

		it "should return the suffix of original filename" do
			pic = stub_model(Alchemy::Picture, :image_filename => 'kitten.JPG')
			pic.suffix.should == "jpg"
		end

		context "image has no suffix" do

			before(:each) do
				@pic = stub_model(Alchemy::Picture, :image_filename => 'kitten')
			end

			it "should return empty string" do
				@pic.suffix.should == ""
			end

		end

	end

	describe '#humanized_name' do

		it "should return a humanized version of original filename" do
			pic = stub_model(Alchemy::Picture, :image_filename => 'cute_kitten.JPG')
			pic.humanized_name.should == "Cute kitten"
		end

		it "should not remove incidents of suffix from filename" do
			pic = stub_model(Alchemy::Picture, :image_filename => 'cute_kitten_mo.jpgi.JPG')
			pic.humanized_name.should == "Cute kitten mo.jpgi"
			pic.humanized_name.should_not == "Cute kitten moi"
		end

		context "image has no suffix" do

			before(:each) do
				@pic = stub_model(Alchemy::Picture, :image_filename => 'cute_kitten')
				@pic.stub!(:suffix).and_return("")
			end

			it "should return humanized name" do
				@pic.humanized_name.should == "Cute kitten"
			end

		end

	end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
alchemy_cms-2.1.12 spec/models/picture_spec.rb
alchemy_cms-2.1.11 spec/models/picture_spec.rb
alchemy_cms-2.1.9.1 spec/models/picture_spec.rb
alchemy_cms-2.1.9 spec/models/picture_spec.rb
alchemy_cms-2.1.8.1 spec/models/picture_spec.rb
alchemy_cms-2.1.8 spec/models/picture_spec.rb
alchemy_cms-2.1.7 spec/models/picture_spec.rb
alchemy_cms-2.1.6 spec/models/picture_spec.rb
alchemy_cms-2.1.5 spec/models/picture_spec.rb
alchemy_cms-2.1.4 spec/models/picture_spec.rb
alchemy_cms-2.1.3 spec/models/picture_spec.rb
alchemy_cms-2.1.2 spec/models/picture_spec.rb
alchemy_cms-2.1.1 spec/models/picture_spec.rb
alchemy_cms-2.1 spec/models/picture_spec.rb
alchemy_cms-2.1.rc6 spec/models/picture_spec.rb
alchemy_cms-2.1.rc5 spec/models/picture_spec.rb
alchemy_cms-2.1.rc4 spec/models/picture_spec.rb
alchemy_cms-2.1.rc3 spec/models/picture_spec.rb
alchemy_cms-2.1.rc2 spec/models/picture_spec.rb