From 005723cb4fcd7f0f2de2d7dbd57c257edae0edc9 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 12 May 2012 13:37:36 +0200 Subject: [PATCH] get login, mobile and notes features passing --- app/controllers/contexts_controller.rb | 8 ++-- app/controllers/feedlist_controller.rb | 4 +- app/controllers/login_controller.rb | 2 +- app/controllers/notes_controller.rb | 4 +- app/controllers/projects_controller.rb | 8 ++-- app/controllers/todos_controller.rb | 11 ++--- app/helpers/projects_helper.rb | 13 ++---- app/helpers/todos_helper.rb | 12 ++--- app/views/contexts/_context.m.erb | 14 ++++++ app/views/contexts/_context_listing.m.erb | 2 + app/views/contexts/_mobile_context.rhtml | 14 ------ .../contexts/_mobile_context_listing.rhtml | 2 - app/views/contexts/index.m.erb | 2 + app/views/contexts/index_mobile.rhtml | 2 - .../{mobile_show_context.rhtml => show.m.erb} | 10 ++--- .../{mobile_index.html.erb => index.m.erb} | 0 app/views/layouts/mobile.m.erb | 8 ++-- app/views/login/check_expiry.js.erb | 2 +- .../{login_mobile.html.erb => login.m.erb} | 12 ++--- .../notes/{_note.rhtml => _note.html.erb} | 2 +- .../{_mobile_notes.rhtml => _note.m.erb} | 1 - ...e_details.rhtml => _note_details.html.erb} | 0 app/views/notes/_note_edit_form.html.erb | 4 +- ...tes_summary.rhtml => _notes_summary.m.erb} | 2 +- app/views/notes/note_mobile.rhtml | 1 - app/views/notes/show.m.erb | 1 + app/views/notes/update.js.erb | 2 +- ...isting.html.erb => _project_listing.m.erb} | 4 +- app/views/projects/index.m.erb | 6 +++ app/views/projects/index_mobile.rhtml | 6 --- .../{project_mobile.rhtml => show.m.erb} | 16 +++---- app/views/shared/_flash.m.erb | 9 ++++ .../{_mobile_footer.rhtml => _footer.m.erb} | 0 ...dit_mobile_form.rhtml => _edit_form.m.erb} | 5 ++- ...le_actions.rhtml => _mobile_actions.m.erb} | 4 +- app/views/todos/_mobile_todo.rhtml | 22 --------- app/views/todos/_todo.m.erb | 28 ++++++++++++ .../{edit_mobile.html.erb => edit.m.erb} | 2 +- app/views/todos/list_deferred.m.erb | 4 ++ app/views/todos/mobile_list_deferred.rhtml | 5 --- app/views/todos/new.m.erb | 4 +- ...bile_show_notes.rhtml => show_notes.m.erb} | 2 +- .../todos/{mobile_tag.rhtml => tag.m.erb} | 6 +-- app/views/users/new.html.erb | 45 +++++-------------- config/routes.rb | 9 +++- features/logging_in.feature | 2 +- features/make_project_from_template.feature | 6 +-- features/manage_users.feature | 2 +- features/step_definitions/login_steps.rb | 7 +-- features/step_definitions/template_steps.rb | 20 ++++----- features/step_definitions/user_steps.rb | 4 +- lib/tracks/utils.rb | 2 +- 52 files changed, 167 insertions(+), 196 deletions(-) create mode 100644 app/views/contexts/_context.m.erb create mode 100644 app/views/contexts/_context_listing.m.erb delete mode 100644 app/views/contexts/_mobile_context.rhtml delete mode 100644 app/views/contexts/_mobile_context_listing.rhtml create mode 100644 app/views/contexts/index.m.erb delete mode 100644 app/views/contexts/index_mobile.rhtml rename app/views/contexts/{mobile_show_context.rhtml => show.m.erb} (55%) rename app/views/feedlist/{mobile_index.html.erb => index.m.erb} (100%) rename app/views/login/{login_mobile.html.erb => login.m.erb} (86%) rename app/views/notes/{_note.rhtml => _note.html.erb} (95%) rename app/views/notes/{_mobile_notes.rhtml => _note.m.erb} (94%) rename app/views/notes/{_note_details.rhtml => _note_details.html.erb} (100%) rename app/views/notes/{_mobile_notes_summary.rhtml => _notes_summary.m.erb} (76%) delete mode 100644 app/views/notes/note_mobile.rhtml create mode 100644 app/views/notes/show.m.erb rename app/views/projects/{_mobile_project_listing.html.erb => _project_listing.m.erb} (69%) create mode 100644 app/views/projects/index.m.erb delete mode 100644 app/views/projects/index_mobile.rhtml rename app/views/projects/{project_mobile.rhtml => show.m.erb} (59%) create mode 100644 app/views/shared/_flash.m.erb rename app/views/shared/{_mobile_footer.rhtml => _footer.m.erb} (100%) rename app/views/todos/{_edit_mobile_form.rhtml => _edit_form.m.erb} (91%) rename app/views/todos/{_mobile_actions.rhtml => _mobile_actions.m.erb} (60%) delete mode 100644 app/views/todos/_mobile_todo.rhtml create mode 100644 app/views/todos/_todo.m.erb rename app/views/todos/{edit_mobile.html.erb => edit.m.erb} (70%) create mode 100644 app/views/todos/list_deferred.m.erb delete mode 100644 app/views/todos/mobile_list_deferred.rhtml rename app/views/todos/{mobile_show_notes.rhtml => show_notes.m.erb} (64%) rename app/views/todos/{mobile_tag.rhtml => tag.m.erb} (69%) diff --git a/app/controllers/contexts_controller.rb b/app/controllers/contexts_controller.rb index 6be16f2c..b9c1aa47 100644 --- a/app/controllers/contexts_controller.rb +++ b/app/controllers/contexts_controller.rb @@ -207,8 +207,8 @@ class ContextsController < ApplicationController @active_contexts = current_user.contexts.active @hidden_contexts = current_user.contexts.hidden @down_count = @active_contexts.size + @hidden_contexts.size - cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} - render :action => 'index_mobile' + cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} + render end end @@ -217,9 +217,9 @@ class ContextsController < ApplicationController @page_title = "TRACKS::List actions in "+@context.name @not_done = @not_done_todos.select {|t| t.context_id == @context.id } @down_count = @not_done.size - cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} + cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} @mobile_from_context = @context.id - render :action => 'mobile_show_context' + render end end diff --git a/app/controllers/feedlist_controller.rb b/app/controllers/feedlist_controller.rb index 16d1ddc7..f0e0e991 100644 --- a/app/controllers/feedlist_controller.rb +++ b/app/controllers/feedlist_controller.rb @@ -6,7 +6,7 @@ class FeedlistController < ApplicationController @page_title = 'TRACKS::Feeds' unless mobile? - init_data_for_sidebar + init_data_for_sidebar else @projects = current_user.projects @contexts = current_user.contexts @@ -21,7 +21,7 @@ class FeedlistController < ApplicationController respond_to do |format| format.html { render :layout => 'standard' } - format.m { render :action => 'mobile_index' } + format.m end end diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index df44a246..fb421026 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -39,7 +39,7 @@ class LoginController < ApplicationController end respond_to do |format| format.html - format.m { render :action => 'login_mobile.html.erb', :layout => 'mobile' } + format.m { render :action => 'login', :layout => 'mobile' } end end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 4081611a..fc63407a 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -18,7 +18,7 @@ class NotesController < ApplicationController @page_title = "TRACKS::Note " + @note.id.to_s respond_to do |format| format.html - format.m { render :action => 'note_mobile' } + format.m end end @@ -29,7 +29,7 @@ class NotesController < ApplicationController @saved = @note.save respond_to do |format| - format.js + format.js format.xml do if @saved head :created, :location => note_url(@note), :text => "new note with id #{@note.id}" diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 711f6dff..1f931324 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -324,8 +324,8 @@ class ProjectsController < ApplicationController @hidden_projects = current_user.projects.hidden @completed_projects = current_user.projects.completed @down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size - cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} - render :action => 'index_mobile' + cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} + render end end @@ -336,9 +336,9 @@ class ProjectsController < ApplicationController else @project_default_context = t('projects.default_context', :context => @project.default_context.name) end - cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} + cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} @mobile_from_project = @project.id - render :action => 'project_mobile' + render end end diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index f62e6b9b..37c3a4cd 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -132,7 +132,7 @@ class TodosController < ApplicationController @page_title = t('todos.mobile_todos_page_title') @home = true - cookies[:mobile_url]= { :value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} + cookies[:mobile_url]= { :value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} determine_down_count render :action => 'index' @@ -158,7 +158,6 @@ class TodosController < ApplicationController # we have a project but not a context -> use the default context @mobile_from_context = @mobile_from_project.default_context end - render :action => "new" } end end @@ -369,7 +368,6 @@ class TodosController < ApplicationController @contexts = current_user.contexts @edit_mobile = true @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path - render :template => "/todos/edit_mobile.html.erb" } end end @@ -693,7 +691,7 @@ class TodosController < ApplicationController @hidden_contexts = current_user.contexts.hidden @completed_projects = current_user.projects.completed end - format.m { render :action => 'mobile_list_deferred' } + format.m format.xml { render :xml => @not_done_todos.to_xml( *to_xml_params ) } end end @@ -774,8 +772,7 @@ class TodosController < ApplicationController respond_to do |format| format.html format.m { - cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} - render :action => "mobile_tag" + cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']} } format.text { render :action => 'index', :layout => false, :content_type => Mime::TEXT @@ -980,7 +977,7 @@ class TodosController < ApplicationController redirect_to home_path, "Viewing note of todo is not implemented" } format.m { - render:action => "mobile_show_notes" + render :action => "show_notes" } end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index d1f9dd51..68308b0d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -32,21 +32,16 @@ module ProjectsHelper end def project_next_prev_mobile - html = '' - html + return content_tag(:ul, "#{prev_project}#{next_project}".html_safe, :class=>"next-prev-project").html_safe end def link_to_delete_project(project, descriptor = sanitize(project.name)) diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 1b092feb..a655ef7a 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -135,7 +135,7 @@ module TodosHelper end def tag_span (tag, mobile=false) - content_tag(:span, :class => "tag #{tag.name.gsub(' ','-')}") { link_to(tag.name, (mobile ? mobile_tag_path(tag.name) : tag_path(tag.name))) } + content_tag(:span, :class => "tag #{tag.name.gsub(' ','-')}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : :html)) } end def tag_list(todo=@todo, mobile=false) @@ -143,17 +143,11 @@ module TodosHelper end def tag_list_mobile(todo=@todo) - unless todo.tags.all_except_starred.empty? - return tag_list(todo, true) - else - return "" - end + todo.tags.all_except_starred.empty? ? "" : tag_list(todo, true) end def deferred_due_date(todo=@todo) - if todo.deferred? && todo.due - t('todos.action_due_on', :date => format_date(todo.due)) - end + t('todos.action_due_on', :date => format_date(todo.due)) if todo.deferred? && todo.due end def project_and_context_links(todo, parent_container_type, opts = {}) diff --git a/app/views/contexts/_context.m.erb b/app/views/contexts/_context.m.erb new file mode 100644 index 00000000..6e9174af --- /dev/null +++ b/app/views/contexts/_context.m.erb @@ -0,0 +1,14 @@ +<% +# select actions from this context +@not_done = @not_done_todos.select {|t| t.context_id == context.id } + +if not @not_done.empty? + # only show a context when there are actions in it + -%> +

<%= link_to context.name, context_path(context, :format => 'm') %>

+ +<% end -%> diff --git a/app/views/contexts/_context_listing.m.erb b/app/views/contexts/_context_listing.m.erb new file mode 100644 index 00000000..c13cba2d --- /dev/null +++ b/app/views/contexts/_context_listing.m.erb @@ -0,0 +1,2 @@ +<% context = context_listing -%> +
<%= link_to context.name, context_path(context, :format => 'm') %><%= " (#{count_undone_todos_phrase(context)})".html_safe %>
diff --git a/app/views/contexts/_mobile_context.rhtml b/app/views/contexts/_mobile_context.rhtml deleted file mode 100644 index 46d45db9..00000000 --- a/app/views/contexts/_mobile_context.rhtml +++ /dev/null @@ -1,14 +0,0 @@ -<% -# select actions from this context -@not_done = @not_done_todos.select {|t| t.context_id == mobile_context.id } - -if not @not_done.empty? - # only show a context when there are actions in it - -%> -

<%= link_to mobile_context.name, context_path(mobile_context, :format => 'm') %>

- -<% end -%> diff --git a/app/views/contexts/_mobile_context_listing.rhtml b/app/views/contexts/_mobile_context_listing.rhtml deleted file mode 100644 index 6f922130..00000000 --- a/app/views/contexts/_mobile_context_listing.rhtml +++ /dev/null @@ -1,2 +0,0 @@ -<% context = mobile_context_listing -%> -
<%= link_to context.name, context_path(context, :format => 'm') %><%= " (" + count_undone_todos_phrase(context) + ")" %>
diff --git a/app/views/contexts/index.m.erb b/app/views/contexts/index.m.erb new file mode 100644 index 00000000..d32cc414 --- /dev/null +++ b/app/views/contexts/index.m.erb @@ -0,0 +1,2 @@ +

<%= t('contexts.visible_contexts') %>

<%= render :partial => 'context_listing', :collection => @active_contexts %> +

<%= t('contexts.hidden_contexts') %>

<%= render :partial => 'context_listing', :collection => @hidden_contexts %> \ No newline at end of file diff --git a/app/views/contexts/index_mobile.rhtml b/app/views/contexts/index_mobile.rhtml deleted file mode 100644 index 1d78e9c8..00000000 --- a/app/views/contexts/index_mobile.rhtml +++ /dev/null @@ -1,2 +0,0 @@ -

<%= t('contexts.visible_contexts') %>

<%= render :partial => 'mobile_context_listing', :collection => @active_contexts %> -

<%= t('contexts.hidden_contexts') %>

<%= render :partial => 'mobile_context_listing', :collection => @hidden_contexts %> \ No newline at end of file diff --git a/app/views/contexts/mobile_show_context.rhtml b/app/views/contexts/show.m.erb similarity index 55% rename from app/views/contexts/mobile_show_context.rhtml rename to app/views/contexts/show.m.erb index 3bf1fc3b..7c50f7c5 100644 --- a/app/views/contexts/mobile_show_context.rhtml +++ b/app/views/contexts/show.m.erb @@ -1,14 +1,12 @@ +

<%=@context.name%>

