-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polishing up template importing a bit. Now handled in the model, with…
… a simple test. Could use some more work, but I'm marking this complete for now. [#110 state:resolved]
- Loading branch information
Showing
4 changed files
with
78 additions
and
28 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
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,16 @@ | ||
<?xml version="1.0"?> | ||
<template> | ||
<name>Sample Template</name> | ||
<width>1920</width> | ||
<height>1080</height> | ||
<author>Testing Author</author> | ||
<field> | ||
<name>Graphics</name> | ||
<type>Graphics</type> | ||
<style>border:solid 2px #ccc;</style> | ||
<left>0.025</left> | ||
<top>0.026</top> | ||
<width>0.567</width> | ||
<height>0.77</height> | ||
</field> | ||
</template> |
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
require 'test_helper' | ||
|
||
class TemplateTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
# Test the ability to import a simple xml descriptor | ||
test "importing a simple template" do | ||
t = Template.new | ||
file = fixture_file_upload("/files/simple_template.xml", 'text/xml') | ||
assert t.import_xml(file.read) | ||
end | ||
end |
If you're curious (and for my own memory later) this line is important. If the XML just contains one it won't get turned into an array, just another hash. This fixes that problem and ensures we have an array.