mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-29 21:38:49 +01:00
get all unit tests running again. Seems we have some pretty old code in there :-)
This commit is contained in:
parent
e964769553
commit
fd4fb6df9e
19 changed files with 255 additions and 284 deletions
|
|
@ -11,3 +11,46 @@ class ActiveSupport::TestCase
|
|||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
|
||||
module Tracks
|
||||
class Config
|
||||
def self.salt
|
||||
"change-me"
|
||||
end
|
||||
def self.auth_schemes
|
||||
return ["database","open_id"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
|
||||
# Generates a random string of ascii characters (a-z, "1 0")
|
||||
# of a given length for testing assignment to fields
|
||||
# for validation purposes
|
||||
#
|
||||
def generate_random_string(length)
|
||||
string = ""
|
||||
characters = %w(a b c d e f g h i j k l m n o p q r s t u v w z y z 1\ 0)
|
||||
length.times do
|
||||
pick = characters[rand(26)]
|
||||
string << pick
|
||||
end
|
||||
return string
|
||||
end
|
||||
|
||||
def assert_equal_dmy(date1, date2)
|
||||
assert_equal date1.strftime("%d-%m-%y"), date2.strftime("%d-%m-%y")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Test::Unit::TestCase
|
||||
|
||||
def assert_value_changed(object, method = nil)
|
||||
initial_value = object.send(method)
|
||||
yield
|
||||
assert_not_equal initial_value, object.send(method), "#{object}##{method}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue