diff --git a/tracks/app/models/context.rb b/tracks/app/models/context.rb
index 22912120..f7070d4a 100644
--- a/tracks/app/models/context.rb
+++ b/tracks/app/models/context.rb
@@ -6,14 +6,12 @@ class Context < ActiveRecord::Base
acts_as_list :scope => :user
extend NamePartFinder
include Tracks::TodoList
- include UrlFriendlyName
attr_protected :user
validates_presence_of :name, :message => "context must have a name"
validates_length_of :name, :maximum => 255, :message => "context name must be less than 256 characters"
validates_uniqueness_of :name, :message => "already exists", :scope => "user_id"
- validates_does_not_contain :name, :string => '/', :message => "cannot contain the slash ('/') character"
validates_does_not_contain :name, :string => ',', :message => "cannot contain the comma (',') character"
def self.feed_options(user)
@@ -31,10 +29,6 @@ class Context < ActiveRecord::Base
self.hide == true || self.hide == 1
end
- def to_param
- url_friendly_name
- end
-
def title
name
end
diff --git a/tracks/app/models/project.rb b/tracks/app/models/project.rb
index a0d58e28..13b90cb6 100644
--- a/tracks/app/models/project.rb
+++ b/tracks/app/models/project.rb
@@ -7,14 +7,12 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :message => "project must have a name"
validates_length_of :name, :maximum => 255, :message => "project name must be less than 256 characters"
validates_uniqueness_of :name, :message => "already exists", :scope =>"user_id"
- validates_does_not_contain :name, :string => '/', :message => "cannot contain the slash ('/') character"
validates_does_not_contain :name, :string => ',', :message => "cannot contain the comma (',') character"
acts_as_list :scope => 'user_id = #{user_id} AND state = \'#{state}\''
acts_as_state_machine :initial => :active, :column => 'state'
extend NamePartFinder
include Tracks::TodoList
- include UrlFriendlyName
state :active
state :hidden, :enter => :hide_todos, :exit => :unhide_todos
@@ -45,11 +43,7 @@ class Project < ActiveRecord::Base
:description => "Lists all the projects for #{user.display_name}"
}
end
-
- def to_param
- url_friendly_name
- end
-
+
def hide_todos
todos.each do |t|
unless t.completed? || t.deferred?
diff --git a/tracks/app/models/user.rb b/tracks/app/models/user.rb
index 8a067537..bb929327 100644
--- a/tracks/app/models/user.rb
+++ b/tracks/app/models/user.rb
@@ -5,34 +5,14 @@ class User < ActiveRecord::Base
:order => 'position ASC',
:dependent => :delete_all do
def find_by_params(params)
- if params['url_friendly_name']
- find_by_url_friendly_name(params['url_friendly_name'])
- elsif params['id'] && params['id'] =~ /^\d+$/
- find(params['id'])
- elsif params['id']
- find_by_url_friendly_name(params['id'])
- elsif params['context']
- find_by_url_friendly_name(params['context'])
- elsif params['context_id']
- find_by_url_friendly_name(params['context_id'])
- end
+ find(params['id'] || params['context_id'])
end
end
has_many :projects,
:order => 'position ASC',
:dependent => :delete_all do
def find_by_params(params)
- if params['url_friendly_name']
- find_by_url_friendly_name(params['url_friendly_name'])
- elsif params['id'] && params['id'] =~ /^\d+$/
- find(params['id'])
- elsif params['id']
- find_by_url_friendly_name(params['id'])
- elsif params['project']
- find_by_url_friendly_name(params['project'])
- elsif params['project_id']
- find_by_url_friendly_name(params['project_id'])
- end
+ find(params['id'] || params['project_id'])
end
def update_positions(project_ids)
project_ids.each_with_index do |id, position|
diff --git a/tracks/app/views/contexts/_context.rhtml b/tracks/app/views/contexts/_context.rhtml
index 19eecbfd..59809d23 100644
--- a/tracks/app/views/contexts/_context.rhtml
+++ b/tracks/app/views/contexts/_context.rhtml
@@ -21,7 +21,8 @@
%>
<% end -%>
<% if source_view_is :context %>
- <%= in_place_editor_field :context, :name, {}, { :url => url_for(:controller => 'context', :action => 'update', :id => context.id, :field => 'name', :wants_render => false) } %>
+ <%= context.name %>
+ <%= in_place_editor 'context_name_in_place_editor', { :url => { :controller => 'contexts', :action => 'update', :id => context.id, :field => 'name', :wants_render => false, :escape => false} , :options=>"{method:'put'}" } %>
<% else %>
<%= link_to_context( context ) %>
<% end %>
diff --git a/tracks/app/views/projects/_project.rhtml b/tracks/app/views/projects/_project.rhtml
index 3828f1be..df79822a 100644
--- a/tracks/app/views/projects/_project.rhtml
+++ b/tracks/app/views/projects/_project.rhtml
@@ -5,7 +5,8 @@
<% if collapsible %>
<%= image_tag("collapse.png") %>
<% end %>
- <%= in_place_editor_field :project, :name, {}, { :url => url_for(:controller => 'project', :action => 'update', :id => project.id, :field => 'name', :wants_render => false) } %>
+ <%= project.name %>
+ <%= in_place_editor 'project_name_in_place_editor', { :url => { :controller => 'projects', :action => 'update', :id => project.id, :field => 'name', :wants_render => false, :escape => false} , :options=>"{method:'put'}" } %>
<% if @project.description -%>
<%= sanitize(@project.description) %>
diff --git a/tracks/config/environment.rb.tmpl b/tracks/config/environment.rb.tmpl
index 2e076326..17eb4875 100644
--- a/tracks/config/environment.rb.tmpl
+++ b/tracks/config/environment.rb.tmpl
@@ -64,7 +64,6 @@ AUTHENTICATION_SCHEMES = ['database']
require 'name_part_finder'
require 'todo_list'
-require 'url_friendly_name'
require 'config'
require 'activerecord_base_tag_extensions' # Needed for tagging-specific extensions
diff --git a/tracks/lib/url_friendly_name.rb b/tracks/lib/url_friendly_name.rb
deleted file mode 100644
index e8a7431b..00000000
--- a/tracks/lib/url_friendly_name.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module UrlFriendlyName
-
- def self.included(base)
- base.extend ClassMethods
- end
-
- def url_friendly_name
- name.gsub(/_/,'__').gsub(/ /,'_').gsub(/\./,'__dot__')
- end
-
- module ClassMethods
-
- def find_by_url_friendly_name(url_friendly_name)
- name = url_friendly_name.gsub(/__dot__/,'.').gsub(/([^_])_(?!_)/,'\1 ').gsub(/__/,'_') #second regex replaces all single underscores with spaces
- self.find_by_name(name)
- end
-
- end
-
-end
\ No newline at end of file
diff --git a/tracks/test/functional/contexts_controller_test.rb b/tracks/test/functional/contexts_controller_test.rb
index 01fc9dee..0f384825 100644
--- a/tracks/test/functional/contexts_controller_test.rb
+++ b/tracks/test/functional/contexts_controller_test.rb
@@ -30,14 +30,14 @@ class ContextsControllerTest < TodoContainerControllerTestBase
assert_rjs :call, "Form.focusFirstElement", "context-form"
end
- def test_create_via_ajax_with_slash_in_name_does_not_increment_number_of_contexts
- assert_ajax_create_does_not_increment_count 'foo/bar'
+ def test_create_via_ajax_with_comma_in_name_does_not_increment_number_of_contexts
+ assert_ajax_create_does_not_increment_count 'foo,bar'
end
- def test_create_with_slash_in_name_fails_with_rjs
- ajax_create 'foo/bar'
+ def test_create_with_comma_in_name_fails_with_rjs
+ ajax_create 'foo,bar'
assert_rjs :show, 'status'
- assert_rjs :update, 'status', "1 error prohibited this record from being saved
There were problems with the following fields:
Name cannot contain the slash ('/') character
"
+ assert_rjs :update, 'status', "1 error prohibited this record from being saved
There were problems with the following fields:
Name cannot contain the comma (',') character
"
end
def test_rss_feed_content
diff --git a/tracks/test/functional/projects_controller_test.rb b/tracks/test/functional/projects_controller_test.rb
index fd760430..81b077b8 100644
--- a/tracks/test/functional/projects_controller_test.rb
+++ b/tracks/test/functional/projects_controller_test.rb
@@ -57,18 +57,18 @@ class ProjectsControllerTest < TodoContainerControllerTestBase
def test_create_project_and_go_to_project_page
num_projects = Project.count
xhr :post, :create, { :project => {:name => 'Immediate Project Planning Required'}, :go_to_project => 1}
- assert_js_redirected_to '/projects/Immediate_Project_Planning_Required'
+ assert_js_redirected_to '/projects/5'
assert_equal num_projects + 1, Project.count
end
- def test_create_with_slash_in_name_does_not_increment_number_of_projects
- assert_ajax_create_does_not_increment_count 'foo/bar'
+ def test_create_with_comma_in_name_does_not_increment_number_of_projects
+ assert_ajax_create_does_not_increment_count 'foo,bar'
end
- def test_create_with_slash_in_name_fails_with_rjs
- ajax_create 'foo/bar'
+ def test_create_with_comma_in_name_fails_with_rjs
+ ajax_create 'foo,bar'
assert_rjs :show, 'status'
- assert_rjs :update, 'status', "1 error prohibited this record from being saved
There were problems with the following fields:
Name cannot contain the slash ('/') character
"
+ assert_rjs :update, 'status', "1 error prohibited this record from being saved
There were problems with the following fields:
Name cannot contain the comma (',') character
"
end
def test_todo_state_is_project_hidden_after_hiding_project
diff --git a/tracks/test/integration/context_xml_api_test.rb b/tracks/test/integration/context_xml_api_test.rb
index 450695d4..3d06a522 100644
--- a/tracks/test/integration/context_xml_api_test.rb
+++ b/tracks/test/integration/context_xml_api_test.rb
@@ -46,11 +46,11 @@ class ContextXmlApiTest < ActionController::IntegrationTest
end
end
- def test_fails_with_slash_in_name
- authenticated_post_xml_to_context_create "foo/bar"
+ def test_fails_with_comma_in_name
+ authenticated_post_xml_to_context_create "foo,bar"
assert_response 404
assert_xml_select 'errors' do
- assert_select 'error', 1, 'Name cannot contain the slash (\'/\') character'
+ assert_select 'error', 1, 'Name cannot contain the comma (\',\') character'
end
end
diff --git a/tracks/test/integration/feed_smoke_test.rb b/tracks/test/integration/feed_smoke_test.rb
index f7df0ff8..42a1e66e 100644
--- a/tracks/test/integration/feed_smoke_test.rb
+++ b/tracks/test/integration/feed_smoke_test.rb
@@ -44,27 +44,27 @@ class FeedSmokeTest < ActionController::IntegrationTest
end
def test_all_actions_in_context_rss
- assert_success "/contexts/agenda/todos.rss?token=#{ users(:admin_user).word }"
+ assert_success "/contexts/1/todos.rss?token=#{ users(:admin_user).word }"
end
def test_all_actions_in_context_txt
- assert_success "/contexts/agenda/todos.txt?token=#{ users(:admin_user).word }"
+ assert_success "/contexts/1/todos.txt?token=#{ users(:admin_user).word }"
end
def test_all_actions_in_context_ical
- assert_success "/contexts/agenda/todos.ics?token=#{ users(:admin_user).word }"
+ assert_success "/contexts/1/todos.ics?token=#{ users(:admin_user).word }"
end
def test_all_actions_in_project_rss
- assert_success "/projects/Build_a_working_time_machine/todos.rss?token=#{ users(:admin_user).word }"
+ assert_success "/projects/1/todos.rss?token=#{ users(:admin_user).word }"
end
def test_all_actions_in_project_txt
- assert_success "/projects/Build_a_working_time_machine/todos.txt?token=#{ users(:admin_user).word }"
+ assert_success "/projects/1/todos.txt?token=#{ users(:admin_user).word }"
end
def test_all_actions_in_project_ical
- assert_success "/projects/Build_a_working_time_machine/todos.ics?token=#{ users(:admin_user).word }"
+ assert_success "/projects/1/todos.ics?token=#{ users(:admin_user).word }"
end
def test_all_actions_due_today_or_earlier_rss
@@ -120,7 +120,7 @@ class FeedSmokeTest < ActionController::IntegrationTest
p.hide!
assert_success "/projects.txt?token=#{ users(:admin_user).word }"
end
-
+
private
def assert_success(url)
diff --git a/tracks/test/integration/project_xml_api_test.rb b/tracks/test/integration/project_xml_api_test.rb
index 7f37daf6..54da713a 100644
--- a/tracks/test/integration/project_xml_api_test.rb
+++ b/tracks/test/integration/project_xml_api_test.rb
@@ -43,9 +43,9 @@ class ProjectXmlApiTest < ActionController::IntegrationTest
assert_response_and_body 404, "Name project name must be less than 256 characters"
end
- def test_fails_with_slash_in_name
- authenticated_post_xml_to_project_create "foo/bar"
- assert_response_and_body 404, "Name cannot contain the slash ('/') character"
+ def test_fails_with_comma_in_name
+ authenticated_post_xml_to_project_create "foo,bar"
+ assert_response_and_body 404, "Name cannot contain the comma (',') character"
end
def test_creates_new_project
diff --git a/tracks/test/selenium/context_detail/in_place_edit_name.rsel b/tracks/test/selenium/context_detail/in_place_edit_name.rsel
new file mode 100644
index 00000000..c6a09214
--- /dev/null
+++ b/tracks/test/selenium/context_detail/in_place_edit_name.rsel
@@ -0,0 +1,10 @@
+setup :fixtures => :all
+login :as => 'admin'
+open "/contexts/1"
+click "context_name_in_place_editor"
+wait_for_element_present "css=#context_name_in_place_editor-inplaceeditor input.editor_field"
+type "css=#context_name_in_place_editor-inplaceeditor input.editor_field", "Test Foo"
+click "css=#context_name_in_place_editor-inplaceeditor input.editor_ok_button"
+wait_for_text "context_name_in_place_editor", "Test Foo"
+open "/contexts/1"
+wait_for_text "context_name_in_place_editor", "Test Foo"
diff --git a/tracks/test/selenium/notes/link_to_note.rsel b/tracks/test/selenium/notes/link_to_note.rsel
index 4c0e3e4d..a9a3ae7e 100644
--- a/tracks/test/selenium/notes/link_to_note.rsel
+++ b/tracks/test/selenium/notes/link_to_note.rsel
@@ -1,5 +1,5 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click_and_wait "css=#note_1 .link_to_notes"
assert_element_present "note_1"
diff --git a/tracks/test/selenium/project_detail/activate_deferred_todo.rsel b/tracks/test/selenium/project_detail/activate_deferred_todo.rsel
index 619a54ae..3740bf31 100644
--- a/tracks/test/selenium/project_detail/activate_deferred_todo.rsel
+++ b/tracks/test/selenium/project_detail/activate_deferred_todo.rsel
@@ -1,9 +1,9 @@
setup :fixtures => :all
next_available_todo_id = 18
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
include_partial 'project_detail/add_deferred_todo'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click "edit_icon_todo_#{next_available_todo_id}"
wait_for_element_present "show_from_todo_#{next_available_todo_id}"
type "show_from_todo_#{next_available_todo_id}", ""
diff --git a/tracks/test/selenium/project_detail/activate_last_deferred_todo.rsel b/tracks/test/selenium/project_detail/activate_last_deferred_todo.rsel
index 43731f5e..8672e381 100644
--- a/tracks/test/selenium/project_detail/activate_last_deferred_todo.rsel
+++ b/tracks/test/selenium/project_detail/activate_last_deferred_todo.rsel
@@ -1,6 +1,6 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click "edit_icon_todo_15"
wait_for_element_present "show_from_todo_15"
type "show_from_todo_15", ""
diff --git a/tracks/test/selenium/project_detail/change_project_status.rsel b/tracks/test/selenium/project_detail/change_project_status.rsel
index 8824365f..d6799762 100644
--- a/tracks/test/selenium/project_detail/change_project_status.rsel
+++ b/tracks/test/selenium/project_detail/change_project_status.rsel
@@ -1,6 +1,6 @@
setup :fixtures => :all
login :as => 'admin'
-open '/projects/Build_a_working_time_machine'
+open '/projects/1'
assert_checked 'project_state_active', 'ignored'
assert_attribute 'css=#project_status .active span', 'class', 'active_state'
assert_attribute 'css=#project_status .hidden span', 'class', 'inactive_state'
@@ -9,6 +9,6 @@ click 'project_state_hidden'
wait_for_attribute 'css=#project_status .active span', 'class', 'inactive_state'
wait_for_attribute 'css=#project_status .hidden span', 'class', 'active_state'
assert_text 'badge_count', '2'
-open '/projects/Build_a_working_time_machine'
+open '/projects/1'
assert_text 'badge_count', '2'
assert_checked 'project_state_hidden', 'ignored'
diff --git a/tracks/test/selenium/project_detail/change_todos_project_to_blank.rsel b/tracks/test/selenium/project_detail/change_todos_project_to_blank.rsel
index 08562814..1cf36ffd 100644
--- a/tracks/test/selenium/project_detail/change_todos_project_to_blank.rsel
+++ b/tracks/test/selenium/project_detail/change_todos_project_to_blank.rsel
@@ -1,6 +1,6 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click "edit_icon_todo_5"
wait_for_element_present "show_from_todo_5"
type "project_name_todo_5", ""
diff --git a/tracks/test/selenium/project_detail/create_deferred_todo.rsel b/tracks/test/selenium/project_detail/create_deferred_todo.rsel
index df87d9ed..316d8b3d 100644
--- a/tracks/test/selenium/project_detail/create_deferred_todo.rsel
+++ b/tracks/test/selenium/project_detail/create_deferred_todo.rsel
@@ -1,5 +1,5 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Make_more_money_than_Billy_Gates"
+open "/projects/2"
include_partial 'project_detail/add_deferred_todo'
assert_not_visible "tickler-empty-nd"
\ No newline at end of file
diff --git a/tracks/test/selenium/project_detail/defer_todo.rsel b/tracks/test/selenium/project_detail/defer_todo.rsel
index 8dae5b8c..de329264 100644
--- a/tracks/test/selenium/project_detail/defer_todo.rsel
+++ b/tracks/test/selenium/project_detail/defer_todo.rsel
@@ -1,6 +1,6 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click "edit_icon_todo_5"
wait_for_element_present "show_from_todo_5"
type "show_from_todo_5", "1/1/2030"
diff --git a/tracks/test/selenium/project_detail/in_place_edit_name.rsel b/tracks/test/selenium/project_detail/in_place_edit_name.rsel
new file mode 100644
index 00000000..53e3f041
--- /dev/null
+++ b/tracks/test/selenium/project_detail/in_place_edit_name.rsel
@@ -0,0 +1,10 @@
+setup :fixtures => :all
+login :as => 'admin'
+open "/projects/1"
+click "project_name_in_place_editor"
+wait_for_element_present "css=#project_name_in_place_editor-inplaceeditor input.editor_field"
+type "css=#project_name_in_place_editor-inplaceeditor input.editor_field", "Test Foo"
+click "css=#project_name_in_place_editor-inplaceeditor input.editor_ok_button"
+wait_for_text "project_name_in_place_editor", "Test Foo"
+open "/projects/1"
+wait_for_text "project_name_in_place_editor", "Test Foo"
diff --git a/tracks/test/selenium/project_detail/mark_deferred_todo_complete.rsel b/tracks/test/selenium/project_detail/mark_deferred_todo_complete.rsel
index 2af7d7ab..893192f8 100644
--- a/tracks/test/selenium/project_detail/mark_deferred_todo_complete.rsel
+++ b/tracks/test/selenium/project_detail/mark_deferred_todo_complete.rsel
@@ -1,6 +1,6 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
include_partial 'project_detail/add_deferred_todo'
click "xpath=//div[@id='tickler'] //div[@id='todo_15'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_15']"
diff --git a/tracks/test/selenium/project_detail/mark_last_deferred_todo_complete.rsel b/tracks/test/selenium/project_detail/mark_last_deferred_todo_complete.rsel
index 9a87704c..8ba271c8 100644
--- a/tracks/test/selenium/project_detail/mark_last_deferred_todo_complete.rsel
+++ b/tracks/test/selenium/project_detail/mark_last_deferred_todo_complete.rsel
@@ -1,5 +1,5 @@
setup :fixtures => :all
login :as => 'admin'
-open "/projects/Build_a_working_time_machine"
+open "/projects/1"
click "xpath=//div[@id='tickler'] //div[@id='todo_15'] //input[@class='item-checkbox']"
wait_for_visible "tickler-empty-nd"
diff --git a/tracks/test/unit/context_test.rb b/tracks/test/unit/context_test.rb
index 2a35a75f..3ffc71a0 100644
--- a/tracks/test/unit/context_test.rb
+++ b/tracks/test/unit/context_test.rb
@@ -32,14 +32,6 @@ class ContextTest < Test::Unit::TestCase
assert_equal "already exists", newcontext.errors.on(:name)
end
- def test_validate_name_does_not_contain_slash
- newcontext = Context.new
- newcontext.name = "phone/telegraph"
- assert !newcontext.save
- assert_equal 1, newcontext.errors.count
- assert_equal "cannot contain the slash ('/') character", newcontext.errors.on(:name)
- end
-
def test_validate_name_does_not_contain_comma
newcontext = Context.new
newcontext.name = "phone,telegraph"
@@ -85,28 +77,8 @@ class ContextTest < Test::Unit::TestCase
assert_equal 2, Context.find(@agenda.id).done_todos.size
end
- def test_url_friendly_name_for_name_with_spaces
- assert_url_friendly_name_converts_properly 'any computer', 'any_computer'
- end
-
- def test_url_friendly_name_for_name_without_spaces
- assert_url_friendly_name_converts_properly 'NoSpacesHere', 'NoSpacesHere'
- end
-
- def test_url_friendly_name_for_name_with_underscores
- assert_url_friendly_name_converts_properly 'there is an_underscore', 'there_is_an__underscore'
- end
-
- def assert_url_friendly_name_converts_properly(name, url_friendly_name)
- context = Context.create(:name => name)
- assert_equal url_friendly_name, context.url_friendly_name
- found_context = Context.find_by_url_friendly_name(url_friendly_name)
- assert_not_nil context
- assert_equal context.id, found_context.id
- end
-
- def test_to_param_returns_url_friendly_name
- assert_equal 'agenda', @agenda.to_param
+ def test_to_param_returns_id
+ assert_equal '1', @agenda.to_param
end
def test_title_reader_returns_name
diff --git a/tracks/test/unit/project_test.rb b/tracks/test/unit/project_test.rb
index cd5bd788..81186d87 100644
--- a/tracks/test/unit/project_test.rb
+++ b/tracks/test/unit/project_test.rb
@@ -30,15 +30,7 @@ class ProjectTest < Test::Unit::TestCase
assert_equal 1, newproj.errors.count
assert_equal "already exists", newproj.errors.on(:name)
end
-
- def test_validate_name_does_not_contain_slash
- newproj = Project.new
- newproj.name = "Save Earth/Mankind from Evil"
- assert !newproj.save
- assert_equal 1, newproj.errors.count
- assert_equal "cannot contain the slash ('/') character", newproj.errors.on(:name)
- end
-
+
def test_validate_name_does_not_contain_comma
newproj = Project.new
newproj.name = "Buy iPhones for Luke,bsag,David Allen"
@@ -114,33 +106,9 @@ class ProjectTest < Test::Unit::TestCase
t.save!
assert_equal 2, Project.find(@timemachine.id).deferred_todos.size
end
-
- def test_url_friendly_name_for_name_with_spaces
- assert_url_friendly_name_converts_properly 'Build a playhouse', 'Build_a_playhouse'
- end
-
- def test_url_friendly_name_for_name_without_spaces
- assert_url_friendly_name_converts_properly 'NoSpacesHere', 'NoSpacesHere'
- end
-
- def test_url_friendly_name_for_name_with_an_underscore
- assert_url_friendly_name_converts_properly 'there is an_underscore', 'there_is_an__underscore'
- end
-
- def test_url_friendly_name_for_name_with_a_dot
- assert_url_friendly_name_converts_properly 'hello.com', 'hello__dot__com'
- end
-
- def assert_url_friendly_name_converts_properly(name, url_friendly_name)
- project = Project.create(:name => name)
- assert_equal url_friendly_name, project.url_friendly_name
- found_project = Project.find_by_url_friendly_name(url_friendly_name)
- assert_not_nil project
- assert_equal project.id, found_project.id
- end
-
- def test_to_param_returns_url_friendly_name
- assert_equal 'Build_a_working_time_machine', @timemachine.to_param
+
+ def test_to_param_returns_id
+ assert_equal '1', @timemachine.to_param
end
def test_null_object
diff --git a/tracks/test/unit/user_test.rb b/tracks/test/unit/user_test.rb
index 7e68efcb..faaf74c2 100644
--- a/tracks/test/unit/user_test.rb
+++ b/tracks/test/unit/user_test.rb
@@ -227,29 +227,17 @@ class UserTest < Test::Unit::TestCase
def test_find_context_by_params
u = @admin_user
- c = u.contexts.find_by_params('url_friendly_name' => 'agenda')
- assert_equal contexts(:agenda), c
- c = u.contexts.find_by_params('id' => 'agenda')
- assert_equal contexts(:agenda), c
c = u.contexts.find_by_params('id' => '1')
assert_equal contexts(:agenda), c
- c = u.contexts.find_by_params('context' => 'agenda')
- assert_equal contexts(:agenda), c
- c = u.contexts.find_by_params('context_id' => 'agenda')
+ c = u.contexts.find_by_params('context_id' => '1')
assert_equal contexts(:agenda), c
end
def test_find_project_by_params
u = @admin_user
- p = u.projects.find_by_params('url_friendly_name' => 'Build_a_working_time_machine')
- assert_equal projects(:timemachine), p
- p = u.projects.find_by_params('id' => 'Build_a_working_time_machine')
- assert_equal projects(:timemachine), p
p = u.projects.find_by_params('id' => '1')
assert_equal projects(:timemachine), p
- p = u.projects.find_by_params('project' => 'Build_a_working_time_machine')
- assert_equal projects(:timemachine), p
- p = u.projects.find_by_params('project_id' => 'Build_a_working_time_machine')
+ p = u.projects.find_by_params('project_id' => '1')
assert_equal projects(:timemachine), p
end