Skip to content

Commit

Permalink
re-sync interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Blowers committed Feb 10, 2018
1 parent 4632c71 commit b93cf2a
Showing 1 changed file with 0 additions and 71 deletions.
71 changes: 0 additions & 71 deletions integration/mssql/cases/interval.exs
Original file line number Diff line number Diff line change
Expand Up @@ -187,35 +187,6 @@ defmodule Ecto.Integration.IntervalTest do
)
end

test "date_add with Ecto.Date" do
posted = @posted |> Date.to_erl() |> Ecto.Date.from_erl()

assert ["2015-01-01"] =
TestRepo.all(
from(p in Post, select: date_add(^posted, ^1, ^"year"))
)

assert ["2014-04-01"] =
TestRepo.all(
from(p in Post, select: date_add(^posted, ^3, ^"month"))
)

assert ["2014-01-22"] =
TestRepo.all(
from(p in Post, select: date_add(^posted, ^3, ^"week"))
)

assert ["2014-01-06"] =
TestRepo.all(
from(p in Post, select: date_add(^posted, ^5, ^"day"))
)

assert ["2014-01-03"] =
TestRepo.all(
from(p in Post, select: date_add(^posted, ^48, ^"hour"))
)
end

test "date_add with negative interval" do
dec = Decimal.new(-1)

Expand Down Expand Up @@ -683,48 +654,6 @@ defmodule Ecto.Integration.IntervalTest do
)
end

test "datetime_add with Ecto.DateTime" do
inserted_at =
@inserted_at |> NaiveDateTime.to_erl() |> Ecto.DateTime.from_erl()

field = :inserted_at

assert [_] =
TestRepo.all(
from(
p in Post,
where:
p.inserted_at > datetime_add(^inserted_at, ^(-1), "year")
)
)

assert [_] =
TestRepo.all(
from(
p in Post,
where: p.inserted_at > datetime_add(^inserted_at, -3, "month")
)
)

assert [_] =
TestRepo.all(
from(
p in Post,
where:
field(p, ^field) > datetime_add(^inserted_at, ^(-3), ^"week")
)
)

assert [_] =
TestRepo.all(
from(
p in Post,
where:
field(p, ^field) > datetime_add(^inserted_at, -5, ^"day")
)
)
end

test "datetime_add with negative interval" do
dec = Decimal.new(-1)

Expand Down

0 comments on commit b93cf2a

Please sign in to comment.