<commit_before>require 'helper'
require 'rails'
require 'flipper/cloud'

RSpec.describe Flipper::Cloud::Engine do
  let(:env) do
    { "FLIPPER_CLOUD_TOKEN" => "<PASSWORD>" }
  end

  let(:application) do
    Class.new(Rails::Application) do
      config.eager_load = false
      config.logger = ActiveSupport::Logger.new($stdout)
    end
  end

  before do
    Rails.application = nil

    # Force loading of flipper to configure itself
    load 'flipper/adapters/cloud.rb'
  end

  it "initializes cloud configuration" do
    stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")

    with_modified_env env do
      application.initialize!

      expect(Flipper.instance).to be_a(Flipper::Cloud::DSL)
      expect(Flipper.instance.instrumenter).to be(ActiveSupport::Notifications)
    end
  end<commit_msg>Fix flipper cloud load specs<commit_after>require 'helper'
require 'rails'
require 'flipper/cloud'

RSpec.describe Flipper::Cloud::Engine do
  let(:env) do
    { "FLIPPER_CLOUD_TOKEN" => "<PASSWORD>" }
  end

  let(:application) do
    Class.new(Rails::Application) do
      config.eager_load = false
      config.logger = ActiveSupport::Logger.new($stdout)
    end
  end

  before do
    Rails.application = nil

    # Force loading of flipper to configure itself
    load 'flipper/cloud.rb'
  end

  it "initializes cloud configuration" do
    stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")

    with_modified_env env do
      application.initialize!

      expect(Flipper.instance).to be_a(Flipper::Cloud::DSL)
      expect(Flipper.instance.instrumenter).to be(ActiveSupport::Notifications)
    end
  end
{'fraction_non_alphanumeric': 0.11371841155234658, 'fraction_numerical': 0.0036101083032490976, 'mean_word_length': 3.7244318181818183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3810408', 'n_tokens_mistral': 551, 'n_tokens_neox': 544, 'n_words': 117}