Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1739] Allow loading fixture whithout interpreted the file as a temp…
…late Add loadModels params in fixture.tag to be compatible with master version
- Loading branch information
1 parent
3be799c
commit 8922b98
Showing
13 changed files
with
165 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
h2. Test - Data loader | ||
|
||
*==@Before public void setUp() { Fixtures.deleteAll();==* | ||
*==Fixtures.load("data.yml");}==* | ||
*==Fixtures.loadModels("data.yml");}==* | ||
Fixtures is used to initialise the datastore before running a unit test | ||
|
||
*==#{fixture delete:'all', load:'data.yml' /}==* | ||
*==#{fixture delete:'all', load:'data.yml' /}==* or *==#{fixture delete:'all', loadModels:'data.yml' /}==* | ||
*==#{selenium} ... #{/selenium}==* | ||
Same idea using a Selenium test | ||
Same idea using a Selenium test(@loadModels@ and @load@ parameters are synonyms). |
6 changes: 3 additions & 3 deletions
6
documentation/cheatsheets_ja/tests/ch24-TestDataloader.textile
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,9 +1,9 @@ | ||
h2. Test - Data loader | ||
|
||
*==@Before public void setUp() { Fixtures.deleteAll();==* | ||
*==Fixtures.load("data.yml");}==* | ||
*==Fixtures.loadModels("data.yml");}==* | ||
Fixtures はユニットテストを実行する前にデータストアを初期化するために使用します。 | ||
|
||
*==#{fixture delete:'all', load:'data.yml' /}==* | ||
*==#{fixture delete:'all', load:'data.yml' /}==* or *==#{fixture delete:'all', loadModels:'data.yml' /}==* | ||
*==#{selenium} ... #{/selenium}==* | ||
Selenium テストを使うときも同様に出来ます。 | ||
Selenium テストを使うときも同様に出来ます(@loadModels@ and @load@ parameters are synonyms).。 |
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
16 changes: 16 additions & 0 deletions
16
samples-and-tests/just-test-cases/app/controllers/Yamls.java
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 @@ | ||
package controllers; | ||
|
||
import models.YamlModel; | ||
|
||
import org.apache.commons.mail.EmailException; | ||
|
||
import play.mvc.*; | ||
|
||
public class Yamls extends Controller { | ||
|
||
public static void viewYamlModel(Long id) { | ||
YamlModel model = YamlModel.findById(id); | ||
renderText(model.name); | ||
} | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
samples-and-tests/just-test-cases/test/templates/fixtures/yaml1.test.html
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,7 @@ | ||
#{fixture delete:'all'/} | ||
#{fixture load:'yamlTestData.yml' /} | ||
|
||
#{selenium 'Test load file as a template'} | ||
open('@{Yamls.viewYamlModel(2)}') | ||
assertTextPresent('message.name.yamlModel2[]-Test') | ||
#{/selenium} |
7 changes: 7 additions & 0 deletions
7
samples-and-tests/just-test-cases/test/templates/fixtures/yaml2.test.html
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,7 @@ | ||
#{fixture delete:'all'/} | ||
#{fixture loadAsTemplate:false, load:'yamlTestData.yml' /} | ||
|
||
#{selenium 'Test load file not as a template'} | ||
open('@{Yamls.viewYamlModel(2)}') | ||
assertTextPresent('${'&{'message.name.yamlModel2'}[${toto}]-Test'.raw()}') | ||
#{/selenium} |
9 changes: 9 additions & 0 deletions
9
samples-and-tests/just-test-cases/test/templates/fixtures/yaml3.test.html
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,9 @@ | ||
#{fixture delete:'all'/} | ||
#{fixture loadAsTemplate:true, load:['yamlTestData.yml', 'yamlTestData2.yml'] /} | ||
|
||
#{selenium 'Test load multiple file not as template'} | ||
open('@{Yamls.viewYamlModel(2)}') | ||
assertTextPresent('message.name.yamlModel2[]-Test') | ||
open('@{Yamls.viewYamlModel(4)}') | ||
assertTextPresent('message.name.yamlModel4[]-Test') | ||
#{/selenium} |
9 changes: 9 additions & 0 deletions
9
samples-and-tests/just-test-cases/test/templates/fixtures/yaml4.test.html
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,9 @@ | ||
#{fixture delete:'all'/} | ||
#{fixture loadAsTemplate:false, load:['yamlTestData.yml', 'yamlTestData2.yml'] /} | ||
|
||
#{selenium 'Test load multiple file not as template'} | ||
open('@{Yamls.viewYamlModel(2)}') | ||
assertTextPresent('${'&{'message.name.yamlModel2'}[${toto}]-Test'.raw()}') | ||
open('@{Yamls.viewYamlModel(4)}') | ||
assertTextPresent('${'&{'message.name.yamlModel4'}[${toto}]-Test'.raw()}') | ||
#{/selenium} |
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,5 @@ | ||
YamlModel(ym4): | ||
id: 4 | ||
name: "&{'message.name.yamlModel4'}[${toto}]-Test" | ||
binaryData: !!binary VGhpcyBTdHJpbmcgaXMgc3RvcmVkIGluIHlhbWwgZmlsZSB1c2luZyBiYXNlNjQ= | ||
|