Skip to content

Commit

Permalink
tests for appcast stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandwalker committed Jun 19, 2014
1 parent aa2bd83 commit 1828116
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/cask/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,29 @@ def caveats; <<-EOS.undent
end
end

describe "appcast stanza" do
it "allows appcasts to be specified" do
cask = Cask.load('with-appcast')
cask.appcast.to_s.must_match %r{^http}
end

it "prevents defining multiple appcasts" do
err = lambda {
invalid_cask = Cask.load('invalid/invalid-appcast-multiple')
}.must_raise(CaskInvalidError)
err.message.must_include "'appcast' stanza may only appear once"
end

it "refuses to load invalid appcast URLs" do
err = lambda {
invalid_cask = Cask.load('invalid/invalid-appcast-url')
}.must_raise(CaskInvalidError)
end

it "refuses to load if appcast :format is invalid" do
err = lambda {
invalid_cask = Cask.load('invalid/invalid-appcast-format')
}.must_raise(CaskInvalidError)
end
end
end
10 changes: 10 additions & 0 deletions test/support/Casks/invalid/invalid-appcast-format.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class InvalidAppcastFormat < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/invalid-appcast-format'
appcast 'http://example.com/appcast.xml',
:sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853',
:format => :no_such_format
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
version '1.2.3'
link 'Caffeine.app'
end
13 changes: 13 additions & 0 deletions test/support/Casks/invalid/invalid-appcast-multiple.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class InvalidAppcastMultiple < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/invalid-appcast-multiple'
appcast 'http://example.com/appcast1.xml',
:sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853',
:format => :sparkle
appcast 'http://example.com/appcast2.xml',
:sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853',
:format => :sparkle
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
version '1.2.3'
link 'Caffeine.app'
end
10 changes: 10 additions & 0 deletions test/support/Casks/invalid/invalid-appcast-url.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class InvalidAppcastUrl < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/invalid-appcast-url'
appcast 1,
:sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853',
:format => :sparkle
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
version '1.2.3'
link 'Caffeine.app'
end
10 changes: 10 additions & 0 deletions test/support/Casks/with-appcast.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class WithAppcast < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/with-appcast'
appcast 'http://example.com/appcast.xml',
:sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853',
:format => :sparkle
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
version '1.2.3'
link 'Caffeine.app'
end

0 comments on commit 1828116

Please sign in to comment.