Sha256: 54d6fbeee806b23297663445aa98533e0fa3fa3bc6540c6720192c80f3faff72

Contents?: true

Size: 921 Bytes

Versions: 12

Compression:

Stored size: 921 Bytes

Contents

require 'rails_helper'
require 'byebug'

RSpec.describe KepplerFrontend::Utils::CodeSearch, type: :services do

  context 'code search' do

    before(:all) do
      urls = KepplerFrontend::Urls::Roots.new
      component = Dir["#{urls.rocket_root}/app/views/layouts/keppler_frontend/app/layouts/application.html.erb"].first
      lines = File.readlines(component)
      @find = KepplerFrontend::Utils::CodeSearch.new(lines)
    end

    context 'find between a range of lines' do
      let(:find_section) { @find.search_section('    <keppler-header>', '    </keppler-header>') }

      it { expect(find_section).to be_a(Array) }
      it { expect(find_section.count).to eq(2) }
      it { expect(find_section[0]).to be < (find_section[1]) }
    end

    context 'find a lines' do
      let(:find_section) { @find.search_line('    <keppler-header>') }

      it { expect(find_section).to be_a(Numeric) }
    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/utils/code_search_spec.rb
keppler-2.1.17 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.16 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.15 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.14 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.13 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.12 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.11 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.10 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.9 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.8 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb
keppler-2.1.7 installer/core/spec/services/keppler_frontend/utils/code_search_spec.rb