<commit_before>require 'rails_helper'

RSpec.describe FileController, type: :controller do
    render_views
    describe "GET #download_approved_teams" do
        before do
            @disc = Discussion.create!(:number => 1337, :time=> "Wed, 3pm", :capacity => 5)
            people = [
              { :name => "John"                   ,:major => "English"  , :sid => "111"  ,:email => "<EMAIL>",:password => "<PASSWORD>"        },
              { :name =>  "Josh"                   ,:major => "CS"  ,:sid => "222"  ,:email => "<EMAIL>", :password => "<PASSWORD>"         },
              { :name =>  "Jorge"                   ,:major => "English"  ,:sid => "333"  ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "CCC"                   ,:major => "EECS"  ,:sid => "444"  ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "DDD"                   ,:major => "English"  ,:sid => "555"  ,:email => "<EMAIL>",:password =>"<PASSWORD>"         },
              { :name =>  "EEE"                   , :major =>"English"  ,:sid => "666"  ,:email => "<EMAIL>" ,:password =>  "<PASSWORD>"        },
              { :name => "FFF"                   ,:major => "EECS"  ,:sid => "777" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name => "GGG"                   ,:major => "CS"  ,:sid => "888" ,:email => "<EMAIL>",:password => "<PASSWORD>2"         },
              { :name =>  "HHH"                   ,:major => "English"  ,:sid => "999" ,:email =>"<EMAIL>" ,:password => "<PASSWORD>"        },
              { :name =>  "III"                   ,:major => "English"  ,:sid => "1111" ,:email => "<EMAIL>"     ,:password => "<PASSWORD>"    },
              { :name =>  "JJJ"                   ,:major => "English"  ,:sid => "2222" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "Kay"                   ,:major => "EECS"  ,:sid => "3333" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "Ana"                   ,:major => "CS"  ,:sid => "4444" ,:email => "<EMAIL>" ,:password =>"<PASSWORD>"        },
              { :name =>  "Chris"                   ,:major => "CS"  ,:sid => "44444" ,:email => "<EMAIL>" ,:password =>"<PASSWORD>"        }
            ]
            
            people.each do |ue|
                User.create!(ue)
            end
        
            @tone = Team.new
            @tone.approve_with_discussion(@disc.id)
            @tone.passcode = "<PASSWORD>"
            @disc.teams << @tone
            @tone.save!
            @tone.users << User.where(name: "Josh")
            @tone.users << User.where(name: "CCC")
            @tone.users << User.where(name: "GGG")
            @tone.users << User.where(name: "FFF")
            @tone.users << User.where(name: "EEE")
            
            
            @ttwo = Team.new
            @ttwo.approved = false
            @ttwo.submitted = true
            @ttwo.passcode = "<PASSWORD>"
            @ttwo.save!
            @ttwo.users << User.where(name: "JJJ")
            @ttwo.users << User.where(name: "DDD")
            @ttwo.users << User.where(name: "III")
            @ttwo.users << User.where(name: "Kay")
            @ttwo.users << User.where(name: "Ana")
            
            @three = Team.new
            @three.passcode = "<PASSWORD>"
            @three.users << User.where(name: "Chris")
            
            
            get :download_approved_teams
        end
    
        it "shows all approved teams" do
            expect(response.body).to include("Josh")
            expect(response.body).to include("GGG")
            expect(response.body).to include("EEE")
        end
        
        it "does not show submitted teams" do
            expect(response.body).not_to include("JJJ")
            expect(response.body).not_to include("III")
            expect(response.body).not_to include("Ana")
        end
        
        it "does not show invalid teams" do
            expect(response.body).not_to include("Chris")
        end
    end
end
<commit_msg>all tests passing for before filters<commit_after>require 'rails_helper'

