Skip to content
Snippets Groups Projects
Commit 842efbba authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix some stuff

parent caa6c3ba
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,8 @@ Rails.application.configure do
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.active_record.verify_foreign_keys_for_fixtures = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
......
......@@ -48,4 +48,3 @@ test_post_2:
slug: test-2
published: true
published_at: 2010-11-28 00:00:00
text: new content
......@@ -28,12 +28,14 @@
one:
university: default_university
school: default_school
program: one
academic_year: one
name: MyString
two:
university: default_university
school: default_school
program: two
academic_year: two
name: MyString
default_school:
name: École de test
university: default_university
\ No newline at end of file
require "test_helper"
class SummernoteTest < ActiveSupport::TestCase
HTML_HYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"><figure class=\"attachment attachment--preview\">\n <img width=\"588\" height=\"746\" src=\"http://localhost:3000/dan-gold.jpeg\">\n</figure></action-text-attachment>\n"
HTML_DEHYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"></action-text-attachment>"
test "dehydrate actiontext" do
post = communication_website_posts(:test_post)
post.text = HTML_HYDRATED
post.save
post.reload
assert_equal HTML_DEHYDRATED, post.text_before_type_cast
end
test "rehydrate actiontext" do
post = communication_website_posts(:test_post)
post.text = HTML_DEHYDRATED
post.save
post.reload
assert_equal HTML_HYDRATED, communication_website_posts(:test_post).text.to_s
end
end
......@@ -437,7 +437,13 @@ class VariantServiceTest < ActiveSupport::TestCase
private
def create_file_blob(key: nil, filename: "dan-gold.jpeg", content_type: "image/jpeg", metadata: nil, service_name: nil, record: nil)
ActiveStorage::Blob.create_and_upload! io: file_fixture(filename).open, filename: filename, content_type: content_type, metadata: metadata, service_name: service_name, record: record
ActiveStorage::Blob.create_and_upload! io: file_fixture(filename).open,
filename: filename,
content_type: content_type,
metadata: metadata,
service_name: service_name,
record: record,
university_id: universities(:default_university).id
end
def read_image(blob_or_variant)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment