mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-02 19:10:16 +01:00
fixed tests for starred todos
This commit is contained in:
parent
2441aa92b5
commit
367476bd77
5 changed files with 8 additions and 8 deletions
|
|
@ -83,7 +83,7 @@ class TodosController < ApplicationController
|
||||||
@todo.context_id = context.id
|
@todo.context_id = context.id
|
||||||
end
|
end
|
||||||
|
|
||||||
@todo.starred= params[:new_todo_starred].include? "true"
|
@todo.starred= (params[:new_todo_starred]||"").include? "true"
|
||||||
|
|
||||||
@todo.add_predecessor_list(predecessor_list)
|
@todo.add_predecessor_list(predecessor_list)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,12 +248,12 @@ class Todo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_star!
|
def toggle_star!
|
||||||
starred=!starred?
|
self.starred= !starred?
|
||||||
end
|
end
|
||||||
|
|
||||||
def starred=(starred)
|
def starred=(starred)
|
||||||
if starred
|
if starred
|
||||||
_add_tags(STARRED_TAG_NAME)
|
_add_tags STARRED_TAG_NAME unless starred?
|
||||||
else
|
else
|
||||||
_remove_tags STARRED_TAG_NAME
|
_remove_tags STARRED_TAG_NAME
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<%- if @saved -%>
|
<%- 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 -%>
|
<%- else -%>
|
||||||
TracksPages.page_notify('error', '<%= t('todos.error_starring_recurring', :description => @recurring_todo.description) %>', 8);
|
TracksPages.page_notify('error', '<%= t('todos.error_starring_recurring', :description => @recurring_todo.description) %>', 8);
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ config.action_mailer.delivery_method = :test
|
||||||
config.action_controller.session_store = :cookie_store
|
config.action_controller.session_store = :cookie_store
|
||||||
config.action_controller.session = { :key => 'TracksCucumber', :secret => SITE_CONFIG['salt'] * (30.0 / SITE_CONFIG['salt'].length).ceil }
|
config.action_controller.session = { :key => 'TracksCucumber', :secret => SITE_CONFIG['salt'] * (30.0 / SITE_CONFIG['salt'].length).ceil }
|
||||||
|
|
||||||
config.gem 'cucumber', :lib => false, :version => '=0.9.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
|
config.gem 'cucumber', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
|
||||||
config.gem 'cucumber-rails', :lib => false, :version => '=0.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
config.gem 'cucumber-rails', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
||||||
config.gem 'gherkin', :lib => false, :version => '=2.4.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/gherkin'))
|
config.gem 'gherkin', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/gherkin'))
|
||||||
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
||||||
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class TodosHelperTest < ActiveSupport::HelperTestCase
|
||||||
def test_remote_star_icon_unstarred
|
def test_remote_star_icon_unstarred
|
||||||
@todo = flexmock(:id => 1, :to_param => 1, :description => 'Get gas', :starred? => false)
|
@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
|
# 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
|
assert_behavior_registered
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue