test/unit/test_alias.rb in spontaneous-0.2.0.beta5 vs test/unit/test_alias.rb in spontaneous-0.2.0.beta6
- old
+ new
@@ -319,22 +319,27 @@
it "provide access to their target" do
@a_alias.target.must_equal a
end
- # TODO
- it "reference the aliases fields before the targets"
-
it "present their target's fields as their own" do
assert @a_alias.field?(:a_field1)
@a_alias.a_field1.value.must_equal a.a_field1.value
end
it "have access to their target's fields" do
@a_alias.target.a_field1.value.must_equal a.a_field1.value
end
+ it "provide transparent access target's fields" do
+ @a_alias.a_field1.value.must_equal a.a_field1.value
+ end
+
+ it "provide transparent access target's fields with hash notation" do
+ @a_alias.fields[:a_field1].value.must_equal a.a_field1.value
+ end
+
it "have their own styles" do
assert_correct_template(@a_alias, template_root / 'a_alias/a_alias_style', renderer)
end
it "present their target's styles as their own" do
@@ -473,9 +478,21 @@
b.save
al.reload
bl.reload
al.path.must_equal "/aliases/newb"
bl.path.must_equal "/aliases/newb/newb"
+ end
+
+ it "include target values in serialisation" do
+ al = BAlias.create(:target => b)
+ al.export[:target].must_equal b.shallow_export(nil)
+ end
+
+ it "include target values in entry serialisation" do
+ al = BAlias.create(:target => b)
+ aliases.box1 << al
+ aliases.save
+ al.entry.export[:target].must_equal b.shallow_export(nil)
end
it "update their path if their parent's path changes" do
al = BAlias.create(:target => b, :slug => "balias")
bl = BAlias.create(:target => b, :slug => "balias")