Skip to content

Instantly share code, notes, and snippets.

@peakpg
Last active December 15, 2015 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peakpg/5254600 to your computer and use it in GitHub Desktop.
Save peakpg/5254600 to your computer and use it in GitHub Desktop.
How the Content API will behave in 4.0
# Case A
case_a = Cms::HtmlBlock.new(name: "Case A")
case_a.save
assert case_a.published? == true
# Case B
case_b = Cms::HtmlBlock.new(name: "Case B")
assert case_b.publish == false
assert case_b.persisted? == false
# Case C
case_c = Cms::HtmlBlock.new(name: "Case C")
case_c.save
case_c.publish # Unnecessary, returns false
assert case_c.versions.size == 1
assert case_c.published? == true
# Case D
case_d = Cms::HtmlBlock.create(name: "Case D", publish_on_save: false)
case_d.name = "Case D - Updated"
case_d.publish
assert case_d.versions.size == 1
assert case_d.name == "Case D"
assert case_d.changed? == true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment