Skip to content

Commit

Permalink
Fix broken specs. Some enhancements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Senen committed Nov 24, 2017
1 parent 24c8251 commit bbc1c4c
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Organization < ActiveRecord::Base
enum entity_type: [:association, :federation, :lobby]

validates :inscription_reference, uniqueness: true, allow_blank: true, allow_nil: true
validates :name, :user, :category, presence: true
validates :name, :user, :category_id, presence: true
validates :denied_public_data, :denied_public_events, inclusion: { in: [false] }

has_many :represented_entities, dependent: :destroy
Expand Down
16 changes: 13 additions & 3 deletions app/views/admin/organizations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<%= link_to t('backend.new_company'), new_admin_organization_path, :class => "button radius warning right" if can? :create, Organization %>
</h1>

<%= paginate @organizations %>
<%= paginate @organizations %>

<div class="row">
<table class="event">
<thead>
Expand All @@ -25,11 +26,20 @@
<%= organization.name %>
</td>
<td class="right">
<%= link_to edit_admin_organization_path(organization), title: t('backend.edit') do %>
<%= link_to organization_path(organization),
target: :blank,
title: t('organizations.show.title') do %>
<i class="step fi-eye size-24"></i>
<% end %>
<%= link_to edit_admin_organization_path(organization),
title: t('backend.edit') do %>
<i class="step fi-page-edit size-24"></i>
<% end if can? :edit, organization %>
<%= link_to admin_organization_path(organization), method: :delete, data: { confirm: t("backend.delete_confirm") }, title: t('backend.delete') do%>
<%= link_to admin_organization_path(organization), method: :delete,
data: { confirm: t("backend.delete_confirm") },
title: t('backend.delete') do %>
<i class="step fi-page-delete size-24"></i>
<% end if can? :destroy, organization %>
</td>
Expand Down
8 changes: 3 additions & 5 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@
</li>
</ul>
</section>

</div>
</div>
</div>


<nav class="top-bar show-for-small-only" data-topbar role="navigation">
<div class="header__base">
<h1 class="header__title"><strong><%= t('header.open_goverment') %></strong> <%= link_to t('header.transparency'),root_path %></h1>
Expand All @@ -49,12 +47,12 @@
<li><a href="<%= t('header.transparency_url') %>" target="_blank"><%= t('header.transparency') %></a></li>
<li><a href="<%= t('header.open_data_url') %>" target="_blank"><%= t('header.open_data') %></a></li>
<li class="btn-public-agenda <%= current_page?(root_path) && 'active' %>">
<%= link_to 'Agenda públicas', root_path %>
<%= link_to t('header.btn_public_agenda'), root_path %>
</li>
<li class="btn-organizations <%= current_page?(organizations_path) && 'active' %>">
<%= link_to 'Consulta de registro', organizations_path %>
<%= link_to t('header.btn_organizations'), organizations_path %>
</li>
</ul>
</section>
</nav>
</header><!-- .header -->
</header>
2 changes: 1 addition & 1 deletion app/views/organizations/_organization.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article id="<%= dom_id(organization)%>" class="post organization">
<h1 class="organization_name post__title">
<%= link_to organization.fullname, organization_path(organization) %>
<%= link_to organization.fullname, organization_path(organization), title: t("organizations.show.title") %>
</h1>
<p><%= I18n.l organization.inscription_date, format: :complete %></p>
</article>
2 changes: 1 addition & 1 deletion config/locales/organizations.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ en:
default: Last registered lobbies

show:
title: "Organización"
title: "Organization public page"
reference: "Referencia"
identifying_data_title: "Datos"
id: "Código de Lobby"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/organizations.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ es:
default: Últimos lobbies registrados

show:
title: "Organización"
title: "Página pública de la Organización"
reference: "Referencia"
identifying_data_title: "Datos"
id: "Código de Lobby"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/public.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ es:
transparency_url: "http://www.madrid.es/portaldetransparencia "
participation_url: "https://decide.madrid.es"
open_data_url: "http://datos.madrid.es"
btn_public_agenda: "Agenda públicas"
btn_public_agenda: "Agendas públicas"
btn_organizations: "Consulta de registro"
main:
title: "Agendas públicas"
Expand Down
15 changes: 15 additions & 0 deletions spec/features/admin/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@
end

scenario 'Visit new admin organization page and create organization with the minimum permitted fields' do
category = create(:category)
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand All @@ -81,9 +84,11 @@
describe "Legal Representant" do

scenario 'Try create organization with invalid legal representant and display error', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand All @@ -100,9 +105,11 @@
end

scenario 'Create organization with valid legal representant', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand Down Expand Up @@ -140,9 +147,11 @@
describe "Represented Entities" do

scenario 'Try create organization with invalid respresented entities and display error', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand All @@ -164,9 +173,11 @@
end

scenario 'Create organization with valid represented entities', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand Down Expand Up @@ -218,9 +229,11 @@
describe "Agents" do

scenario 'Try create organization with invalid agent and display error', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand All @@ -241,9 +254,11 @@
end

scenario 'Create organization with valid agents', :js do
category = create(:category)
visit new_admin_organization_path

fill_in :organization_name, with: "organization name"
select category.name, from: :organization_category_id
fill_in :organization_user_attributes_first_name, with: "user first name"
fill_in :organization_user_attributes_last_name, with: "user last name"
fill_in :organization_user_attributes_email, with: "user@email.com"
Expand Down

0 comments on commit bbc1c4c

Please sign in to comment.