<commit_before>require 'spec_helper'

describe RegistrationsController do

  before do
    request.env['devise.mapping'] = Devise.mappings[:user]
  end

  describe "#create" do
    specify do
      post :create, :user => {:name => 'Test User', :initials => 'TU', :email => '<EMAIL>'}
      response.should redirect_to(new_user_session_path)
    end
    specify do
      post :create, :user => {:name => 'Test User', :initials => 'TU', :email => '<EMAIL>'}
      flash[:notice].should == 'You have signed up successfully. A confirmation was sent to your e-mail. Please follow the contained instructions to activate your account.'
    end
  end

end<commit_msg>Add a couple of controller specs for disabled user registration.<commit_after>require 'spec_helper'

describe RegistrationsController do

  before do
    request.env['devise.mapping'] = Devise.mappings[:user]
  end

  describe "disable registration" do
    before do
      Configuration.for('fulcrum') do
        disable_registration true
      end
    end

    describe "#new" do
      specify do
        get :new
        response.status.should eq 404
      end
    end

    describe "#create" do
      specify do
        post :create, :user => {:name => 'Test User', :initials => 'TU', :email => '<EMAIL>'}
        response.status.should eq 404
      end
    end
  end

  describe "enable registration" do
    before do
      Configuration.for('fulcrum') do
        disable_registration false
      end
    end

    describe "#new" do
      specify do
        get :new
        response.status.should eq 200
      end
    end

    describe "#create" do
      specify do
        post :create, :user => {:name => 'Test User', :initials => 'TU', :email => '<EMAIL>'}
        response.should redirect_to(new_user_session_path)
      end
      specify do
        post :create, :user => {:name => 'Test User', :initials => 'TU', :email => '<EMAIL>'}
        flash[:notice].should == 'You have signed up successfully. A confirmation was sent to your e-mail. Please follow the contained instructions to activate your account.'
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.10915994304698623, 'fraction_numerical': 0.004271476032273375, 'mean_word_length': 2.711267605633803, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 28, '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': '3948332', 'n_tokens_mistral': 618, 'n_tokens_neox': 590, 'n_words': 208}