Sha256: 498dc4288973ce87b5f779dabc02d1c9a54afe5aa4ad4d6c71ec02bae4bb7b7e

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

require 'rails_helper'
require 'byebug'

RSpec.describe KepplerFrontend::Editor::FileFormat, type: :services do

  context 'File Format' do
    let(:root) { KepplerFrontend::Urls::Roots.new }
    let(:fixture) { "#{root.keppler_root}/spec/fixtures/keppler_frontend/editor" }
    let(:html) { "#{root.rocket_root}/app/assets/html/keppler_frontend/views" }

    before(:each) do
      FileUtils.mv("#{fixture}/test.png", "#{html}/test.png")
      FileUtils.mv("#{fixture}/test.html", "#{html}/test.html")
      @file_format = KepplerFrontend::Editor::FileFormat.new
      @formats = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.tiff', '.bmp', '.mp3',
                  '.eot', '.otf', '.ttf', '.woff', '.woff2', '.mp4', '.mpeg', '.webm', '.m4v',
                  '.html', '.js', '.coffee', '.json', '.css', '.scss', 'sass'
                 ]
    end

    context 'validate file by format' do
      it 'test formats' do
        @formats.each do |f|
          expect(@file_format.validate("test.#{f}")).to eq(true)
        end
        expect(@file_format.validate("test.xyz")).to eq(false)
      end
    end

    after(:each) do
      FileUtils.mv("#{html}/test.png", "#{fixture}/test.png")
      FileUtils.mv("#{html}/test.html", "#{fixture}/test.html")
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
keppler-2.1.18 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.17 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.16 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.15 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.14 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.13 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.12 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.11 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.10 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.9 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.8 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb
keppler-2.1.7 installer/core/spec/services/keppler_frontend/editor/file_format_spec.rb