Sha256: dc58964bef41bdedc5e2f6cee3c88f0f4020dcd58c86608e7e9112cca87d05e9

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

require 'rails_helper'

describe Admin::SettingsController, :type => :controller do
  before(:each) do
    activate_session(admin: true)
  end
  
  describe 'edit' do
    it "should respond with success" do
      get :edit
      expect(response).to be_success
    end
  end
  
  describe 'update' do
    it "should give an error if password change does not include a valid current password" do
      u = FactoryGirl.build(:spud_user)
      u.password = "test"
      put :update, :spud_user => {:first_name => "Mike", :password => "Imapassword", :current_password => "ImaTest"}
      is_expected.to respond_with 401
    end

    it "should redirect to the settings page with a successful update" do
      put :update, :spud_user => {:first_name => "Mike"}
      expect(response).to redirect_to(admin_settings_path)
    end
    
    it "should put a message in the flash notice" do
      put :update, :spud_user => {:first_name => "Mike"}
      expect(flash[:notice]).to_not be_blank
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tb_core-1.3.10 spec/controllers/admin/settings_controller_spec.rb
tb_core-1.3.9 spec/controllers/admin/settings_controller_spec.rb
tb_core-1.3.7 spec/controllers/admin/settings_controller_spec.rb
tb_core-1.3.6 spec/controllers/admin/settings_controller_spec.rb