sitefuel 0.0.0b → 0.1.0a
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +81 -0
- data/{RELEASE_NOTES → RELEASE_NOTES.rdoc} +0 -0
- data/bin/sitefuel +64 -111
- data/lib/sitefuel/CommandLine.rb +142 -0
- data/lib/sitefuel/Configuration.rb +49 -13
- data/lib/sitefuel/License.rb +292 -0
- data/lib/sitefuel/SiteFuelLogger.rb +34 -5
- data/lib/sitefuel/SiteFuelRuntime.rb +217 -44
- data/lib/sitefuel/extensions/ArrayComparisons.rb +2 -2
- data/lib/sitefuel/extensions/ColumnPrinter.rb +276 -0
- data/lib/sitefuel/extensions/DynamicClassMethods.rb +2 -2
- data/lib/sitefuel/extensions/FileComparison.rb +2 -2
- data/lib/sitefuel/extensions/FileTree.rb +94 -0
- data/lib/sitefuel/extensions/Silently.rb +2 -2
- data/lib/sitefuel/extensions/StringFormatting.rb +52 -8
- data/lib/sitefuel/extensions/SymbolComparison.rb +4 -2
- data/lib/sitefuel/extensions/TerminalInfo.rb +53 -0
- data/lib/sitefuel/external/AbstractExternalProgram.rb +65 -11
- data/lib/sitefuel/external/ExternalProgramTestCase.rb +2 -2
- data/lib/sitefuel/external/GIT.rb +50 -3
- data/lib/sitefuel/external/JPEGTran.rb +2 -2
- data/lib/sitefuel/external/PNGCrush.rb +2 -2
- data/lib/sitefuel/external/SVN.rb +57 -0
- data/lib/sitefuel/processors/AbstractExternalProgramProcessor.rb +17 -4
- data/lib/sitefuel/processors/AbstractProcessor.rb +64 -47
- data/lib/sitefuel/processors/AbstractStringBasedProcessor.rb +20 -3
- data/lib/sitefuel/processors/CSSProcessor.rb +2 -2
- data/lib/sitefuel/processors/Configurable.rb +94 -0
- data/lib/sitefuel/processors/HAMLProcessor.rb +4 -4
- data/lib/sitefuel/processors/HTMLProcessor.rb +2 -2
- data/lib/sitefuel/processors/JavaScriptProcessor.rb +2 -2
- data/lib/sitefuel/processors/PHPProcessor.rb +2 -2
- data/lib/sitefuel/processors/PNGProcessor.rb +2 -2
- data/lib/sitefuel/processors/RHTMLProcessor.rb +2 -2
- data/lib/sitefuel/processors/SASSProcessor.rb +4 -4
- data/test/{test_images → images}/sample_jpg01.jpg +0 -0
- data/test/{test_images → images}/sample_png01.png +0 -0
- data/test/processor_listing.rb +2 -2
- data/test/{test_programs → programs}/versioning.rb +2 -2
- data/test/repositories/git/few_files/deployment.yml +0 -0
- data/test/repositories/git/few_files/index.html +10 -0
- data/test/repositories/git/few_files/style.css +2 -0
- data/test/repositories/svn/testrepo1/README.txt +5 -0
- data/test/repositories/svn/testrepo1/conf/authz +32 -0
- data/test/repositories/svn/testrepo1/conf/passwd +8 -0
- data/test/repositories/svn/testrepo1/conf/svnserve.conf +47 -0
- data/test/repositories/svn/testrepo1/db/current +1 -0
- data/test/repositories/svn/testrepo1/db/format +2 -0
- data/test/repositories/svn/testrepo1/db/fs-type +1 -0
- data/test/repositories/svn/testrepo1/db/fsfs.conf +37 -0
- data/test/repositories/svn/testrepo1/db/min-unpacked-rev +1 -0
- data/test/repositories/svn/testrepo1/db/rep-cache.db +0 -0
- data/test/repositories/svn/testrepo1/db/revprops/0/0 +5 -0
- data/test/repositories/svn/testrepo1/db/revprops/0/1 +13 -0
- data/test/repositories/svn/testrepo1/db/revs/0/0 +11 -0
- data/test/repositories/svn/testrepo1/db/revs/0/1 +0 -0
- data/test/repositories/svn/testrepo1/db/txn-current +1 -0
- data/test/repositories/svn/testrepo1/db/txn-current-lock +0 -0
- data/test/repositories/svn/testrepo1/db/uuid +1 -0
- data/test/repositories/svn/testrepo1/db/write-lock +0 -0
- data/test/repositories/svn/testrepo1/format +1 -0
- data/test/repositories/svn/testrepo1/hooks/post-commit.tmpl +50 -0
- data/test/repositories/svn/testrepo1/hooks/post-lock.tmpl +45 -0
- data/test/repositories/svn/testrepo1/hooks/post-revprop-change.tmpl +57 -0
- data/test/repositories/svn/testrepo1/hooks/post-unlock.tmpl +43 -0
- data/test/repositories/svn/testrepo1/hooks/pre-commit.tmpl +85 -0
- data/test/repositories/svn/testrepo1/hooks/pre-lock.tmpl +71 -0
- data/test/repositories/svn/testrepo1/hooks/pre-revprop-change.tmpl +66 -0
- data/test/repositories/svn/testrepo1/hooks/pre-unlock.tmpl +63 -0
- data/test/repositories/svn/testrepo1/hooks/start-commit.tmpl +68 -0
- data/test/repositories/svn/testrepo1/locks/db-logs.lock +3 -0
- data/test/repositories/svn/testrepo1/locks/db.lock +3 -0
- data/test/sites/simplehtml/deployment.yml +19 -0
- data/test/{test_sites → sites}/simplehtml/index.html +0 -0
- data/test/{test_sites → sites}/simplehtml/style.css +0 -0
- data/test/sites/sitefuelteaser/deployment.yml +13 -0
- data/test/sites/sitefuelteaser/img/hd.png +0 -0
- data/test/sites/sitefuelteaser/img/logo.png +0 -0
- data/test/sites/sitefuelteaser/img/uses-sitefuel.png +0 -0
- data/test/sites/sitefuelteaser/index.html +1 -1
- data/test/sites/sitefuelteaser/master.css +18 -0
- data/test/test_AbstractExternalProgram.rb +5 -5
- data/test/test_AbstractProcessor.rb +4 -4
- data/test/test_AbstractStringBasedProcessor.rb +2 -2
- data/test/test_AllProcessors.rb +4 -4
- data/test/test_ArrayComparisons.rb +4 -4
- data/test/test_CSSProcessor.rb +4 -4
- data/test/test_ColumnPrinter.rb +40 -0
- data/test/test_Configurable.rb +106 -0
- data/test/test_FileComparisons.rb +4 -4
- data/test/test_GIT.rb +41 -0
- data/test/{test_HAMLProcessor.rb.rb → test_HAMLProcessor.rb} +4 -4
- data/test/test_HTMLProcessor.rb +4 -4
- data/test/test_JPEGTran.rb +4 -4
- data/test/test_JavaScriptProcessor.rb +3 -2
- data/test/test_PHPProcessor.rb +4 -4
- data/test/test_PNGCrush.rb +8 -8
- data/test/test_PNGProcessor.rb +5 -5
- data/test/test_RHTMLProcessor.rb +4 -4
- data/test/test_SASSProcessor.rb +4 -4
- data/test/test_SVN.rb +44 -0
- data/test/test_SiteFuelLogging.rb +4 -4
- data/test/test_SiteFuelRuntime.rb +42 -4
- data/test/test_StringFormatting.rb +27 -4
- data/test/test_SymbolComparison.rb +4 -4
- data/test/ts_all.rb +2 -2
- metadata +94 -20
- data/README +0 -86
- data/test/test_sites/simplehtml/deployment.yml +0 -22
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# PRE-UNLOCK HOOK
|
4
|
+
#
|
5
|
+
# The pre-unlock hook is invoked before an exclusive lock is
|
6
|
+
# destroyed. Subversion runs this hook by invoking a program
|
7
|
+
# (script, executable, binary, etc.) named 'pre-unlock' (for which
|
8
|
+
# this file is a template), with the following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] PATH (the path in the repository about to be unlocked)
|
12
|
+
# [3] USER (the user destroying the lock)
|
13
|
+
# [4] TOKEN (the lock token to be destroyed)
|
14
|
+
# [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0)
|
15
|
+
#
|
16
|
+
# The default working directory for the invocation is undefined, so
|
17
|
+
# the program should set one explicitly if it cares.
|
18
|
+
#
|
19
|
+
# If the hook program exits with success, the lock is destroyed; but
|
20
|
+
# if it exits with failure (non-zero), the unlock action is aborted
|
21
|
+
# and STDERR is returned to the client.
|
22
|
+
|
23
|
+
# On a Unix system, the normal procedure is to have 'pre-unlock'
|
24
|
+
# invoke other programs to do the real work, though it may do the
|
25
|
+
# work itself too.
|
26
|
+
#
|
27
|
+
# Note that 'pre-unlock' must be executable by the user(s) who will
|
28
|
+
# invoke it (typically the user httpd runs as), and that user must
|
29
|
+
# have filesystem-level permission to access the repository.
|
30
|
+
#
|
31
|
+
# On a Windows system, you should name the hook program
|
32
|
+
# 'pre-unlock.bat' or 'pre-unlock.exe',
|
33
|
+
# but the basic idea is the same.
|
34
|
+
#
|
35
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
36
|
+
|
37
|
+
REPOS="$1"
|
38
|
+
PATH="$2"
|
39
|
+
USER="$3"
|
40
|
+
|
41
|
+
# If a lock is owned by a different person, don't allow it be broken.
|
42
|
+
# (Maybe this script could send email to the lock owner?)
|
43
|
+
|
44
|
+
SVNLOOK=/usr/bin/svnlook
|
45
|
+
GREP=/bin/grep
|
46
|
+
SED=/bin/sed
|
47
|
+
|
48
|
+
LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
|
49
|
+
$GREP '^Owner: ' | $SED 's/Owner: //'`
|
50
|
+
|
51
|
+
# If we get no result from svnlook, there's no lock, return success:
|
52
|
+
if [ "$LOCK_OWNER" = "" ]; then
|
53
|
+
exit 0
|
54
|
+
fi
|
55
|
+
|
56
|
+
# If the person unlocking matches the lock's owner, return success:
|
57
|
+
if [ "$LOCK_OWNER" = "$USER" ]; then
|
58
|
+
exit 0
|
59
|
+
fi
|
60
|
+
|
61
|
+
# Otherwise, we've got an owner mismatch, so return failure:
|
62
|
+
echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2
|
63
|
+
exit 1
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# START-COMMIT HOOK
|
4
|
+
#
|
5
|
+
# The start-commit hook is invoked before a Subversion txn is created
|
6
|
+
# in the process of doing a commit. Subversion runs this hook
|
7
|
+
# by invoking a program (script, executable, binary, etc.) named
|
8
|
+
# 'start-commit' (for which this file is a template)
|
9
|
+
# with the following ordered arguments:
|
10
|
+
#
|
11
|
+
# [1] REPOS-PATH (the path to this repository)
|
12
|
+
# [2] USER (the authenticated user attempting to commit)
|
13
|
+
# [3] CAPABILITIES (a colon-separated list of capabilities reported
|
14
|
+
# by the client; see note below)
|
15
|
+
#
|
16
|
+
# Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5
|
17
|
+
# clients will typically report at least the "mergeinfo" capability.
|
18
|
+
# If there are other capabilities, then the list is colon-separated,
|
19
|
+
# e.g.: "mergeinfo:some-other-capability" (the order is undefined).
|
20
|
+
#
|
21
|
+
# The list is self-reported by the client. Therefore, you should not
|
22
|
+
# make security assumptions based on the capabilities list, nor should
|
23
|
+
# you assume that clients reliably report every capability they have.
|
24
|
+
#
|
25
|
+
# The working directory for this hook program's invocation is undefined,
|
26
|
+
# so the program should set one explicitly if it cares.
|
27
|
+
#
|
28
|
+
# If the hook program exits with success, the commit continues; but
|
29
|
+
# if it exits with failure (non-zero), the commit is stopped before
|
30
|
+
# a Subversion txn is created, and STDERR is returned to the client.
|
31
|
+
#
|
32
|
+
# On a Unix system, the normal procedure is to have 'start-commit'
|
33
|
+
# invoke other programs to do the real work, though it may do the
|
34
|
+
# work itself too.
|
35
|
+
#
|
36
|
+
# Note that 'start-commit' must be executable by the user(s) who will
|
37
|
+
# invoke it (typically the user httpd runs as), and that user must
|
38
|
+
# have filesystem-level permission to access the repository.
|
39
|
+
#
|
40
|
+
# On a Windows system, you should name the hook program
|
41
|
+
# 'start-commit.bat' or 'start-commit.exe',
|
42
|
+
# but the basic idea is the same.
|
43
|
+
#
|
44
|
+
# The hook program typically does not inherit the environment of
|
45
|
+
# its parent process. For example, a common problem is for the
|
46
|
+
# PATH environment variable to not be set to its usual value, so
|
47
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
48
|
+
# If you're having unexpected problems with a hook program, the
|
49
|
+
# culprit may be unusual (or missing) environment variables.
|
50
|
+
#
|
51
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
52
|
+
# For more examples and pre-written hooks, see those in
|
53
|
+
# /usr/share/subversion/hook-scripts, and in the repository at
|
54
|
+
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
55
|
+
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
56
|
+
|
57
|
+
|
58
|
+
REPOS="$1"
|
59
|
+
USER="$2"
|
60
|
+
|
61
|
+
# Exit on all errors.
|
62
|
+
set -e
|
63
|
+
|
64
|
+
"$REPOS"/hooks/commit-allower.pl --repository "$REPOS" --user "$USER"
|
65
|
+
"$REPOS"/hooks/special-auth-check.py --user "$USER" --auth-level 3
|
66
|
+
|
67
|
+
# All checks passed, so allow the commit.
|
68
|
+
exit 0
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# deployment settings for the 'simplehtml' test site
|
2
|
+
HTML:
|
3
|
+
filtersets:
|
4
|
+
# this will fix up dashes, quotes, etc.
|
5
|
+
- beautifytext
|
6
|
+
|
7
|
+
# it's very important we crush the whitespace after
|
8
|
+
# beautifying
|
9
|
+
- whitespace
|
10
|
+
|
11
|
+
CSS:
|
12
|
+
filtersets:
|
13
|
+
# let's not do anything to the CSS
|
14
|
+
- ignore
|
15
|
+
|
16
|
+
PNG:
|
17
|
+
filters:
|
18
|
+
# try very hard to get smaller PNGs:
|
19
|
+
- brute
|
File without changes
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
-
->
|
@@ -0,0 +1,18 @@
|
|
1
|
+
body {
|
2
|
+
font-family: 'lucida grande','verdana',sans-serif;
|
3
|
+
text-align: center;
|
4
|
+
}
|
5
|
+
margin-top: 4em;
|
6
|
+
margin-top: 0;
|
7
|
+
}
|
8
|
+
font-size: 14pt;
|
9
|
+
}
|
10
|
+
color: #210;
|
11
|
+
background: #eee;
|
12
|
+
}
|
13
|
+
width: 40em;
|
14
|
+
line-height: 150%;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
border: 1px dotted #ccc;
|
18
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
|
-
# File::
|
3
|
-
# Author::
|
4
|
-
# Copyright::
|
5
|
-
# License::
|
2
|
+
# File:: test_AbstractExternalProgram.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
6
|
#
|
7
7
|
# Unit tests for the AbstractExternalProgram wrapper.
|
8
8
|
#
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
class TestProgramA < AbstractExternalProgram
|
33
33
|
def self.program_name
|
34
|
-
'./test/
|
34
|
+
'./test/programs/versioning.rb'
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.compatible_versions
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
|
-
# File::
|
3
|
-
# Author::
|
4
|
-
# Copyright::
|
5
|
-
# License::
|
2
|
+
# File:: test_AbstractProcessor.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
6
|
#
|
7
7
|
# Unit tests for the AbstractProcessor
|
8
8
|
#
|
data/test/test_AllProcessors.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
|
-
# File::
|
3
|
-
# Author::
|
4
|
-
# Copyright::
|
5
|
-
# License::
|
2
|
+
# File:: test_AllProcessors.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
6
|
#
|
7
7
|
# Programmatic tests run against all processors
|
8
8
|
#
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
|
-
# File::
|
3
|
-
# Author::
|
4
|
-
# Copyright::
|
5
|
-
# License::
|
2
|
+
# File:: test_ArrayComparisons.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
6
|
#
|
7
7
|
# Unit tests for the Array#ends_with? method.
|
8
8
|
#
|
data/test/test_CSSProcessor.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
|
-
# File::
|
3
|
-
# Author::
|
4
|
-
# Copyright::
|
5
|
-
# License::
|
2
|
+
# File:: test_CSSProcessor.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
6
|
#
|
7
7
|
# Unit tests for the CSSProcessor
|
8
8
|
#
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# File:: test_ColumnPrinter.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
|
+
#
|
7
|
+
# Unit tests for the ColumnPrinter
|
8
|
+
#
|
9
|
+
|
10
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
11
|
+
|
12
|
+
require 'test/unit'
|
13
|
+
require 'sitefuel/extensions/ColumnPrinter'
|
14
|
+
|
15
|
+
class TestColumnPrinter < Test::Unit::TestCase
|
16
|
+
|
17
|
+
def test_basic
|
18
|
+
p = ColumnPrinter.new([5, 10, 5], 30)
|
19
|
+
assert_equal(
|
20
|
+
" 1 2 3 ",
|
21
|
+
p.format_row(1, 2, 3)
|
22
|
+
)
|
23
|
+
assert_equal(
|
24
|
+
" 1... 48182 1... ",
|
25
|
+
p.format_row(123131, 48182, 123131)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_spanning
|
30
|
+
p = ColumnPrinter.new([10, :span, 20], 50)
|
31
|
+
assert_equal(
|
32
|
+
" PNG some text here value ",
|
33
|
+
p.format_row('PNG', 'some text here', 'value')
|
34
|
+
)
|
35
|
+
|
36
|
+
# the important thing is that it actually fits, however
|
37
|
+
assert p.format_row('PNG', 'some text here', 'value').length <= 50
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#
|
2
|
+
# File:: test_Configurable.rb
|
3
|
+
# Author:: wkm
|
4
|
+
# Copyright:: 2009, Zanoccio LLC.
|
5
|
+
# License:: GPL version 2.0 (see LICENSE.rb)
|
6
|
+
#
|
7
|
+
# Unit tests for the configurable-class abstraction
|
8
|
+
#
|
9
|
+
|
10
|
+
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
11
|
+
|
12
|
+
require 'test/unit'
|
13
|
+
require 'sitefuel/extensions/SymbolComparison'
|
14
|
+
require 'sitefuel/processors/Configurable'
|
15
|
+
|
16
|
+
include SiteFuel::Processor
|
17
|
+
|
18
|
+
class A
|
19
|
+
include Configurable
|
20
|
+
|
21
|
+
attr_accessor :size, :weight, :weight_unit
|
22
|
+
attr_accessor :pre_configured, :post_configured
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@pre_configured = false
|
26
|
+
@post_configured = false
|
27
|
+
end
|
28
|
+
|
29
|
+
def configure_size(size)
|
30
|
+
@size = size
|
31
|
+
end
|
32
|
+
|
33
|
+
def configure_weight(weight, unit = :inches)
|
34
|
+
@weight = weight
|
35
|
+
@weight_unit = unit
|
36
|
+
end
|
37
|
+
|
38
|
+
def pre_configuration
|
39
|
+
@pre_configured = true
|
40
|
+
end
|
41
|
+
|
42
|
+
def post_configuration
|
43
|
+
@post_configured = true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class TestConfigurable < Test::Unit::TestCase
|
48
|
+
def test_options
|
49
|
+
a = A.new
|
50
|
+
|
51
|
+
assert_equal [:size, :weight], a.configuration_options.sort
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_configuring
|
55
|
+
a = A.new
|
56
|
+
|
57
|
+
# test a config with no parameters
|
58
|
+
a = A.new
|
59
|
+
assert_nothing_raised { a.configure }
|
60
|
+
|
61
|
+
# specifically: ensure the pre and post configuration were still
|
62
|
+
# run
|
63
|
+
assert a.pre_configured
|
64
|
+
assert a.post_configured
|
65
|
+
|
66
|
+
|
67
|
+
# test a normal config
|
68
|
+
assert_nothing_raised { a.configure :size => 5 }
|
69
|
+
assert a.pre_configured
|
70
|
+
assert a.post_configured
|
71
|
+
assert_equal 5, a.size
|
72
|
+
|
73
|
+
|
74
|
+
# test a config with default value
|
75
|
+
assert_nothing_raised { a.configure :weight => 3.14 }
|
76
|
+
assert a.pre_configured
|
77
|
+
assert a.post_configured
|
78
|
+
assert_equal 3.14, a.weight
|
79
|
+
assert_equal :inches, a.weight_unit
|
80
|
+
|
81
|
+
|
82
|
+
# test two config options
|
83
|
+
assert_nothing_raised do
|
84
|
+
a.configure :size => 5,
|
85
|
+
:weight => 3.14
|
86
|
+
end
|
87
|
+
assert a.pre_configured
|
88
|
+
assert a.post_configured
|
89
|
+
assert_equal 5, a.size
|
90
|
+
assert_equal 3.14, a.weight
|
91
|
+
assert_equal :inches, a.weight_unit
|
92
|
+
|
93
|
+
|
94
|
+
# test two config options with multiple parameters
|
95
|
+
assert_nothing_raised do
|
96
|
+
a.configure :size => 5,
|
97
|
+
:weight => [3.14, :meters]
|
98
|
+
end
|
99
|
+
assert a.pre_configured
|
100
|
+
assert a.post_configured
|
101
|
+
assert_equal 5, a.size
|
102
|
+
assert_equal 3.14, a.weight
|
103
|
+
assert_equal :meters, a.weight_unit
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|