Skip to content

Commit

Permalink
fix: ensure blank? method is defined where used
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 8, 2022
1 parent 87966a7 commit b81b5e9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions lib/pact_broker/api/middleware/basic_auth.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
require "rack"
require "pact_broker/hash_refinements"
require "pact_broker/string_refinements"

module PactBroker
module Api
module Middleware
class BasicAuth
using PactBroker::HashRefinements
using PactBroker::StringRefinements

def initialize(app, write_credentials, read_credentials, policy)
@app = app
Expand Down
2 changes: 2 additions & 0 deletions lib/pact_broker/index/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
require "pact_broker/repositories/helpers"
require "pact_broker/index/page"
require "pact_broker/verifications/latest_verification_for_consumer_version_tag"
require "pact_broker/string_refinements"

module PactBroker
module Index
class Service
extend PactBroker::Repositories
extend PactBroker::Services
extend PactBroker::Logging
using PactBroker::StringRefinements

DEFAULT_PAGE_SIZE = 30
DEFAULT_PAGE_NUMBER = 1
Expand Down
1 change: 1 addition & 0 deletions lib/pact_broker/ui/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "pact_broker/ui/controllers/can_i_deploy"
require "pact_broker/ui/controllers/error_test"
require "pact_broker/ui/controllers/dashboard"
require "pact_broker/ui/helpers/haml_helpers"
require "pact_broker/doc/controllers/app"

module PactBroker
Expand Down
10 changes: 10 additions & 0 deletions lib/pact_broker/ui/helpers/haml_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "haml"
require "pact_broker/string_refinements"

module Haml::Helpers
using PactBroker::StringRefinements

def blank?(thing)
thing.blank?
end
end
7 changes: 3 additions & 4 deletions lib/pact_broker/ui/views/dashboard/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
= provider_name
- unless errors.blank?
- errors.each do | error |
%div.alert.alert-danger
= error
- errors.each do | error |
%div.alert.alert-danger
= error
- if consumer && provider
%form
Expand Down
9 changes: 4 additions & 5 deletions lib/pact_broker/ui/views/index/show-with-tags.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
!= render :haml, :'index/_css_and_js', :layout => false
.container
!= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false, base_url: base_url}
- if index_items.empty? && search.blank?
- if index_items.empty? && blank?(search)
!= render :haml, :'index/_getting-started', :layout => false
%h1.page-header
Pacts

- unless errors.blank?
- errors.each do | error |
%div.alert.alert-danger
= error
- errors.each do | error |
%div.alert.alert-danger
= error

%form{action: "#{base_url}"}
.field
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/views/index/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!= render :haml, :'index/_css_and_js', :layout => false
.container
!= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: true, base_url: base_url}
- if index_items.empty? && search.blank?
- if index_items.empty? && blank?(search)
!= render :haml, :'index/_getting-started', :layout => false
%h1.page-header
Pacts
Expand Down

0 comments on commit b81b5e9

Please sign in to comment.