Sha256: 1ac3bf5e614da263b37f90ceac726f88b7c6e47fa9f805bb6ccc99284082244c

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

require "helper"

describe Picasa::File do
  it "raises argument error when nil path given" do
    assert_raises Picasa::ArgumentError do
      Picasa::File.new(nil)
    end
  end

  it "it returns file name" do
    file = Picasa::File.new(fixture_path("lena.jpg"))
    assert_equal "lena", file.name
  end

  it "it returns file extension" do
    file = Picasa::File.new(fixture_path("lena.jpg"))
    assert_equal "jpg", file.extension
  end

  it "it guesses content type" do
    file = Picasa::File.new(fixture_path("lena.jpg"))
    assert_equal "image/jpeg", file.content_type
  end

  it "it returns content type of video file" do
    file = Picasa::File.new(fixture_path("sample.3gp"))
    assert_equal "video/3gpp", file.content_type
  end

  it "returns binary read file" do
    file = Picasa::File.new(fixture_path("lena.jpg"))
    assert_equal String, file.binary.class
  end

  it "raises error when content type not known" do
    file = Picasa::File.new(fixture_path("sample.txt"))
    assert_raises(Picasa::UnknownContentType) do
      file.content_type
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
picasa-0.9.1 test/file_test.rb
picasa-0.9.0 test/file_test.rb
picasa-0.8.0 test/file_test.rb
picasa-0.7.5 test/file_test.rb
picasa-0.7.4 test/file_test.rb
picasa-0.7.3 test/file_test.rb
picasa-0.7.2 test/file_test.rb
picasa-0.7.1 test/file_test.rb
picasa-0.7.0 test/file_test.rb
picasa-0.6.7 test/file_test.rb
picasa-0.6.6 test/file_test.rb
picasa-0.6.5 test/file_test.rb
picasa-0.6.4 test/file_test.rb