Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Commit

Permalink
Upgrade to devise 4.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
levent committed Oct 8, 2016
1 parent 88347a7 commit 82e0799
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ def ensure_domain
end

def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :name
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
end
end
11 changes: 8 additions & 3 deletions spec/models/person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
@it = Person.new
end

it { should validate_uniqueness_of :email }
it { should validate_presence_of :name }
it { should validate_presence_of :email }
it { should have_many :projects }
it { should have_many :user_stories }

describe 'admin?' do
it "should validate_uniqueness_of :email" do
p1 = create_person
p2 = Person.new(email: p1.email).tap(&:valid?)
expect(p2.errors[:email]).to include("has already been taken")
end

describe "admin?" do
let(:user) { Person.new }

it "should be true if it's levent" do
user.email = ENV['admin_email']
user.email = ENV["admin_email"]
expect(user.admin?).to be_truthy
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# https://relishapp.com/rspec/rspec-rails/docs
Capybara.default_host = "http://app.agileista.local"
config.infer_spec_type_from_file_location!
config.include Devise::TestHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :controller
config.include SpecHelpers::ModelsHelper
config.include Warden::Test::Helpers
Warden.test_mode!
Expand Down

0 comments on commit 82e0799

Please sign in to comment.