From 934b69f10dee167f4684b04f2987d4848002a0f4 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 21 Feb 2022 17:21:43 +0100 Subject: [PATCH] test --- Gemfile | 1 + Gemfile.lock | 2 ++ test/fixtures/communication/website.yml | 12 ++++++++++-- test/fixtures/communication/website/post.yml | 6 +++--- test/fixtures/university.yml | 2 +- test/integration/summernote_test.rb | 12 ++++++------ test/services/git_repository_test.rb | 8 ++++++++ .../variant_service_test.rb | 0 test/support/vcr.rb | 7 +++++++ 9 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 test/services/git_repository_test.rb rename test/{integration => services}/variant_service_test.rb (100%) create mode 100644 test/support/vcr.rb diff --git a/Gemfile b/Gemfile index 4083cab26..349ecfe9a 100644 --- a/Gemfile +++ b/Gemfile @@ -54,6 +54,7 @@ gem 'summernote-rails', git: 'https://github.com/noesya/summernote-rails.git', b group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'figaro' + gem 'vcr' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 1b593fceb..61164d72d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -419,6 +419,7 @@ GEM unf_ext (0.0.8) unicode-display_width (2.1.0) unicode_utils (1.4.0) + vcr (6.0.0) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.0) @@ -490,6 +491,7 @@ DEPENDENCIES summernote-rails! two_factor_authentication! tzinfo-data + vcr web-console (>= 4.1.0) webdrivers diff --git a/test/fixtures/communication/website.yml b/test/fixtures/communication/website.yml index 5e9fc0457..28f828537 100644 --- a/test/fixtures/communication/website.yml +++ b/test/fixtures/communication/website.yml @@ -1,3 +1,11 @@ -test: - university: test +website_with_github: + university: default_university name: Site de test + git_provider: github + access_token: test + +website_with_gitlab: + university: default_university + name: Site with gitlab + git_provider: gitlab + access_token: test diff --git a/test/fixtures/communication/website/post.yml b/test/fixtures/communication/website/post.yml index acb62a96a..b723b9dfc 100644 --- a/test/fixtures/communication/website/post.yml +++ b/test/fixtures/communication/website/post.yml @@ -1,5 +1,5 @@ -test: - university: test - website: test +test_post: + university: default_university + website: website_with_github title: Test slug: test diff --git a/test/fixtures/university.yml b/test/fixtures/university.yml index 0ef3e762f..d5c83b987 100644 --- a/test/fixtures/university.yml +++ b/test/fixtures/university.yml @@ -1,2 +1,2 @@ -test: +default_university: name: Université de test diff --git a/test/integration/summernote_test.rb b/test/integration/summernote_test.rb index 43cef8518..7f70e6f73 100644 --- a/test/integration/summernote_test.rb +++ b/test/integration/summernote_test.rb @@ -5,18 +5,18 @@ class SummernoteTest < ActiveSupport::TestCase 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_post(:test) - post.text_new = HTML_HYDRATED + post = communication_website_post(:test_post) + post.text = HTML_HYDRATED post.save post.reload - assert_equal HTML_DEHYDRATED, post.text_new_before_type_cast + assert_equal HTML_DEHYDRATED, post.text_before_type_cast end test "rehydrate actiontext" do - post = communication_website_post(:test) - post.text_new = HTML_DEHYDRATED + post = communication_website_post(:test_post) + post.text = HTML_DEHYDRATED post.save post.reload - assert_equal HTML_HYDRATED, communication_website_post(:test).text_new.to_s + assert_equal HTML_HYDRATED, communication_website_post(:test_post).text.to_s end end diff --git a/test/services/git_repository_test.rb b/test/services/git_repository_test.rb new file mode 100644 index 000000000..629114341 --- /dev/null +++ b/test/services/git_repository_test.rb @@ -0,0 +1,8 @@ +require "test_helper" + +class GitRepositoryTest < ActiveSupport::TestCase + + test "params for dan-gold.jpeg" do + + end +end diff --git a/test/integration/variant_service_test.rb b/test/services/variant_service_test.rb similarity index 100% rename from test/integration/variant_service_test.rb rename to test/services/variant_service_test.rb diff --git a/test/support/vcr.rb b/test/support/vcr.rb new file mode 100644 index 000000000..883fcec27 --- /dev/null +++ b/test/support/vcr.rb @@ -0,0 +1,7 @@ +require 'vcr' + +VCR.configure do |c| + c.cassette_library_dir = 'test/cassettes' + c.hook_into :webmock + c.allow_http_connections_when_no_cassette = false +end -- GitLab