<commit_before>require "spec_helper"

module RubyEventStore
  RSpec.describe Browser do
    specify { expect(test_client.get("/")).to be_ok }
    specify { expect(test_client.post("/")).to be_not_found }
    specify { expect(test_client.get("/streams/all")).to be_ok }
    specify do
      event_store.append(DummyEvent.new(event_id: event_id))
      expect(test_client.get("/events/#{event_id}")).to be_ok
    end
    specify { expect(test_client.get("/").content_type).to eq("text/html;charset=utf-8") }

    let(:event_store) { RubyEventStore::Client.new(repository: RubyEventStore::InMemoryRepository.new) }
    let(:test_client) { TestClient.new(app_builder(event_store), "www.example.com") }
    let(:event_id) { SecureRandom.uuid }

    def app_builder(event_store)
      Rack::Lint.new(
        RubyEventStore::Browser::App.for(event_store_locator: -> { event_store })
      )
    end
  end
end<commit_msg>Weak-public but still some kind-of-public Browser API<commit_after>require "spec_helper"

module RubyEventStore
  RSpec.describe Browser do
    specify { expect(test_client.get("/")).to be_ok }

    specify { expect(test_client.post("/")).to be_not_found }

    specify { expect(test_client.get("/streams/all")).to be_ok }

    specify do
      event_store.append(DummyEvent.new(event_id: event_id))
      expect(test_client.get("/events/#{event_id}")).to be_ok
    end

    specify { expect(test_client.get("/").content_type).to eq("text/html;charset=utf-8") }

    specify { expect(Browser::App.for(event_store_locator: -> { event_store })).to be_a(Browser::App) }

    let(:event_store) { RubyEventStore::Client.new(repository: RubyEventStore::InMemoryRepository.new) }
    let(:test_client) { TestClient.new(app_builder(event_store), "www.example.com") }
    let(:event_id) { SecureRandom.uuid }

    def app_builder(event_store)
      Rack::Lint.new(RubyEventStore::Browser::App.for(event_store_locator: -> { event_store }))
    end
  end
end
{'fraction_non_alphanumeric': 0.14788373278939318, 'fraction_numerical': 0.0010198878123406426, 'mean_word_length': 4.404958677685951, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6635325', 'n_tokens_mistral': 674, 'n_tokens_neox': 665, 'n_words': 93}