Skip to content

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aidewoode committed Oct 24, 2023
1 parent ae1a510 commit b0db322
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/black_candy/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ class BaseError < StandardError
def type
self.class.name.split("::").last
end

def message
super
end
end

class Forbidden < BaseError
Expand Down
8 changes: 8 additions & 0 deletions test/helpers/application_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ class ApplicationHelperTest < ActionView::TestCase
assert_equal "15:00", format_duration(900)
assert_equal "02:30:00", format_duration(9000)
end

test "empty alert tag" do
assert_includes empty_alert_tag, "No items"
assert_includes empty_alert_tag, "c-overlay"
assert_not_includes empty_alert_tag, "c-icon"
assert_includes empty_alert_tag(has_icon: true), "c-icon"
assert_not_includes empty_alert_tag(has_overlay: false), "c-overlay"
end
end
26 changes: 26 additions & 0 deletions test/lib/black_candy/errors_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require "test_helper"

class BlackCandy::ErrorsTest < ActiveSupport::TestCase
test "should get info from forbidden error" do
error = BlackCandy::Forbidden.new

assert_equal "Forbidden", error.type
assert_not_empty error.message
end

test "should get info from invalid credential error" do
error = BlackCandy::InvalidCredential.new

assert_equal "InvalidCredential", error.type
assert_not_empty error.message
end

test "should get info from duplicate playlist song error" do
error = BlackCandy::DuplicatePlaylistSong.new

assert_equal "DuplicatePlaylistSong", error.type
assert_not_empty error.message
end
end

0 comments on commit b0db322

Please sign in to comment.