Skip to content

Commit

Permalink
Merge pull request TracksApp#4 from u2ix/master
Browse files Browse the repository at this point in the history
Fixed some tests for 'starred todos'
  • Loading branch information
lrbalt committed Aug 7, 2011
2 parents 2441aa9 + 3d94898 commit 75a9bbe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/todos_controller.rb
Expand Up @@ -83,7 +83,7 @@ def create
@todo.context_id = context.id
end

@todo.starred= params[:new_todo_starred].include? "true"
@todo.starred= (params[:new_todo_starred]||"").include? "true"

@todo.add_predecessor_list(predecessor_list)

Expand Down
4 changes: 2 additions & 2 deletions app/models/todo.rb
Expand Up @@ -248,12 +248,12 @@ def starred?
end

def toggle_star!
starred=!starred?
self.starred= !starred?
end

def starred=(starred)
if starred
_add_tags(STARRED_TAG_NAME)
_add_tags STARRED_TAG_NAME unless starred?
else
_remove_tags STARRED_TAG_NAME
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/recurring_todos/toggle_star.js.erb
@@ -1,5 +1,5 @@
<%- if @saved -%>
$('div#recurring_todo_<%= @recurring_todo.id %> a.star_item img').toggleClass('starred_todo').toggleClass('unstarred_todo');
$('div#recurring_todo_<%= @recurring_todo.id %> a.star_item img').toggleClass('starred');
<%- else -%>
TracksPages.page_notify('error', '<%= t('todos.error_starring_recurring', :description => @recurring_todo.description) %>', 8);
<%- end -%>
2 changes: 1 addition & 1 deletion test/views/todos_helper_test.rb
Expand Up @@ -63,7 +63,7 @@ def test_show_date_future
def test_remote_star_icon_unstarred
@todo = flexmock(:id => 1, :to_param => 1, :description => 'Get gas', :starred? => false)
# added dot (.) to regexp because somehouw the extra dot is added in the tests while its not in the rendered html
assert_remote_star_icon_helper_matches %r{<a href="/todos/1/toggle_star" class="icon star_item" title="star the action 'Get gas'"><img alt="Blank" class="unstarred_todo" src="/images/blank.png[.?0-9]*" title="Star action" /></a>}
assert_remote_star_icon_helper_matches %r{<a href="/todos/1/toggle_star" class="icon star_item" title="star the action 'Get gas'"><img alt="Blank" class="todo_star" src="/images/blank.png[.?0-9]*" title="Star action" /></a>}
assert_behavior_registered
end

Expand Down

0 comments on commit 75a9bbe

Please sign in to comment.