From 4fd84606bc5c0b8dddd8a6c5925e123ca7dbb44d Mon Sep 17 00:00:00 2001 From: Brian Michalski Date: Mon, 4 Jun 2012 21:49:25 -0700 Subject: [PATCH] Properly check for submissions#[index,show] and select the button. Close #99. --- app/views/elements/_topmenu_contents.html.erb | 2 +- test/fixtures/users.yml | 1 + test/integration/root_test.rb | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/views/elements/_topmenu_contents.html.erb b/app/views/elements/_topmenu_contents.html.erb index 55e939a7c..5a12ceefe 100644 --- a/app/views/elements/_topmenu_contents.html.erb +++ b/app/views/elements/_topmenu_contents.html.erb @@ -13,7 +13,7 @@
- <%= link_to feeds_path, :class => "btn #{ current_page?(feeds_path) || current_page?(:controller => 'submissions', :action => 'index') || current_page?(:controller => 'submissions', :action => 'show') ? 'selected' : '' }" do %><%= t(:browse) %><% end %> + <%= link_to feeds_path, :class => "btn #{ current_page?(feeds_path) || (controller.controller_name == 'submissions' && ['index', 'show'].include?(controller.action_name)) ? 'selected' : '' }" do %><%= t(:browse) %><% end %> <%= link_to new_content_path, :class => "btn #{ current_page?(new_content_path) ? 'selected' : '' }" do %><%= t(:add) %><% end %>
diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index b524c1a56..52d2d3740 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -9,6 +9,7 @@ katie: first_name: Katie last_name: Boudreau email: ktb@test.com + encrypted_password: $2a$10$UFJS15eVQKdSyP5qU7K.ceS0lqh5MUHt3DoyidIW70QUTVmPd3w4O kristen: first_name: Kristen diff --git a/test/integration/root_test.rb b/test/integration/root_test.rb index ae84da75b..2ebd86adf 100644 --- a/test/integration/root_test.rb +++ b/test/integration/root_test.rb @@ -12,4 +12,15 @@ class RootTest < ActionController::IntegrationTest # And it should never ever ever redirect assert !redirect? end + + test "signed in root urls load" do + post "/users/sign_in", :user => {:email => users(:katie).email, :password => 'katie'} + assert :success + + get "/feeds" + assert :success + + get "/feeds/#{feeds(:service).id}/submissions" + assert :success + end end