Navigation Menu

Skip to content

Commit

Permalink
test: remove needless tests
Browse files Browse the repository at this point in the history
For example, the following case focuses Ruby's basic feature (argument
check feature). It's not a test area of us.

    test("no values") do
      assert_raise(ArgumentError){ between("tags") }
    end

For example, the following case doesn't show expected behavior. We
expect String or Symbol as the first argument. We don't expect number as
the first argument. It's unexpected behavior (we can validate the first
argument or we just use the argument value because it's responsive of
user). We shouldn't add a test for the unexpected behavior. If we
validate the first argument then it's reasonable that we add a test
that the method raises for wrong value.

    test("number_include") do
      assert_equal({
                     :table => "posts",
                     :filter => "between(10, 2, \"include\", 29, \"include\")",
                   },
                   between(10, 2, "include", 29, "include"))
    end
  • Loading branch information
kou committed Apr 26, 2017
1 parent 6d1b3a7 commit ab55abb
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions test/request/test-select.rb
Expand Up @@ -101,44 +101,12 @@ def between(column_name,
max, max_border).to_parameters
end

test("column_name_include") do
test("border") do
assert_equal({
:table => "posts",
:filter => "between(ages, 2, \"include\", 29, \"include\")",
:filter => "between(ages, 2, \"include\", 29, \"exclude\")",
},
between("ages", 2, "include", 29, "include"))
end

test("column_name_exclude") do
assert_equal({
:table => "posts",
:filter => "between(ages, 2, \"exclude\", 29, \"exclude\")",
},
between("ages", 2, "exclude", 29, "exclude"))
end

test("number_include") do
assert_equal({
:table => "posts",
:filter => "between(10, 2, \"include\", 29, \"include\")",
},
between(10, 2, "include", 29, "include"))
end

test("number_exclude") do
assert_equal({
:table => "posts",
:filter => "between(10, 2, \"exclude\", 29, \"exclude\")",
},
between(10, 2, "exclude", 29, "exclude"))
end

test("no values") do
assert_raise(ArgumentError){ between("tags") }
end

test("too much values") do
assert_raise(ArgumentError){ between("ages", 2, "include", 29, "include", 3) }
between("ages", 2, "include", 29, "exclude"))
end
end

Expand Down

0 comments on commit ab55abb

Please sign in to comment.