Skip to content

Commit

Permalink
fix deprecation warning on test (hash wit string keys)
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-fuentes committed Jan 9, 2018
1 parent 736fa0f commit 65afe64
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions app/helpers/admin/sidebar_helper.rb
Expand Up @@ -7,12 +7,12 @@ def active_menu(model, action=nil, shortcut = nil)
end

def event_fixed_filters
{ 'tray' => {"utf8" => "✓", "search_title" => "", "search_person" => "",
"status" => ["requested", "declined"], "lobby_activity" => "1",
"controller" => "events", "action" => "index"} ,
'events' => {"utf8" => "✓", "search_title" => "", "search_person" => "",
"status" => ["accepted", "done", "canceled"],
"controller" => "events", "action" => "index"} }
{ tray: { utf8: "✓", search_title: "", search_person: "",
status: ["requested", "declined"], lobby_activity: "1",
controller: "events", action: "index"} ,
events: { utf8: "✓", search_title: "", search_person: "",
status: ["accepted", "done", "canceled"],
controller: "events", action: "index"} }
end

def help_by_role(user)
Expand All @@ -32,11 +32,11 @@ def current_action?(action)
end

def event_filters?(shortcut)
event_fixed_filters[shortcut] == request.env['action_dispatch.request.parameters']
event_fixed_filters[shortcut] == request.env['action_dispatch.request.parameters'].symbolize_keys
end

def unfiltered?
!(event_fixed_filters.values.include? request.env['action_dispatch.request.parameters'])
!(event_fixed_filters.values.include? request.env['action_dispatch.request.parameters'].symbolize_keys)
end

def active?(model, shortcut, action)
Expand All @@ -45,7 +45,7 @@ def active?(model, shortcut, action)
# activaction for the two event lionks
event_filters?(shortcut) ||
# edit, and new avent activate :tray link
(params[:controller] == model && current_action?(action) && shortcut == 'tray' && unfiltered? )
(params[:controller] == model && current_action?(action) && shortcut == :tray && unfiltered? )
end

end
8 changes: 4 additions & 4 deletions app/views/layouts/_admin_sidebar.html.erb
Expand Up @@ -17,8 +17,8 @@
</li>
<% end %>
<% if current_user.user? %>
<li class="<%= active_menu('events', nil, 'events') %>">
<a href="<%= events_path(event_fixed_filters['events']) %>">
<li class="<%= active_menu('events', nil, :events) %>">
<a href="<%= events_path(event_fixed_filters[:events]) %>">
<i class="fi-book size-18"> <%= t("organizations.show.events_title") %></i>
</a>
</li>
Expand Down Expand Up @@ -55,8 +55,8 @@
</li>
<% end %>
<% if current_user.user? %>
<li class="<%= active_menu('events', nil, 'tray') %>">
<a href="<%= events_path(event_fixed_filters['tray']) %>">
<li class="<%= active_menu('events', nil, :tray) %>">
<a href="<%= events_path(event_fixed_filters[:tray]) %>">
<i class="fi-calendar size-18">
<%= t("backend.event_tray") %>
</i>
Expand Down
18 changes: 9 additions & 9 deletions spec/features/admin/events_spec.rb
Expand Up @@ -13,9 +13,9 @@
describe "index" do

scenario 'visit the events index page' do
visit events_path("utf8" => "✓", "search_title" => "", "search_person" => "",
"status" => ["requested", "declined"], "lobby_activity" => "1",
"controller" => "events", "action" => "index" )
visit events_path(utf8: "✓", search_title: "", search_person: "",
status: ["requested", "declined"], lobby_activity: "1",
controller: "events", action: "index")
expect(page).to have_content "Eventos"
expect(page).to have_content I18n.t 'backend.event_tray'
end
Expand Down Expand Up @@ -43,9 +43,9 @@
event9.update(status: :canceled)
event10.update(status: :declined)

visit events_path("utf8" => "✓", "search_title" => "", "search_person" => "",
"status" => ["requested", "declined"], "lobby_activity" => "1",
"controller" => "events", "action" => "index" )
visit events_path(utf8: "✓", search_title: "", search_person: "",
status: ["requested", "declined"], lobby_activity: "1",
controller: "events", action: "index" )

click_link "Eventos"
expect(find_link(I18n.t("backend.event_tray")).first(:xpath, ".//..")[:class]).not_to eq "active"
Expand Down Expand Up @@ -75,9 +75,9 @@
event = create(:event, position: @position)
create(:attachment, event: event, title: "An amazing attachment title")
create(:attachment, event: event, title: "Other title")
visit events_path("utf8" => "✓", "search_title" => "", "search_person" => "",
"status" => ["accepted", "canceled", "declined"],
"controller" => "events", "action" => "index" )
visit events_path(utf8: "✓", search_title: "", search_person: "",
status: ["accepted", "done", "canceled"],
controller: "events", action: "index" )

within "#event_#{event.id}" do
find('.attachments-dropdown').click
Expand Down

0 comments on commit 65afe64

Please sign in to comment.