From d8a8d9f75e3ae0a28e79be4974ba86924be63645 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Thu, 20 Aug 2020 21:59:33 +0200 Subject: [PATCH] Added test_index_shows_and_hides_new_target_form Removed redundant path asserts (checking path and page content is either redundant or it's enough to check in one test only) --- lib/body_tracking/plugin_fixtures_loader.rb | 28 --------------------- test/system/targets_test.rb | 10 +++++--- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/lib/body_tracking/plugin_fixtures_loader.rb b/lib/body_tracking/plugin_fixtures_loader.rb index 2f4100c..22f46b2 100644 --- a/lib/body_tracking/plugin_fixtures_loader.rb +++ b/lib/body_tracking/plugin_fixtures_loader.rb @@ -9,32 +9,4 @@ module BodyTracking::PluginFixturesLoader end end end - - #private - - ## Load fixtures giving preference for plugin defined ones - #def load_fixtures(*args) - # # call create_fixtures directly instead of load_fixtures - # # or - # # create_fixtures in plugin_fixtures (include method in - # # ActiveRecord::TestFixtures) + load by calling #fixtures (like in issue_recurring) - # byebug - # redmine_fixture_path = self.fixture_path - # plugin_fixture_path = Rails.root.join('plugins', 'body_tracking', 'test', 'fixtures') - # all_ft_names = fixture_table_names - - # plugin_ft_names, redmine_ft_names = fixture_table_names.partition do |ft_name| - # File.exists?(plugin_fixture_path.join("#{ft_name.to_s}.yml")) - # end - - # self.fixture_table_names = redmine_ft_names - # fixtures = super - # ActiveSupport::TestCase.fixture_path = plugin_fixture_path - # self.fixture_table_names = plugin_ft_names - # fixtures.merge(super) - - # ActiveSupport::TestCase.fixture_path = redmine_fixture_path - # self.fixture_table_names = all_ft_names - # fixtures - #end end diff --git a/test/system/targets_test.rb b/test/system/targets_test.rb index e9c0456..37ea8e9 100644 --- a/test/system/targets_test.rb +++ b/test/system/targets_test.rb @@ -12,7 +12,6 @@ class TargetsTest < BodyTrackingSystemTestCase def test_index assert_not_equal 0, @project1.targets.count visit project_targets_path(@project1) - assert_current_path project_targets_path(@project1) assert_selector 'table#targets tbody tr', count: @project1.targets.count end @@ -25,12 +24,16 @@ class TargetsTest < BodyTrackingSystemTestCase end def test_index_shows_and_hides_new_target_form + visit project_targets_path(@project1) + assert_no_selector 'form#new-target-form' + click_link t('targets.contextual.link_new_target') + assert_selector 'form#new-target-form', count: 1 + click_on t(:button_cancel) + assert_no_selector 'form#new-target-form' end def test_create_binding_target visit project_targets_path(@project1) - assert_current_path project_targets_path(@project1) - assert_no_selector 'form#new-target-form' click_link t('targets.contextual.link_new_target') within 'form#new-target-form' do assert has_select?(t(:field_goal), selected: t('targets.form.binding_goal')) @@ -45,7 +48,6 @@ class TargetsTest < BodyTrackingSystemTestCase click_on t(:button_create) end end - assert_current_path project_targets_path(@project1) assert_selector 'table#targets tbody tr', count: @project1.targets.count end