Sha256: e7bd3a8f83b8a1c9389808b4c9d687e83a49a686d26b394d00b6afded8a472f5

Contents?: true

Size: 878 Bytes

Versions: 10

Compression:

Stored size: 878 Bytes

Contents

require 'rails_helper'

describe Admin::SetupController, :type => :controller do
  
  describe 'new' do
    it "should be successful" do
      get :new
      
      expect(response).to be_success
    end
    
    it "should redirect to the admin login form when there is already a user" do
      allow(SpudUser).to receive(:count).and_return(1)
      get :new
      
      expect(response).to redirect_to(admin_login_path)
    end
  end

  describe 'create' do
    it "should create a new user" do
      expect{
        post :create, :spud_user => FactoryGirl.attributes_for(:spud_user)
      }.to change(SpudUser, :count).by(1)
    end
    
    it "should redirect to the admin dashboard when first admin user has been created" do
      post :create, :spud_user => FactoryGirl.attributes_for(:spud_user)
      expect(response).to redirect_to(admin_root_path)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tb_core-1.3.10 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.9 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.7 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.6 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.5 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.4 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.3 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.2 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.1 spec/controllers/admin/setup_controller_spec.rb
tb_core-1.3.0 spec/controllers/admin/setup_controller_spec.rb