From eaebee861d2a8145af42c4802b6341f8ccc01bed Mon Sep 17 00:00:00 2001 From: Evan Gray Date: Mon, 22 Apr 2024 15:43:47 -0500 Subject: [PATCH] Remove duplicated test files --- test/attribool/validators/condition_test.rb | 46 ------------------ test/attribool/validators/method_name_test.rb | 48 ------------------- .../validators/nil_attribute_test.rb | 46 ------------------ .../validators/strict_boolean_test.rb | 48 ------------------- 4 files changed, 188 deletions(-) delete mode 100644 test/attribool/validators/condition_test.rb delete mode 100644 test/attribool/validators/method_name_test.rb delete mode 100644 test/attribool/validators/nil_attribute_test.rb delete mode 100644 test/attribool/validators/strict_boolean_test.rb diff --git a/test/attribool/validators/condition_test.rb b/test/attribool/validators/condition_test.rb deleted file mode 100644 index 40a4f08..0000000 --- a/test/attribool/validators/condition_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" -require_relative "../../../lib/attribool/validators/condition_validator" - -module Attribool::Validators - class ConditionTest < Test::Unit::TestCase - def setup - @validator = Attribool::Validators::ConditionValidator - @validator_sym = :condition - @valid_argument_permutations = [ - [nil], - [proc {}] - ] - @invalid_argument_permutations = [ - [:x] - ] - @error_class = ArgumentError - end - - def test_initialize - assert_nothing_raised do - @validator.new(*@valid_argument_permutations.first) - end - end - - def test_validate - @valid_argument_permutations.each do |args| - assert_nothing_raised { Attribool::ValidatorService.call(@validator_sym, *args) } - assert(@validator.new(*args).valid?) - end - - @invalid_argument_permutations.each do |args| - assert_raise(@error_class) { Attribool::ValidatorService.call(@validator_sym, *args) } - refute(@validator.new(*args).valid?) - end - end - - def test_error - assert_kind_of( - @error_class, - @validator.new(*@valid_argument_permutations.first).error - ) - end - end -end diff --git a/test/attribool/validators/method_name_test.rb b/test/attribool/validators/method_name_test.rb deleted file mode 100644 index 1fb3f93..0000000 --- a/test/attribool/validators/method_name_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" -require_relative "../../../lib/attribool/validators/method_name_validator" - -module Attribool::Validators - class MethodNameTest < Test::Unit::TestCase - def setup - @validator = Attribool::Validators::MethodNameValidator - @validator_sym = :method_name - @valid_argument_permutations = [ - [:x, 1], - [nil, 2], - [->(x) { x }, 2] - ] - @invalid_argument_permutations = [ - [-> {}, 2], - [->(x, y) { "#{x}#{y}" }, 2] - ] - @error_class = ArgumentError - end - - def test_initialize - assert_nothing_raised do - @validator.new(*@valid_argument_permutations.first) - end - end - - def test_validate - @valid_argument_permutations.each do |args| - assert_nothing_raised { Attribool::ValidatorService.call(@validator_sym, *args) } - assert(@validator.new(*args).valid?) - end - - @invalid_argument_permutations.each do |args| - assert_raise(@error_class) { Attribool::ValidatorService.call(@validator_sym, *args) } - refute(@validator.new(*args).valid?) - end - end - - def test_error - assert_kind_of( - @error_class, - @validator.new(*@valid_argument_permutations.first).error - ) - end - end -end diff --git a/test/attribool/validators/nil_attribute_test.rb b/test/attribool/validators/nil_attribute_test.rb deleted file mode 100644 index dfddd9c..0000000 --- a/test/attribool/validators/nil_attribute_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" -require_relative "../../../lib/attribool/validators/nil_attribute_validator" - -module Attribool::Validators - class NilAttributeTest < Test::Unit::TestCase - def setup - @validator = Attribool::Validators::NilAttributeValidator - @validator_sym = :nil_attribute - @valid_argument_permutations = [ - [:@test, :test, false], - [:@test, nil, true] - ] - @invalid_argument_permutations = [ - [:@test, nil, false] - ] - @error_class = TypeError - end - - def test_initialize - assert_nothing_raised do - @validator.new(*@valid_argument_permutations.first) - end - end - - def test_validate - @valid_argument_permutations.each do |args| - assert_nothing_raised { Attribool::ValidatorService.call(@validator_sym, *args) } - assert(@validator.new(*args).valid?) - end - - @invalid_argument_permutations.each do |args| - assert_raise(@error_class) { Attribool::ValidatorService.call(@validator_sym, *args) } - refute(@validator.new(*args).valid?) - end - end - - def test_error - assert_kind_of( - @error_class, - @validator.new(*@valid_argument_permutations.first).error - ) - end - end -end diff --git a/test/attribool/validators/strict_boolean_test.rb b/test/attribool/validators/strict_boolean_test.rb deleted file mode 100644 index 781d74b..0000000 --- a/test/attribool/validators/strict_boolean_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" -require_relative "../../../lib/attribool/validators/strict_boolean_validator" - -module Attribool::Validators - class StrictBooleanTest < Test::Unit::TestCase - def setup - @validator = Attribool::Validators::StrictBooleanValidator - @validator_sym = :strict_boolean - @valid_argument_permutations = [ - [true, false], - [:test, false], - [true, true], - [false, true] - ] - @invalid_argument_permutations = [ - [:test, true] - ] - @error_class = ArgumentError - end - - def test_initialize - assert_nothing_raised do - @validator.new(*@valid_argument_permutations.first) - end - end - - def test_validate - @valid_argument_permutations.each do |args| - assert_nothing_raised { Attribool::ValidatorService.call(@validator_sym, *args) } - assert(@validator.new(*args).valid?) - end - - @invalid_argument_permutations.each do |args| - assert_raise(@error_class) { Attribool::ValidatorService.call(@validator_sym, *args) } - refute(@validator.new(*args).valid?) - end - end - - def test_error - assert_kind_of( - @error_class, - @validator.new(*@valid_argument_permutations.first).error - ) - end - end -end