<commit_before>require 'spec_helper'

describe 'dummy app' do
  context 'when only yaml file is available' do
    it 'responds with app name' do
      visit '/name'
      page.should have_content('Dummy app test')
    end
  end

  context 'when configuration server is available' do
    let(:json_config) { {"dummy" => {"name" => "super app", "version" => 5}}}
    let(:stubs) {
      Faraday::Adapter::Test::Stubs.new do |stub|
        stub.get('/config/test.json') { [200, {}, json_config] }
      end
    }

    it 'fetches config from server but overrides it with local config' do
      conn = Faraday.new('http://test.host') do |conn|
        conn.adapter :test, stubs
      end

      config = Merlin::Configuration.new(File.join(Rails.root, 'config', 'merlin.yml'),<commit_msg>Fix tests<commit_after>require 'spec_helper'

describe 'dummy app' do
  context 'when only yaml file is available' do
    it 'responds with app name' do
      visit '/name'
      page.should have_content('Dummy app test')
    end
  end

  context 'when configuration server is available' do
    let(:json_config) { {"dummy" => {"name" => "super app", "version" => 5}}}
    let(:stubs) {
      Faraday::Adapter::Test::Stubs.new do |stub|
        stub.get('/config/test.json') { [200, {}, json_config] }
      end
    }

    it 'fetches config from server but overrides it with local config' do
      conn = Faraday.new('http://localhost') do |conn|
        conn.adapter :test, stubs
      end

      config = Merlin::Configuration.new(File.join(Rails.root, 'config', 'merlin.yml'),
{'fraction_non_alphanumeric': 0.1387468030690537, 'fraction_numerical': 0.005115089514066497, 'mean_word_length': 3.064935064935065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4717416', 'n_tokens_mistral': 506, 'n_tokens_neox': 485, 'n_words': 148}