<commit_before>require 'rails_helper'

describe ScenarioLoader do
  describe "with test1.yml", :focus do
    before :all do
      @user = create(:instructor)
      @scenario = ScenarioLoader.new(name: "test1", location: :test, user: @user).fire!
    end

    it "creates a valid scenario" do
      expect(@scenario).to_not be_nil
      expect(@scenario).to be_valid
    end

    describe "roles" do
      let(:roles) { @scenario.roles }

      it("creates one") { expect(roles.count).to eq(1) }
      it("is valid") { expect(roles.first).to be_valid }
      it("sets name") { expect(roles.first.name).to eq("NAT") }
      it("adds two packages to it") { expect(roles.first.packages.count).to eq(2) }
      it("creates two recipes for it") { expect(roles.first.recipes.count).to eq(2) }
    end

    describe "clouds" do
      let(:clouds) { @scenario.clouds }

      it("creates one") { expect(clouds.count).to eq(1) }<commit_msg>Write test to load every production scenario<commit_after>require 'rails_helper'

describe ScenarioLoader do
  describe "production scenarios" do
    let(:user) { create(:instructor) }

    YmlRecord.yml_headers('production', nil).each do |scenario|
      it "loads #{scenario[:name]}" do
        expect(
          ScenarioLoader.new(name: scenario[:name], location: :production, user: user).fire!
        ).to be_valid
      end
    end
  end

  describe "with test1.yml", :focus do
    before :all do
      @user = create(:instructor)
      @scenario = ScenarioLoader.new(name: "test1", location: :test, user: @user).fire!
    end

    it "creates a valid scenario" do
      expect(@scenario).to_not be_nil
      expect(@scenario).to be_valid
    end

    describe "roles" do
      let(:roles) { @scenario.roles }

      it("creates one") { expect(roles.count).to eq(1) }
      it("is valid") { expect(roles.first).to be_valid }
      it("sets name") { expect(roles.first.name).to eq("NAT") }
      it("adds two packages to it") { expect(roles.first.packages.count).to eq(2) }
      it("creates two recipes for it") { expect(roles.first.recipes.count).to eq(2) }
    end

    describe "clouds" do
      let(:clouds) { @scenario.clouds }

      it("creates one") { expect(clouds.count).to eq(1) }
{'fraction_non_alphanumeric': 0.14279299506061965, 'fraction_numerical': 0.005388414907947912, 'mean_word_length': 3.0955882352941178, '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': '7036880', 'n_tokens_mistral': 759, 'n_tokens_neox': 738, 'n_words': 182}