Commit 5e66c656 authored by James Lopez's avatar James Lopez

fix specs

parent 377244dd
...@@ -57,7 +57,7 @@ module API ...@@ -57,7 +57,7 @@ module API
get do get do
authenticated_as_admin! if params[:external].present? || (params[:extern_uid].present? && params[:provider].present?) authenticated_as_admin! if params[:external].present? || (params[:extern_uid].present? && params[:provider].present?)
unless current_user.admin? unless current_user&.admin?
params.except!(:created_after, :created_before) params.except!(:created_after, :created_before)
end end
......
...@@ -165,7 +165,7 @@ describe API::Users do ...@@ -165,7 +165,7 @@ describe API::Users do
end end
it "returns a user created before a specific date" do it "returns a user created before a specific date" do
user = create(:user, created_at: Date.new(2000,1,1)) user = create(:user, created_at: Date.new(2000, 1, 1))
get api("/users?created_before=2000-01-02T00:00:00.060Z", admin) get api("/users?created_before=2000-01-02T00:00:00.060Z", admin)
...@@ -175,7 +175,7 @@ describe API::Users do ...@@ -175,7 +175,7 @@ describe API::Users do
end end
it "returns no users created before a specific date" do it "returns no users created before a specific date" do
create(:user, created_at: Date.new(2001,1,1)) create(:user, created_at: Date.new(2001, 1, 1))
get api("/users?created_before=2000-01-02T00:00:00.060Z", admin) get api("/users?created_before=2000-01-02T00:00:00.060Z", admin)
...@@ -184,7 +184,7 @@ describe API::Users do ...@@ -184,7 +184,7 @@ describe API::Users do
end end
it "returns users created before and after a specific date" do it "returns users created before and after a specific date" do
user = create(:user, created_at: Date.new(2001,1,1)) user = create(:user, created_at: Date.new(2001, 1, 1))
get api("/users?created_before=2001-01-02T00:00:00.060Z&created_after=1999-01-02T00:00:00.060", admin) get api("/users?created_before=2001-01-02T00:00:00.060Z&created_after=1999-01-02T00:00:00.060", admin)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment