forked from SpinaCMS/Spina
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add content method test in model structure_item and refactor
- Loading branch information
Showing
6 changed files
with
42 additions
and
2 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,2 @@ | ||
line_1: | ||
content: line_content_1 |
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,5 @@ | ||
structure_item_1: | ||
structure_id: <%= ActiveRecord::FixtureSet.identify(:structure_1) %> | ||
|
||
structure_item_2: | ||
structure_id: <%= ActiveRecord::FixtureSet.identify(:structure_2) %> |
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,5 @@ | ||
structure_part_1: | ||
structure_item_id: <%= ActiveRecord::FixtureSet.identify(:structure_item_1) %> | ||
structure_partable_id: <%= ActiveRecord::FixtureSet.identify(:line_1) %> | ||
structure_partable_type: Spina::Line | ||
name: name_1 |
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,5 @@ | ||
structure_1: | ||
id: 1 | ||
|
||
structure_2: | ||
id: 2 |
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,24 @@ | ||
require 'test_helper' | ||
|
||
module Spina | ||
class StructureItemTest < ActiveSupport::TestCase | ||
|
||
def setup | ||
@structure_1 = spina_structures(:structure_1) | ||
|
||
@structure_item_1 = spina_structure_items(:structure_item_1) | ||
@structure_item_2 = spina_structure_items(:structure_item_2) | ||
|
||
@structure_part_1 = spina_structure_parts(:structure_part_1) | ||
end | ||
|
||
test 'structure_item_1 content' do | ||
assert_equal 'line_content_1', @structure_item_1.content(@structure_part_1.name) | ||
end | ||
|
||
test 'structure_item_2 content' do | ||
assert_equal nil, @structure_item_2.content(@structure_part_1.name) | ||
end | ||
|
||
end | ||
end |