Sha256: d11258a4e3eba14e9546eb7b62bc1eff3741d99a12092b4a936ed4fd578539c3

Contents?: true

Size: 1.65 KB

Versions: 12

Compression:

Stored size: 1.65 KB

Contents

require 'rails_helper'
require 'byebug'

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

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

    before(:each) do
      @resources = KepplerFrontend::Editor::Resources.new
      FileUtils.mv("#{fixture}/test.png", "#{images}/test.png")
      FileUtils.mv("#{fixture}/test.html", "#{html}/test.html")
    end

    context 'output with app container' do
      before(:each) do
        @resources = KepplerFrontend::Editor::ResourcesFormat.new(@resources.list.last[:name], 'app')
      end

      it { expect(@resources.output).to be_a(Hash) }
      it { expect(@resources.output.count).to eq(11) }
      it { expect(@resources.output[:name]).to eq("test.png") }
      it { expect(@resources.output[:format]).to eq("png") }
    end

    context 'output with view container' do
      before(:each) do
        @resources = KepplerFrontend::Editor::ResourcesFormat.new(@resources.custom_list('views').last[:name], 'views')
      end

      it { expect(@resources.output).to be_a(Hash) }
      it { expect(@resources.output.count).to eq(11) }
      it { expect(@resources.output[:name]).to eq("test.html") }
      it { expect(@resources.output[:format]).to eq("html") }
    end

    after(:each) do
      FileUtils.mv("#{images}/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/resources_format_spec.rb
keppler-2.1.17 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.16 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.15 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.14 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.13 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.12 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.11 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.10 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.9 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.8 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb
keppler-2.1.7 installer/core/spec/services/keppler_frontend/editor/resources_format_spec.rb