diff --git a/app/models/raw_html_block.rb b/app/models/raw_html_block.rb index 905e5aa..a2fd9c6 100644 --- a/app/models/raw_html_block.rb +++ b/app/models/raw_html_block.rb @@ -20,4 +20,12 @@ class RawHTMLBlock < Block user.has_permission?('edit_raw_html_block', environment) end + def api_content + { html: html } + end + + def display_api_content_by_default? + true + end + end diff --git a/test/api/blocks_test.rb b/test/api/blocks_test.rb index fc9388e..6aa4835 100644 --- a/test/api/blocks_test.rb +++ b/test/api/blocks_test.rb @@ -83,4 +83,15 @@ class BlocksTest < ActiveSupport::TestCase json = JSON.parse(last_response.body) assert_equal "test", json["block"]["api_content"]["some_content"]["name"] end + + should 'display api content of raw html block' do + box = fast_create(Box, :owner_id => environment.id, :owner_type => Environment.name) + block = fast_create(RawHTMLBlock, box_id: box.id) + block.html = '