Skip to content

Commit

Permalink
Added Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthBansal committed Dec 14, 2017
1 parent f3b0a7d commit 1b3faa3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def show


def show_for_author
if params[:id][-1..-1] == '*'
@wildcard = true
end
@tagname = params[:id]
@user = DrupalUser.find_by(name: params[:author])
@title = "'" + @tagname.to_s + "' by " + params[:author]
Expand Down
6 changes: 3 additions & 3 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
</li>

<li class="nav-button-wrapper hidden-xs hidden-sm hidden-md">
<button class="btn btn-sm btn-default nav-button-store"><a href="//store.publiclab.org"><%= t('layout._header.store') %></a></button>
<button class="btn btn-sm btn-default nav-button-store"><a href="www.google.com"><%= t('layout._header.store') %></a></button>
</li>
</ul>


<div id="chat" class="chat-popover" data-placement="bottom" style="display:none;">
<a style="margin-right:4px;" class="pull-right btn btn-sm" href="https://chat.publiclab.org" target="_blank"><%= t('layout._header.chatroom.pop_out') %></a>
Expand Down Expand Up @@ -217,7 +217,7 @@
if($('#chat').is(':visible') == true)
c.hide() ;
});
</script>
</script>
<%= render :partial => "layouts/alerts" %>

</div>
14 changes: 13 additions & 1 deletion test/functional/tag_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ def setup
assert_select '#wiki-content', 1
end

test 'show note with author and tagname without wildcard' do
get :show_for_author, id: 'replication:123', author: 'jeff'
assert_response :success
assert_not_nil :notes
end

test 'show note with author and tagname with wildcard' do
get :show_for_author, id: 'replication*', author: 'jeff'
assert_response :success
assert_not_nil :notes
assert :wildcard
end

test 'tag widget' do
get :widget, id: Tag.last.name
assert :success
Expand All @@ -193,7 +206,6 @@ def setup

test 'tag blog' do
get :blog, id: Tag.last.name

assert :success
assert_not_nil :notes
assert_not_nil :tags
Expand Down

0 comments on commit 1b3faa3

Please sign in to comment.