<commit_before>describe 'omnibus-supermarket::rails' do
  let(:chef_run) do
    ChefSpec::SoloRunner.new do |node|
      node.automatic['memory']['total'] = '16000MB'
    end.converge(described_recipe)
  end

  describe 'rails app nginx site' do
    let(:rails_site_config) { '/var/opt/supermarket/nginx/etc/sites-enabled/rails' }

    it 'renders the site template' do
      expect(chef_run).to create_template(rails_site_config)
    end

    describe 'with no ssl' do
      let(:chef_run) do
        ChefSpec::SoloRunner.new do |node|
          node.automatic['memory']['total'] = '16000MB'
          node.automatic['supermarket']['ssl']['enabled'] = false
          node.automatic['supermarket']['nginx']['force_ssl'] = false
        end.converge(described_recipe)
      end

      it 'does not include an SSL service' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).not_to include('listen 443')
        }
      end

      it 'does not set X-Forwarded-Proto header to "https"' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).not_to include('X-Forwarded-Proto https')<commit_msg>Add positive tests of inclusion<commit_after>describe 'omnibus-supermarket::rails' do
  let(:chef_run) do
    ChefSpec::SoloRunner.new do |node|
      node.automatic['memory']['total'] = '16000MB'
    end.converge(described_recipe)
  end

  describe 'rails app nginx site' do
    let(:rails_site_config) { '/var/opt/supermarket/nginx/etc/sites-enabled/rails' }

    it 'renders the site template' do
      expect(chef_run).to create_template(rails_site_config)
    end

    describe 'with ssl' do
      it 'listens on default non_ssl_port' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).to include('listen 80')
        }
      end

      it 'listens on default ssl_port' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).to include('listen 443')
        }
      end

      it 'sets X-Forwarded-Proto header to "https"' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).to include('X-Forwarded-Proto https')
        }
      end
    end

    describe 'with no ssl' do
      let(:chef_run) do
        ChefSpec::SoloRunner.new do |node|
          node.automatic['memory']['total'] = '16000MB'
          node.automatic['supermarket']['ssl']['enabled'] = false
          node.automatic['supermarket']['nginx']['force_ssl'] = false
        end.converge(described_recipe)
      end

      it 'listens on default non_ssl_port' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).to include('listen 80')
        }
      end

      it 'does not listen on ssl_port' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).not_to include('listen 443')
        }
      end

      it 'sets X-Forwarded-Proto header to "http"' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).to include('X-Forwarded-Proto http')
        }
      end

      it 'does not set X-Forwarded-Proto header to "https"' do
        expect(chef_run).to render_file(rails_site_config).with_content { |content|
          expect(content).not_to include('X-Forwarded-Proto https')
{'fraction_non_alphanumeric': 0.11686096104634631, 'fraction_numerical': 0.009382996872334376, 'mean_word_length': 3.0344036697247705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3136009', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1085, 'n_words': 228}