Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1427 from KPB-US/additional-tests
Additional tests
- Loading branch information
Showing
10 changed files
with
202 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'test_helper' | ||
|
||
# these are not reported in the simplecov report as covered | ||
class CommandCheckTest < ActiveSupport::TestCase | ||
test 'which should find ruby' do | ||
assert which('ruby').present? | ||
end | ||
|
||
test 'command? should find ruby' do | ||
assert command?('ruby') | ||
end | ||
|
||
test 'command? should not find bogus file' do | ||
assert_not command?('completelybogusfile123') | ||
end | ||
|
||
test 'system should have mysql' do | ||
assert system_has_mysql? && mysql_location.present? | ||
end | ||
|
||
test 'system should have postgres' do | ||
assert system_has_postgres? && postgres_location.present? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'test_helper' | ||
|
||
class FrontendContentOrderTest < ActiveSupport::TestCase | ||
test 'default shuffler is BaseShuffle' do | ||
s = FrontendContentOrder.load_shuffler | ||
assert_equal BaseShuffle, s | ||
end | ||
|
||
test 'invalid shuffler results in default shuffler' do | ||
s = FrontendContentOrder.load_shuffler('BogusShuFFlerz') | ||
assert_equal BaseShuffle, s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'test_helper' | ||
|
||
class MacAddrTest < ActiveSupport::TestCase | ||
test 'to_i' do | ||
assert_equal 1829701878732, MacAddr.to_i('01:AA:02:BB:03:CC') | ||
end | ||
|
||
test 'to_hex' do | ||
assert_equal '01:aa:02:bb:03:cc', MacAddr.to_hex(1829701878732) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
require 'test_helper' | ||
|
||
class VersionCheckTest < ActiveSupport::TestCase | ||
test 'should return nil' do | ||
assert true | ||
test 'STRING should match pattern' do | ||
assert /[0-9].[0-9].[0-9]/ =~ Concerto::VERSION::STRING | ||
end | ||
|
||
test 'dynamic should match pattern' do | ||
Rails.cache.delete('VERSION::dynamic') | ||
assert /[0-9].[0-9].[0-9]-[0-9]{1,3}-[0-9a-z]+/ =~ Concerto::VERSION.dynamic | ||
end | ||
|
||
test 'version check latest version should match pattern' do | ||
Rails.cache.delete('concerto_version') | ||
Rails.cache.delete('concerto_version_time') | ||
v = VersionCheck.latest_version | ||
assert /[0-9].[0-9].[0-9]/ =~ v, 'latest_verison does not match expected format' | ||
|
||
assert v == VersionCheck.latest_version, 'latest_version is not cached' | ||
end | ||
|
||
test 'latest version is cached for 24 hours' do | ||
Rails.cache.write('concerto_version', '1') | ||
Rails.cache.write('concerto_version_time', Time.now - 86300) | ||
v = VersionCheck.latest_version | ||
assert_equal '1', v | ||
|
||
Rails.cache.write('concerto_version_time', Time.now - 86500) | ||
v = VersionCheck.latest_version | ||
assert_not_equal '1', v | ||
end | ||
end |