Skip to content

Commit

Permalink
Merge pull request #3 from LendingHome/revert-2-develop
Browse files Browse the repository at this point in the history
Revert "develop to master"
  • Loading branch information
shuber authored Aug 24, 2018
2 parents 7812c2f + 6b2afd2 commit 37bece3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
5 changes: 1 addition & 4 deletions apps/staging/lib/schemas/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ defmodule Staging.Server do
end

def order_by_name(query) do
from s in query, order_by: [
fragment("regexp_matches(?, '^\D+')::text[]", s.name),
fragment("regexp_matches(?, '\d+$')::int[]", s.name)
]
from s in query, order_by: s.name
end

def archive_all(query) do
Expand Down
15 changes: 0 additions & 15 deletions apps/staging/spec/staging_bot_spec.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,6 @@ defmodule Staging.BotSpec do
end
end

context "there are servers with numeric suffixes" do
before do
Factory.insert(:server, %{name: "qa-11", prod_data: false})
Factory.insert(:server, %{name: "qa-1", prod_data: false})
Factory.insert(:server, %{name: "beta-21", prod_data: false})
Factory.insert(:server, %{name: "beta-2", prod_data: false})
end

it "lists the servers alphabetically by name prefix then numerically by index suffix" do
Bot.handle_event(%{type: "message", text: "#{@bot_name} list", channel: @channel, user: @message_user.id}, @slack, [])
response = string_matching(~r/beta-2.+beta-21.+qa-1.+qa-11/iu)
expect(@slack_send).to have_received([response, @channel, @slack])
end
end

context "some servers are archived" do
before do
Factory.insert(:server, %{name: "server-1", archived: false})
Expand Down

0 comments on commit 37bece3

Please sign in to comment.