Sha256: 0d64b8db680f477d6b13cff58c76e437cc81e96443cdfc9ee661a92adba42644

Contents?: true

Size: 1.4 KB

Versions: 50

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Spud::SetupController do
  
  describe :index do
    it "should be successful" do
      get :index
      
      response.should be_success
    end
    
    it "should have a page thumbnail" do
      get :index
      
      assigns(:page_thumbnail).should_not be_blank
    end
    
    it "should have a page name" do
      get :index
      
      assigns(:page_name).should_not be_blank
    end
    
    it "should set a flash error message when a spud user exists" do
      SpudUser.stubs(:count).returns(1)
      get :index
      
      flash[:error].should_not be_blank
    end
    
    it "should redirect to the admin login form when there is already a user" do
      SpudUser.stubs(:count).returns(1)
      get :index
      
      response.should redirect_to(new_spud_user_session_url)
    end
    
    it "should create a new user" do
      lambda {
        post :index, FactoryGirl.attributes_for(:spud_user)
      }.should change(SpudUser, :count).by(1)
    end
    
    it "should redirect to the admin login form when first admin user has been created" do
      post :index, FactoryGirl.attributes_for(:spud_user)
      
      response.should redirect_to(new_spud_user_session_url)
    end
    
    it "should display an error if the user is invalid" do
      post :index, FactoryGirl.attributes_for(:spud_user, :email => nil)
      
      flash[:error].should_not be_blank
    end
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
spud_core-1.0.6 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.5 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.4 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.3 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.2 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.1 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.0 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.0.rc2 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.0.rc1.1 spec/controllers/spud/setup_controller_spec.rb
spud_core-1.0.0.rc1 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.22 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.21 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.20 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.19 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.18 spec/controllers/spud/setup_controller_spec.rb
tb_core-1.0 spec/controllers/spud/setup_controller_spec.rb
tb_core-0.9.19 spec/controllers/spud/setup_controller_spec.rb
tb_core-0.9.18 spec/controllers/spud/setup_controller_spec.rb
tb_core-0.9.17 spec/controllers/spud/setup_controller_spec.rb
spud_core-0.9.17 spec/controllers/spud/setup_controller_spec.rb