<commit_before>require 'spec_helper'

describe UsersController do

  # Create the first admin user
  before { create(:user) }

  describe 'POST create' do
    before do
      attributes = attributes_for(:user)
      @params = {
        :username         => attributes[:username],
        :email            => attributes[:email],
        :password         => '<PASSWORD>',
        :confirm_password => '<PASSWORD>',
        :realname         => attributes[:realname]
      }
    end

    describe '#index' do
      before do
        login
        @user = create(:user)
        get :index
      end

      it { should assign_to(:users) }
      it { should_not set_the_flash }
      it { should render_template(:index) }
    end

    describe '#index.json' do
      before do
        login
        @user = create(:user)
        get :index, :format => :json
        @json = JSON.parse(response.body)
      end

      it { should assign_to(:users) }
      it { should_not set_the_flash }

      it "renders JSON" do
        @json.should be_kind_of(Array)
      end
    end

    describe '#banned' do
      before do
        login
        @user = create(:user, :banned => true)
        get :banned
      end

      it { should assign_to(:users) }
      it { should_not set_the_flash }
      it { should render_template(:banned) }
    end

    describe '#banned.json' do
      before do
        login
        @user = create(:user, :banned => true)
        get :banned, :format => :json
        @json = JSON.parse(response.body)
      end

      it "renders JSON" do
        @json.should be_kind_of(Array)
      end
    end

    describe 'with a valid invite token' do
      before do
        @invite = create(:invite)
        post :create, :token => @invite.token, :user => @params
      end

      it { should assign_to(:invite) }
      it { should assign_to(:user) }

      it "redirects to the user profile" do
        response.should redirect_to(user_url(:id => assigns(:user).username))
      end
    end
  end
end<commit_msg>What happened to the UsersController spec?<commit_after>require 'spec_helper'

describe UsersController do

  # Create the first admin user
  before { create(:user) }

  describe '#index' do
    before do
      login
      @user = create(:user)
      get :index
    end

    it { should assign_to(:users) }
    it { should_not set_the_flash }
    it { should render_template(:index) }
  end

  describe '#index.json' do
    before do
      login
      @user = create(:user)
      get :index, :format => :json
      @json = JSON.parse(response.body)
    end

    it { should assign_to(:users) }
    it { should_not set_the_flash }

    it "renders JSON" do
      @json.should be_kind_of(Array)
    end
  end

  describe '#banned' do
    before do
      login
      @user = create(:user, :banned => true)
      get :banned
    end

    it { should assign_to(:users) }
    it { should_not set_the_flash }
    it { should render_template(:banned) }
  end

  describe '#banned.json' do
    before do
      login
      @user = create(:user, :banned => true)
      get :banned, :format => :json
      @json = JSON.parse(response.body)
    end

    it "renders JSON" do
      @json.should be_kind_of(Array)
    end
  end

  describe 'POST create' do
    before do
      attributes = attributes_for(:user)
      @params = {
        :username         => attributes[:username],
        :email            => attributes[:email],
        :password         => '<PASSWORD>',
        :confirm_password => '<PASSWORD>',
        :realname         => attributes[:realname]
      }
    end

    describe 'with a valid invite token' do
      before do
        @invite = create(:invite)
        post :create, :token => @invite.token, :user => @params
      end

      it { should assign_to(:invite) }
      it { should assign_to(:user) }

      it "redirects to the user profile" do
        response.should redirect_to(user_url(:id => assigns(:user).username))
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1060416144397092, 'fraction_numerical': 0.0, 'mean_word_length': 2.045801526717557, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '5438789', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1187, 'n_words': 340}