<commit_before>require 'test_helper'
require __dir__ + '/../fixtures/bookshelf/config/environment'

describe "Lotus::View integration" do
  before do
    dest.rmtree if dest.exist?
    dest.mkpath
  end

  let(:dest) { TMP.join('bookshelf', 'public') }

  it "renders assets from the root path" do
    rendered = Web::Views::Books::Show.render(format: :html)
    rendered.must_include %(<script src="/assets/jquery.js" type="text/javascript"></script>)
    rendered.must_include %(<script src="/assets/application.js" type="text/javascript"></script>)

    dest.join('assets', 'jquery.js').must_be :exist?
    dest.join('assets', 'application.js').must_be :exist?
  end

  it "renders assets from a nested path" do
    rendered = Admin::Views::Users::Index.render(format: :html)
    rendered.must_include %(<script src="/assets/admin/zepto.js" type="text/javascript"></script>)
    rendered.must_include %(<script src="/assets/admin/application.js" type="text/javascript"></script>)
<commit_msg>Force right configuration before test<commit_after>require 'test_helper'
require __dir__ + '/../fixtures/bookshelf/config/environment'

describe "Lotus::View integration" do
  before do
    dest.rmtree if dest.exist?
    dest.mkpath

    frameworks = [Web::Assets, Admin::Assets]
    frameworks.each do |framework|
      framework.configure do
        digest false
      end
    end
  end

  let(:dest) { TMP.join('bookshelf', 'public') }

  it "renders assets from the root path" do
    rendered = Web::Views::Books::Show.render(format: :html)
    rendered.must_include %(<script src="/assets/jquery.js" type="text/javascript"></script>)
    rendered.must_include %(<script src="/assets/application.js" type="text/javascript"></script>)

    dest.join('assets', 'jquery.js').must_be :exist?
    dest.join('assets', 'application.js').must_be :exist?
  end

  it "renders assets from a nested path" do
    rendered = Admin::Views::Users::Index.render(format: :html)
    rendered.must_include %(<script src="/assets/admin/zepto.js" type="text/javascript"></script>)
    rendered.must_include %(<script src="/assets/admin/application.js" type="text/javascript"></script>)

{'fraction_non_alphanumeric': 0.1589648798521257, 'fraction_numerical': 0.0, 'mean_word_length': 4.481012658227848, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7294654', 'n_tokens_mistral': 676, 'n_tokens_neox': 650, 'n_words': 144}