From 42923c4e04a3701468c97caa22bd459205b07694 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 13 May 2021 19:41:39 -0300 Subject: [PATCH] sitios de testeo --- .../site_with_relationships/README.md | 2 ++ .../site_with_relationships/_config.yml | 2 ++ .../_data/layouts/author.yml | 9 ++++++++ .../_data/layouts/post.yml | 23 +++++++++++++++++++ .../site_with_relationships/_en/.keep | 0 test/fixtures/site_with_relationships/_posts | 1 + test/models/metadata_test.rb | 19 +++++++++++++++ 7 files changed, 56 insertions(+) create mode 100644 test/fixtures/site_with_relationships/README.md create mode 100644 test/fixtures/site_with_relationships/_config.yml create mode 100644 test/fixtures/site_with_relationships/_data/layouts/author.yml create mode 100644 test/fixtures/site_with_relationships/_data/layouts/post.yml create mode 100644 test/fixtures/site_with_relationships/_en/.keep create mode 120000 test/fixtures/site_with_relationships/_posts create mode 100644 test/models/metadata_test.rb diff --git a/test/fixtures/site_with_relationships/README.md b/test/fixtures/site_with_relationships/README.md new file mode 100644 index 00000000..89b5b892 --- /dev/null +++ b/test/fixtures/site_with_relationships/README.md @@ -0,0 +1,2 @@ +This is site where posts can have many authors and viceversa and posts +can be replies to others. diff --git a/test/fixtures/site_with_relationships/_config.yml b/test/fixtures/site_with_relationships/_config.yml new file mode 100644 index 00000000..da2d25c8 --- /dev/null +++ b/test/fixtures/site_with_relationships/_config.yml @@ -0,0 +1,2 @@ +locales: +- en diff --git a/test/fixtures/site_with_relationships/_data/layouts/author.yml b/test/fixtures/site_with_relationships/_data/layouts/author.yml new file mode 100644 index 00000000..afe620e2 --- /dev/null +++ b/test/fixtures/site_with_relationships/_data/layouts/author.yml @@ -0,0 +1,9 @@ +--- +title: + type: 'string' + required: true +posts: + type: 'has_and_belongs_to_many' + inverse: 'authors' + filter: + layout: 'post' diff --git a/test/fixtures/site_with_relationships/_data/layouts/post.yml b/test/fixtures/site_with_relationships/_data/layouts/post.yml new file mode 100644 index 00000000..c98baf7d --- /dev/null +++ b/test/fixtures/site_with_relationships/_data/layouts/post.yml @@ -0,0 +1,23 @@ +--- +title: + type: 'string' + required: true +authors: + type: 'has_and_belongs_to_many' + inverse: 'posts' + filter: + layout: 'author' +posts: + type: 'has_many' + inverse: 'in_reply_to' + filter: + layout: 'post' +in_reply_to: + type: 'belongs_to' + inverse: 'posts' + filter: + layout: 'post' +recommended_posts: + type: 'related_posts' + filter: + layout: 'post' diff --git a/test/fixtures/site_with_relationships/_en/.keep b/test/fixtures/site_with_relationships/_en/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/site_with_relationships/_posts b/test/fixtures/site_with_relationships/_posts new file mode 120000 index 00000000..3da1d67b --- /dev/null +++ b/test/fixtures/site_with_relationships/_posts @@ -0,0 +1 @@ +_en \ No newline at end of file diff --git a/test/models/metadata_test.rb b/test/models/metadata_test.rb new file mode 100644 index 00000000..24d955ae --- /dev/null +++ b/test/models/metadata_test.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module MetadataTest + extend ActiveSupport::Concern + + included do + setup do + name = SecureRandom.hex + # TODO: Poder cambiar el nombre + FileUtils.cp_r(Rails.root.join('test', 'fixtures', 'site_with_relationships'), Rails.root.join('_sites', name)) + + @site = create :site, name: name + end + + teardown do + @site&.destroy + end + end +end