diff --git a/Gemfile b/Gemfile index cd9aba56..b4c0c9c6 100644 --- a/Gemfile +++ b/Gemfile @@ -69,7 +69,7 @@ group :test do gem 'rails-dom-testing', git: 'https://github.com/rails/rails-dom-testing', ref: 'a64f30514ee65f172c43f42cfd4500b5e11a561a' - gem "factory_girl_rails" + gem "factory_bot_rails" gem "rspec-expectations" gem "database_cleaner" gem "mocha", :require => false @@ -86,5 +86,5 @@ group :test do gem "simplecov" # get test coverage info on codeclimate - gem "codeclimate-test-reporter", group: :test, require: nil + gem "codeclimate-test-reporter", "1.0.7", group: :test, require: nil end diff --git a/Gemfile.lock b/Gemfile.lock index 6ddffc36..914cb645 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,14 +81,14 @@ GEM daemons (1.2.6) database_cleaner (1.7.0) diff-lcs (1.3) - docile (1.1.5) + docile (1.3.1) erubis (2.7.0) eventmachine (1.2.7) execjs (2.7.0) - factory_girl (4.9.0) + factory_bot (4.10.0) activesupport (>= 3.0.0) - factory_girl_rails (4.9.0) - factory_girl (~> 4.9.0) + factory_bot_rails (4.10.0) + factory_bot (~> 4.10.0) railties (>= 3.0.0) ffi (1.9.25) font-awesome-sass (4.5.0) @@ -128,7 +128,7 @@ GEM mini_portile2 (~> 2.1.0) nokogumbo (1.5.0) nokogiri - paperclip (6.0.0) + paperclip (6.1.0) activemodel (>= 4.2.0) activesupport (>= 4.2.0) mime-types @@ -245,7 +245,7 @@ GEM safe_yaml (>= 0.8.6) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.16) + uglifier (4.1.17) execjs (>= 0.3.0, < 3) unicode-display_width (1.4.0) uniform_notifier (1.11.0) @@ -264,10 +264,10 @@ DEPENDENCIES bcrypt (~> 3.1.7) bootstrap-sass (= 3.3.3) bullet - codeclimate-test-reporter + codeclimate-test-reporter (= 1.0.7) coffee-rails (~> 4.1.0) database_cleaner - factory_girl_rails + factory_bot_rails font-awesome-sass (~> 4.5.0) htmlentities jquery-rails (~> 3.1.3) diff --git a/test/controllers/preferences_controller_test.rb b/test/controllers/preferences_controller_test.rb index 3b7d617b..98efc207 100644 --- a/test/controllers/preferences_controller_test.rb +++ b/test/controllers/preferences_controller_test.rb @@ -57,7 +57,11 @@ class PreferencesControllerTest < ActionController::TestCase :prefs => { :date_format => "%m-%d-%Y", :week_starts => "0", :show_number_completed => "10", :show_completed_projects_in_sidebar => "false", :show_hidden_contexts_in_sidebar => "false", :staleness_starts => "14", :due_style => "1" }} updated_admin_user = users(:admin_user).reload - assert_equal old_password_hash, updated_admin_user.password + if old_password_hash.nil? + assert_nil updated_admin_user.password + else + assert_equal old_password_hash, updated_admin_user.password + end end end diff --git a/test/controllers/recurring_todos_controller_test.rb b/test/controllers/recurring_todos_controller_test.rb index 7ce7f335..6c1d8a17 100644 --- a/test/controllers/recurring_todos_controller_test.rb +++ b/test/controllers/recurring_todos_controller_test.rb @@ -224,7 +224,7 @@ class RecurringTodosControllerTest < ActionController::TestCase assert_equal UserTime.new(user).midnight(target_date), new_todo.due # show_from should be nil since now+4.days-10.days is in the past - assert_equal nil, new_todo.show_from + assert_nil new_todo.show_from end def test_last_sunday_of_march diff --git a/test/controllers/todos_controller_test.rb b/test/controllers/todos_controller_test.rb index 1781a0b0..ec203975 100644 --- a/test/controllers/todos_controller_test.rb +++ b/test/controllers/todos_controller_test.rb @@ -32,9 +32,9 @@ class TodosControllerTest < ActionController::TestCase p.save! login_as(:admin_user) get :index - assert_equal nil, assigns['project_not_done_counts'][projects(:timemachine).id] + assert_nil assigns['project_not_done_counts'][projects(:timemachine).id] assert_equal 2, assigns['context_not_done_counts'][contexts(:call).id] - assert_equal nil, assigns['context_not_done_counts'][contexts(:lab).id] + assert_nil assigns['context_not_done_counts'][contexts(:lab).id] end def test_not_done_counts_after_hiding_project diff --git a/test/models/project_from_todo_test.rb b/test/models/project_from_todo_test.rb index 6bdc1f07..6149203b 100644 --- a/test/models/project_from_todo_test.rb +++ b/test/models/project_from_todo_test.rb @@ -8,8 +8,16 @@ class ProjectFromTodoTest < ActiveSupport::TestCase todo = todos(:upgrade_rails) project = ProjectFromTodo.new(todo).create assert_equal project.name, todo.description - assert_equal project.description, todo.notes - assert_equal project.default_context, todo.context + if project.description.nil? + assert_nil todo.notes + else + assert_equal project.description, todo.notes + end + if project.default_context.nil? + assert_nil todo.context + else + assert_equal project.default_context, todo.context + end end def test_retain_tags_from_todo diff --git a/test/models/recurring_todo_test.rb b/test/models/recurring_todo_test.rb index 79ef192f..8a59bf39 100644 --- a/test/models/recurring_todo_test.rb +++ b/test/models/recurring_todo_test.rb @@ -30,8 +30,8 @@ class RecurringTodoTest < ActiveSupport::TestCase @every_day.target='show_from_date' # when recurrence is targeted on show_from, due date should remain nil - assert_equal nil, @every_day.get_due_date(nil) - assert_equal nil, @every_day.get_due_date(@today-3.days) + assert_nil @every_day.get_due_date(nil) + assert_nil @every_day.get_due_date(@today-3.days) # check show from get the next day assert_equal_dmy @today, @every_day.get_show_from_date(@today-1.days) @@ -40,7 +40,7 @@ class RecurringTodoTest < ActiveSupport::TestCase @every_day.target='due_date' # when target on due_date, show_from is relative to due date unless show_always is true @every_day.show_always = true - assert_equal nil, @every_day.get_show_from_date(@today-1.days) + assert_nil @every_day.get_show_from_date(@today-1.days) @every_day.show_always = false @every_day.show_from_delta=10 @@ -52,7 +52,7 @@ class RecurringTodoTest < ActiveSupport::TestCase # when show_from is nil, show always (happend in tests) @every_day.show_from_delta=nil - assert_equal nil, @every_day.get_show_from_date(@today+9.days) + assert_nil @every_day.get_show_from_date(@today+9.days) # TODO: show_from has no use case for daily pattern. Need to test on # weekly/monthly/yearly diff --git a/test/models/rich_message_extractor_test.rb b/test/models/rich_message_extractor_test.rb index cecdbdcd..828234e6 100644 --- a/test/models/rich_message_extractor_test.rb +++ b/test/models/rich_message_extractor_test.rb @@ -21,7 +21,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "ohai", extractor.description assert_equal "some-context", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_without_context @@ -37,7 +37,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "ohai", extractor.description assert_equal "", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_without_anything @@ -45,7 +45,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "", extractor.description assert_equal "", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_with_just_a_context @@ -53,7 +53,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "", extractor.description assert_equal "some-context", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_with_tags @@ -65,7 +65,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_tags message = "no tags" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.tags + assert_nil extractor.tags end def test_message_with_due_date @@ -77,7 +77,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_due_date message = "no date" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.due + assert_nil extractor.due end def test_message_with_show_from @@ -89,7 +89,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_show_from message = "no tickler" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.show_from + assert_nil extractor.show_from end def test_message_with_star