spec/models/asset_spec.rb in kuhsaft-0.3.6 vs spec/models/asset_spec.rb in kuhsaft-1.0.0

- old
+ new

@@ -1,39 +1,41 @@ require 'spec_helper' describe Kuhsaft::Asset do + + let :asset do + create(:asset) + end + + let :uploader do + u = Kuhsaft::AssetUploader.new(asset, :file) + u.store!(File.open(File.join(Kuhsaft::Engine.root, 'spec', 'dummy', 'app', 'assets', 'images', 'spec-image.png'))) + u + end + before do Kuhsaft::AssetUploader.enable_processing = true - @asset = Factory(:asset) - @uploader = Kuhsaft::AssetUploader.new(@asset, :file) - @uploader.store!(File.open(File.join(Kuhsaft::Engine.root, 'spec', 'dummy', 'app', 'assets', 'images', 'spec-image.png'))) end - + after do Kuhsaft::AssetUploader.enable_processing = false end - - it 'should have a thumbnail' do - @uploader.should respond_to(:thumb) + + it 'has a thumbnail' do + uploader.should respond_to(:thumb) end - - it "should make the image readable only to the owner and not executable" do + + it "makes the image readable only to the owner and not executable" do pending 'how and where do we ensure permissions?' - @uploader.should have_permissions(0600) + uploader.should have_permissions(0600) end - + describe '#file_type' do - it 'should have a file_type' do - @asset.should respond_to(:file_type) + it 'has a file_type' do + asset.should respond_to(:file_type) end - - it 'should be symbolized' do - @asset.file_type.should be_a(Symbol) + + it 'is symbolized' do + asset.file_type.should be_a(Symbol) end end - - describe '#name' do - it 'should have a name' do - @asset.should respond_to(:name) - end - end -end \ No newline at end of file +end