Skip to content

Commit

Permalink
fix: update string refinements with blank? and present?
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 22, 2022
1 parent 85a8995 commit 8373f88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/pact_broker/string_refinements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module StringRefinements
def blank?
true
end

def present?
false
end
end

refine Numeric do
Expand All @@ -13,6 +17,10 @@ def blank?
end

refine String do
def present?
!blank?
end

def not_blank?
!blank?
end
Expand Down
4 changes: 3 additions & 1 deletion lib/pact_broker/ui/controllers/index.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/view_models/index_items"
require "pact_broker/string_refinements"
require "haml"

module PactBroker
module UI
module Controllers
class Index < Base
include PactBroker::Services
using PactBroker::StringRefinements

get "/" do
set_headers
Expand All @@ -27,7 +29,7 @@ class Index < Base

index_items = index_service.find_index_items(options)

if index_items.blank? && !search.blank?
if index_items.empty? && !search.blank?
error_messages << "No pacticipants found matching: \"#{search}\""
end

Expand Down

0 comments on commit 8373f88

Please sign in to comment.