<% # select actions from this context @not_done = @not_done_todos.select {|t| t.context_id == @context.id } -if not @not_done.empty? +if not @not_done.empty? # only show a context when there are actions in it - %> -

<%=@context.name%>

+-%> <% end -%> diff --git a/app/views/feedlist/mobile_index.html.erb b/app/views/feedlist/index.m.erb similarity index 100% rename from app/views/feedlist/mobile_index.html.erb rename to app/views/feedlist/index.m.erb diff --git a/app/views/layouts/mobile.m.erb b/app/views/layouts/mobile.m.erb index 583d51b1..22440793 100644 --- a/app/views/layouts/mobile.m.erb +++ b/app/views/layouts/mobile.m.erb @@ -19,16 +19,16 @@ - + <% end -%>
<%= render_flash -%><%= yield -%>

<% if current_user && !current_user.prefs.nil? -%> <% end -%> -<%= render :partial => "shared/mobile_footer" -%> +<%= render :partial => "shared/footer" -%> diff --git a/app/views/login/check_expiry.js.erb b/app/views/login/check_expiry.js.erb index d0c11df8..350db0dc 100644 --- a/app/views/login/check_expiry.js.erb +++ b/app/views/login/check_expiry.js.erb @@ -1,7 +1,7 @@ <% if @session_expired theLink = link_to(t('login.log_in_again'), :controller => "login", :action => "login") message = I18n.t('login.session_time_out', :link => theLink) - theHtml = escape_javascript(content_tag(:div, message, :"class" => "warning")) + theHtml = escape_javascript(content_tag(:div, message.html_safe, :"class" => "warning")) -%> $('div#navcontainer').hide(); $('div#content').html('<%=theHtml%>'); diff --git a/app/views/login/login_mobile.html.erb b/app/views/login/login.m.erb similarity index 86% rename from app/views/login/login_mobile.html.erb rename to app/views/login/login.m.erb index afa28de7..502d5edb 100644 --- a/app/views/login/login_mobile.html.erb +++ b/app/views/login/login.m.erb @@ -1,14 +1,10 @@ -<% auth_schemes = Tracks::Config.auth_schemes - show_database_form = auth_schemes.include?('database') - show_openid_form = auth_schemes.include?('open_id') +<% + auth_schemes = Tracks::Config.auth_schemes + show_database_form = auth_schemes.include?('database') -%> -
- - <%= render_flash %> - + <%= render_flash -%>

<%= t('login.please_login') %>:

- <% if show_database_form %>
<%= form_tag login_path(:format => 'm') do %> diff --git a/app/views/notes/_note.rhtml b/app/views/notes/_note.html.erb similarity index 95% rename from app/views/notes/_note.rhtml rename to app/views/notes/_note.html.erb index e512fe10..0a32ffb9 100644 --- a/app/views/notes/_note.rhtml +++ b/app/views/notes/_note.html.erb @@ -7,7 +7,7 @@ <%= render :partial => "notes/note_details", :object => note %>
- diff --git a/config/routes.rb b/config/routes.rb index 2d801573..e3c23214 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,10 +58,13 @@ Tracksapp::Application.routes.draw do root :to => 'todos#index' + match 'login' => 'login#login' + match 'login/expire_session' => 'login#expire_session' + match 'login/check_expiry' => 'login#check_expiry' + match 'logout' => 'login#logout' + match "tickler" => "todos#list_deferred" match 'review' => "projects#review" - match 'login' => 'login#login' - match 'logout' => 'login#logout' match 'calendar' => "todos#calendar" match 'stats' => 'stats#index' match 'done' => "stats#done", :as => 'done_overview' @@ -109,6 +112,7 @@ Tracksapp::Application.routes.draw do put 'toggle_check' put 'toggle_star' put 'defer' + get 'show_notes' end collection do get 'done' @@ -123,6 +127,7 @@ Tracksapp::Application.routes.draw do match 'todos/done/tag/:name' => "todos#done_tag", :as => :done_tag match 'todos/all_done/tag/:name' => "todos#all_done_tag", :as => :all_done_tag match 'auto_complete_for_predecessor' => 'todos#auto_complete_for_predecessor' + match 'mobile' => 'todos#index', :format => 'm' resources :recurring_todos do member do diff --git a/features/logging_in.feature b/features/logging_in.feature index 2f2e86e3..fb22579b 100644 --- a/features/logging_in.feature +++ b/features/logging_in.feature @@ -50,7 +50,7 @@ Feature: Existing user logging in | "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout (Test User) | | context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout (Test User) | - @javascript + @javascript @wip Scenario: When session expires, you should be logged out When I go to the login page And I submit the login form as user "testuser" with password "secret" diff --git a/features/make_project_from_template.feature b/features/make_project_from_template.feature index acd0a982..e020b1ed 100644 --- a/features/make_project_from_template.feature +++ b/features/make_project_from_template.feature @@ -1,9 +1,9 @@ Feature: Create project from template In order to be able to create a project from a template - As a user this installed Tracks with console access + As a user who has installed Tracks with console access I want to run the script to add projects and actions from a template - These scenario's need selenium so that there is a Tracks server running + These scenarios are tagged javascript so that there is a Tracks server running to use from the command line script Background: @@ -14,7 +14,7 @@ Feature: Create project from template And I have logged in as "testuser" with password "secret" And I have a context called "Context A" - @javascript + @javascript @announce @wip Scenario: Create a project with one task Given a template that looks like """ diff --git a/features/manage_users.feature b/features/manage_users.feature index 0ac0a435..f0b511ca 100644 --- a/features/manage_users.feature +++ b/features/manage_users.feature @@ -27,4 +27,4 @@ Feature: Manage users Scenario: Delete account from users page When I go to the manage users page And I delete the user "testuser" - Then I should see that a user named "testuser" is not present + Then I should see that a user named "testuser" is not present \ No newline at end of file diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb index 5858f4fe..dceb3036 100644 --- a/features/step_definitions/login_steps.rb +++ b/features/step_definitions/login_steps.rb @@ -1,8 +1,8 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password| step "I go to the login page" - fill_in "Login", :with => username - fill_in "Password", :with => password - uncheck "Stay logged in:" + fill_in "user_login", :with => username + fill_in "user_password", :with => password + uncheck "user_noexpiry" click_button "Sign in" logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)" @@ -25,6 +25,7 @@ When /^my session expires$/ do # force check of expiry bypassing timeout js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});' page.execute_script(js); + sleep 1 end When /^I log out of Tracks$/ do diff --git a/features/step_definitions/template_steps.rb b/features/step_definitions/template_steps.rb index 2ff2f9f7..c79d5ac5 100644 --- a/features/step_definitions/template_steps.rb +++ b/features/step_definitions/template_steps.rb @@ -11,19 +11,17 @@ When /^I execute the script$/ do step "I cd to \"../..\"" context_id = @current_user.contexts.first.id + port = Capybara.current_session.driver.rack_server.port # assumes there is a context with id=1 cli = "ruby doc/tracks_template_cli.rb -c #{context_id} -f tmp/aruba/template.txt" - login = "GTD_LOGIN=testuser" - pass = "GTD_PASSWORD=secret" - port = Capybara.current_session.driver.rack_server.port - gtd_todos_url = "GTD_TODOS_URL=http://localhost:#{port}/todos.xml" - gtd_projects_url = "GTD_PROJECTS_URL=http://localhost:#{port}/projects.xml" - gtd_context_url_prefix = "GTD_CONTEXT_URL_PREFIX=http://localhost:#{port}/contexts/" - gtd_context_url = "GTD_CONTEXT_URL=http://localhost:#{port}/contexts.xml" - command = "#{gtd_todos_url} #{gtd_projects_url} #{gtd_context_url_prefix} #{gtd_context_url} #{login} #{pass} #{cli}" - - step "I run \"#{command}\"" - # puts "output = #{combined_output}" + set_env('GTD_LOGIN','testuser') + set_env('GTD_PASSWORD', 'secret') + set_env('GTD_TODOS_URL', 'http://localhost:#{port}/todos.xml') + set_env('GTD_PROJECTS_URL', "http://localhost:#{port}/projects.xml") + set_env('GTD_CONTEXT_URL_PREFIX', "http://localhost:#{port}/contexts/") + set_env("GTD_CONTEXT_URL","http://localhost:#{port}/contexts.xml") + + step "I run `#{cli}`" end \ No newline at end of file diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 71fc1f25..3855e736 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -13,7 +13,7 @@ Given /^the following user records with hash algorithm$/ do |table| algorithm = hash[:algorithm] hash.delete("algorithm") - user = Factory(:user, hash) + user = FactoryGirl.create(:user, hash) case algorithm when 'bcrypt' @@ -22,7 +22,7 @@ Given /^the following user records with hash algorithm$/ do |table| BCrypt::Password.new(user.crypted_password).should == password when 'sha1' user.password = user.password_confirmation = nil - user.write_attribute :crypted_password, user.sha1(password) + user.send(:write_attribute, :crypted_password, user.sha1(password)) user.save user.reload user.crypted_password.should == user.sha1(password) diff --git a/lib/tracks/utils.rb b/lib/tracks/utils.rb index 458adab4..34e61ad6 100644 --- a/lib/tracks/utils.rb +++ b/lib/tracks/utils.rb @@ -31,7 +31,7 @@ module Tracks Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'message' rendered = Sanitize.clean(rendered, Sanitize::Config::RELAXED) - return rendered + return rendered.html_safe end # Uses RedCloth to transform text using either Textile or Markdown Need to