Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d7cda2
commit a775c80
Showing
2 changed files
with
57 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require File.dirname(__FILE__) + '/../../test_helper' | ||
|
||
NS=RadiaSource::LightWeight | ||
|
||
class OrginalTest < ActiveSupport::TestCase | ||
fixtures :programs, :structure_templates | ||
|
||
|
||
def test_proxy_methods | ||
assert NS::Original.instance_methods.include? "program" | ||
assert NS::Original.instance_methods.include? "program=" | ||
assert NS::Original.instance_methods.include? "structure_template" | ||
assert NS::Original.instance_methods.include? "structure_template=" | ||
end | ||
|
||
def test_save | ||
t = Time.now | ||
original = NS::Original.new :dtstart => t, :dtend => t + 30.minutes, | ||
:program => Program.first,:structure_template => StructureTemplate.first | ||
|
||
assert original.save | ||
|
||
o2 = Original.find original.po.id | ||
|
||
assert_equal o2.program, original.program | ||
end | ||
|
||
def test_similar? | ||
orig1 = NS::Original.new_from_persistent_object Original.first | ||
orig2 = NS::Original.new_from_persistent_object Original.first | ||
|
||
assert orig1.similar?(orig2) | ||
|
||
# I expect at least 2 structure templates from fixtures!!! | ||
orig2.structure_template = StructureTemplate.last | ||
|
||
assert_not_equal orig1.structure_template, orig2.structure_template | ||
assert !orig1.similar?(orig2) | ||
end | ||
end | ||
|