Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added field of domain company #140

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class UsersController < Clearance::UsersController
private

def user_params
params.require(:user).permit(:email, :password, company_attributes: %i[name url])
params.require(:user).permit(:email, :password, company_attributes: %i[name url domain])
end
end
1 change: 1 addition & 0 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
<%= form.fields_for :company, @user.company || @user.build_company do |company_form| %>
<%= company_form.text_field :name, class: 'field', placeholder: Company.human_attribute_name(:name) %>
<%= company_form.text_field :url, class: 'field', placeholder: Company.human_attribute_name(:url) %>
<%= company_form.text_field :domain, class: 'field', placeholder: Company.human_attribute_name(:domain) %>
<% end %>
1 change: 1 addition & 0 deletions config/locales/activerecord.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ en:
company:
name: Company name
url: Company website
domain: Custom domain
1 change: 1 addition & 0 deletions config/locales/activerecord.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pt-BR:
company:
name: Nome da Empresa
url: Site da Empresa
domain: Domínio Customizado

6 changes: 6 additions & 0 deletions db/migrate/20181027190121_add_domain_to_companies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddDomainToCompanies < ActiveRecord::Migration[5.2]
def change
add_column :companies, :domain, :string
add_index :companies, :domain
samuelgrigolato marked this conversation as resolved.
Show resolved Hide resolved
end
end
3 changes: 3 additions & 0 deletions spec/features/registration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@

fill_in placeholder: 'Company name', with: 'Galactic Empire'
fill_in placeholder: 'Company website', with: 'http://galacticempire.com'
fill_in placeholder: 'Custom domain', with: 'empire'

click_on 'Sign up'

expect(Company.last).to have_attributes(domain: 'empire', url: 'http://galacticempire.com', name: 'Galactic Empire')

expect(page).to have_text 'Submit your vacancy'
expect(page).to have_text 'Logout'

Expand Down