Sha256: 18f4d6ec9d42f69af0eb5e9149f25b58cd7e3c84a9cb55fe2c8e314a83365efe

Contents?: true

Size: 685 Bytes

Versions: 45

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'
require 'classiccms/application'
require 'classiccms/cli'

describe 'Image' do
  def app
    Classiccms.boot
    Classiccms::WebsiteController
  end
  before :all do
    clear_tmp
    discard { Classiccms::Cli.command ['new', 'app'] }
    Dir.chdir 'app'
    app
  end

  it 'should upload an image' do
    image = Image.new
    image.file = File.open(File.join(File.dirname(__FILE__),'/../../spec/assets/cat.jpg'))
    image.save
    image.file.size.should == 34503
  end
  it 'should only accept images' do
    image = Image.new
    image.file = File.open(File.join(File.dirname(__FILE__),'/../../spec/assets/cat.txt'))
    image.save.should == false
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
classiccms-0.7.5 spec/models/image_spec.rb
classiccms-0.7.4 spec/models/image_spec.rb
classiccms-0.7.3 spec/models/image_spec.rb
classiccms-0.7.2 spec/models/image_spec.rb
classiccms-0.7.1 spec/models/image_spec.rb
classiccms-0.7.0 spec/models/image_spec.rb
classiccms-0.6.9 spec/models/image_spec.rb
classiccms-0.6.8 spec/models/image_spec.rb
classiccms-0.6.7 spec/models/image_spec.rb
classiccms-0.6.6 spec/models/image_spec.rb
classiccms-0.6.5 spec/models/image_spec.rb
classiccms-0.6.4 spec/models/image_spec.rb
classiccms-0.6.3 spec/models/image_spec.rb
classiccms-0.6.2 spec/models/image_spec.rb
classiccms-0.6.1 spec/models/image_spec.rb
classiccms-0.6.0 spec/models/image_spec.rb
classiccms-0.5.17 spec/models/image_spec.rb
classiccms-0.5.16 spec/models/image_spec.rb
classiccms-0.5.15 spec/models/image_spec.rb
classiccms-0.5.14 spec/models/image_spec.rb