RSpec.describe FileController, type: :controller do
    render_views
    describe "GET #download_approved_teams" do
        before do
            @disc = Discussion.create!(:number => 1337, :time=> "Wed, 3pm", :capacity => 5)
            people = [
              { :name => "John"                   ,:major => "English"  , :sid => "111"  ,:email => "<EMAIL>",:password => "<PASSWORD>"        },
              { :name =>  "Josh"                   ,:major => "CS"  ,:sid => "222"  ,:email => "<EMAIL>", :password => "<PASSWORD>"         },
              { :name =>  "Jorge"                   ,:major => "English"  ,:sid => "333"  ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "CCC"                   ,:major => "EECS"  ,:sid => "444"  ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "DDD"                   ,:major => "English"  ,:sid => "555"  ,:email => "<EMAIL>",:password =>"<PASSWORD>"         },
              { :name =>  "EEE"                   , :major =>"English"  ,:sid => "666"  ,:email => "<EMAIL>" ,:password =>  "<PASSWORD>"        },
              { :name => "FFF"                   ,:major => "EECS"  ,:sid => "777" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name => "GGG"                   ,:major => "CS"  ,:sid => "888" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "HHH"                   ,:major => "English"  ,:sid => "999" ,:email =>"<EMAIL>" ,:password => "<PASSWORD>"        },
              { :name =>  "III"                   ,:major => "English"  ,:sid => "1111" ,:email => "<EMAIL>"     ,:password => "<PASSWORD>"    },
              { :name =>  "JJJ"                   ,:major => "English"  ,:sid => "2222" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "Kay"                   ,:major => "EECS"  ,:sid => "3333" ,:email => "<EMAIL>",:password => "<PASSWORD>"         },
              { :name =>  "Ana"                   ,:major => "CS"  ,:sid => "4444" ,:email => "<EMAIL>" ,:password =>"<PASSWORD>"        },
              { :name =>  "Chris"                   ,:major => "CS"  ,:sid => "44444" ,:email => "<EMAIL>" ,:password =>"<PASSWORD>"        }
            ]
            
            people.each do |ue|
                User.create!(ue)
            end
            
            Admin.create!({:name => "admin", :email => "<EMAIL>", :password => "<PASSWORD>"})
        
            @tone = Team.new
            @tone.approve_with_discussion(@disc.id)
            @tone.passcode = "<PASSWORD>"
            @disc.teams << @tone
            @tone.save!
            @tone.users << User.where(name: "Josh")
            @tone.users << User.where(name: "CCC")
            @tone.users << User.where(name: "GGG")
            @tone.users << User.where(name: "FFF")
            @tone.users << User.where(name: "EEE")
            
            
            @ttwo = Team.new
            @ttwo.approved = false
            @ttwo.submitted = true
            @ttwo.passcode = "<PASSWORD>"
            @ttwo.save!
            @ttwo.users << User.where(name: "JJJ")
            @ttwo.users << User.where(name: "DDD")
            @ttwo.users << User.where(name: "III")
            @ttwo.users << User.where(name: "Kay")
            @ttwo.users << User.where(name: "Ana")
            
            @three = Team.new
            @three.passcode = "<PASSWORD>"
            @three.users << User.where(name: "Chris")
            
            session[:user_id] = 1
            session[:is_admin] = true
            
            
            get :download_approved_teams
        end
    
        it "shows all approved teams" do
            expect(response.body).to include("Josh")
            expect(response.body).to include("GGG")
            expect(response.body).to include("EEE")
        end
        
        it "does not show submitted teams" do
            expect(response.body).not_to include("JJJ")
            expect(response.body).not_to include("III")
            expect(response.body).not_to include("Ana")
        end
        
        it "does not show invalid teams" do
            expect(response.body).not_to include("Chris")
        end
    end
end

{'fraction_non_alphanumeric': 0.18667140151515152, 'fraction_numerical': 0.013020833333333334, 'mean_word_length': 1.495274660366214, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 216, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5923919', 'n_tokens_mistral': 2687, 'n_tokens_neox': 2517, 'n_words': 527}