<commit_before># -*- encoding : utf-8 -*-
require 'rails_helper'

describe UniformsController do

  setup(:activate_authlogic)

  context "an user logged in" do

    before(:each) do
      login
    end

    let(:uniform) { @station.uniforms.make! }

    describe "GET :index" do

      before(:each) do
        get :index
      end

      it { should respond_with(:success) }
      it { should render_template("index")  }
      it { should render_with_layout("back") }

      it { expect(assigns(:uniforms)).to_not be_nil}
    end

    describe "GET :show for a non existing uniform" do

      before(:each) do
        get :show, :id => -1
      end

      it { should respond_with(:redirect) }
      it { should redirect_to(uniforms_path) }

      it { should set_the_flash.level(:error) }
    end

    describe "GET :new" do

      before(:each) do
        get :new
      end

      it { should respond_with(:success) }
      it { should render_template("new") }
      it { should render_with_layout("back") }
    end

    describe "POST :create with bad data" do

      before(:each) do
        post :create, :uniform => {:title => '', :code => '2b', :description => 'test'}
      end

      it { should respond_with(:success) }
      it { should render_template("new") }
      it { should render_with_layout("back") }
    end

    describe "POST :create with good data" do

      before(:each) do
        post :create, :uniform => plan(Uniform.make)
      end

      it { should respond_with(:redirect) }
      it { should redirect_to(uniform_path(assigns(:uniform))) }

      it { expect(assigns(:uniform)).to_not be_nil}
      it { should set_the_flash.level(:success) }
    end
<commit_msg>Move uniforms controller spec to factory_girl.<commit_after># -*- encoding : utf-8 -*-
require 'rails_helper'

describe UniformsController do

  setup(:activate_authlogic)

  context "an user logged in" do

    before(:each) do
      login
    end

    let(:uniform) { create(:uniform, :station => @station) }

    describe "GET :index" do

      before(:each) do
        get :index
      end

      it { should respond_with(:success) }
      it { should render_template("index")  }
      it { should render_with_layout("back") }

      it { expect(assigns(:uniforms)).to_not be_nil}
    end

    describe "GET :show for a non existing uniform" do

      before(:each) do
        get :show, :id => -1
      end

      it { should respond_with(:redirect) }
      it { should redirect_to(uniforms_path) }

      it { should set_the_flash.level(:error) }
    end

    describe "GET :new" do

      before(:each) do
        get :new
      end

      it { should respond_with(:success) }
      it { should render_template("new") }
      it { should render_with_layout("back") }
    end

    describe "POST :create with bad data" do

      before(:each) do
        post :create, :uniform => {:title => '', :code => '2b', :description => 'test'}
      end

      it { should respond_with(:success) }
      it { should render_template("new") }
      it { should render_with_layout("back") }
    end

    describe "POST :create with good data" do

      before(:each) do
        post :create, :uniform => attributes_for(:uniform)
      end

      it { should respond_with(:redirect) }
      it { should redirect_to(uniform_path(assigns(:uniform))) }

      it { expect(assigns(:uniform)).to_not be_nil}
      it { should set_the_flash.level(:success) }
    end

{'fraction_non_alphanumeric': 0.1191304347826087, 'fraction_numerical': 0.0017391304347826088, 'mean_word_length': 2.5106815869786367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '2130536', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1017, 'n_words': 293}