simpex 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/simpex/type.rb +5 -2
- data/lib/simpex/version.rb +1 -1
- data/test/test_type.rb +14 -1
- metadata +2 -2
data/lib/simpex/type.rb
CHANGED
@@ -23,8 +23,11 @@ class Type
|
|
23
23
|
else
|
24
24
|
@attributes << attribute
|
25
25
|
if attribute =~ /^\$/
|
26
|
-
if @macros.empty?
|
27
|
-
raise ArgumentError.new "
|
26
|
+
if @macros.empty?
|
27
|
+
raise ArgumentError.new "In the type '#{name}', you are using a macro but no macros are given at all, pass the macros as an array to the type constructor."
|
28
|
+
end
|
29
|
+
if @macros.none?{|m| m.split("=").first == attribute.split("[").first}
|
30
|
+
raise ArgumentError.new "In the type #{name}, you are using a macro that is not defined: #{attribute}, declared macros are #{@macros.inspect}"
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|
data/lib/simpex/version.rb
CHANGED
data/test/test_type.rb
CHANGED
@@ -43,10 +43,23 @@ class TestType < Test::Unit::TestCase
|
|
43
43
|
Type.new("Product", %w{code[unique=true] name[lang=en] name[lang=de] unit(code) $catalogVersion supercategories(code)})
|
44
44
|
end
|
45
45
|
|
46
|
-
macros = ["$catalogVersion=adsfasdfasdf"]
|
46
|
+
macros = ["$catalogVersion=adsfasdfasdf", "$contentCV=someValue"]
|
47
|
+
Type.new("MediaReference", %w{uid[unique=true] name referencedDamMedia(code,$contentCV)[lang=$lang] altText[lang=$lang] $contentCV[unique=true]}, macros)
|
47
48
|
Type.new("Product", %w{code[unique=true] name[lang=en] name[lang=de] unit(code) $catalogVersion[unique=true] supercategories(code)}, macros)
|
48
49
|
end
|
49
50
|
|
51
|
+
def test_type_should_validate_the_presence_of_macros_if_no_macros_are_given
|
52
|
+
assert_raises ArgumentError do
|
53
|
+
Type.new("Product", %w{code[unique=true] name[lang=en] name[lang=de] unit(code) $catalogVersion supercategories(code)})
|
54
|
+
end
|
55
|
+
assert_raises ArgumentError do
|
56
|
+
macros = ["$catalogVersion=adsfasdfasdf"]
|
57
|
+
Type.new("Product", %w{code[unique=true] name[lang=en] name[lang=de] unit(code) $catalogVe[unique=true] supercategories(code)}, macros)
|
58
|
+
end
|
59
|
+
macros = ["$catalogVe=adsfasdfasdf"]
|
60
|
+
Type.new("Product", %w{code[unique=true] name[lang=en] name[lang=de] unit(code) $catalogVe[unique=true] supercategories(code)}, macros)
|
61
|
+
end
|
62
|
+
|
50
63
|
def test_shoud_add_an_after_each_statement
|
51
64
|
bash_script = "#%afterEach: "
|
52
65
|
after_each = "impex.getLastImportedItem().setApprovalStatus(impex.getLastImportedItem().getBaseProduct().getApprovalStatus());"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-10 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Read more details at the homepage https://github.com/denislutz/simpex
|
15
15
|
email:
|