diff --git a/.travis.yml b/.travis.yml index 9633cc4d3..3c1abcf4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,6 @@ install: script: - bundle exec rails db:create db:schema:load webpacker:compile - bin/knapsack_pro_rspec - - '[ ! -f .approvals ] || bundle exec approvals verify --ask false' notifications: slack: if: branch = master diff --git a/Gemfile b/Gemfile index c05f5c58e..c2d730649 100644 --- a/Gemfile +++ b/Gemfile @@ -159,7 +159,6 @@ group :development, :test do end group :test do - gem "approvals", "~> 0.0" # A library to make it easier to do golden-master style testing in Ruby gem "exifr", ">= 1.3.6" # EXIF Reader is a module to read EXIF from JPEG and TIFF images gem "factory_bot_rails", "~> 6.1" # factory_bot is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies gem "launchy", "~> 2.5" # Launchy is helper class for launching cross-platform applications in a fire and forget manner. diff --git a/Gemfile.lock b/Gemfile.lock index 445593767..6e43775da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,9 +111,6 @@ GEM activerecord (>= 4.2.0) anyway_config (2.1.0) ruby-next-core (>= 0.11.0) - approvals (0.0.24) - nokogiri (~> 1.6) - thor (~> 0.18) ast (2.4.2) aws-eventstream (1.1.1) aws-sigv4 (1.2.3) @@ -886,7 +883,6 @@ DEPENDENCIES ahoy_matey (~> 3.2) amazing_print (~> 1.3) ancestry (~> 3.2) - approvals (~> 0.0) better_errors (~> 2.9) binding_of_caller (~> 0.8) blazer (~> 2.4.2) diff --git a/docs/tests/approvals-tests.md b/docs/tests/approvals-tests.md deleted file mode 100644 index f458a71ee..000000000 --- a/docs/tests/approvals-tests.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Approvals Tests ---- - -# Approvals Tests - -Approvals test is a form of unit test. It works by taking a snapshot of the -results and confirming that they have not changed. A good use-case for the -Approvals tests is to compare the rendered HTML to the test specified HTML. - -## Usage - -Simply create your test similar to the following: - -```ruby -it "renders the correct HTML on the home page" do - page = '

ZOMG

' - verify(format: :html) { page } # format can also be :json -end -``` - -You may then run the said test and a new `*.received.*` file will be created. -Thereafter, run the following command to verify the newly created file and -approve the created change. - -```shell -approvals verify -``` - -Please be sure to include the Approvals file in your commit. - -## Edge cases - -Approvals tests are difficult to utilise for testing variables that change. This -includes variables like: - -- Time -- URL slug -- uploaded image slug - -Please avoid generating large approvals files as it will be stored in the -codebase. If your approvals file gets too large, Approvals test may not be the -right tool for the job. diff --git a/docs/tests/readme.md b/docs/tests/readme.md index 962663737..43337f47e 100644 --- a/docs/tests/readme.md +++ b/docs/tests/readme.md @@ -2,7 +2,6 @@ title: Testing/QA Guide items: - acceptance-tests.md - - approvals-tests.md - integration-tests.md - unit-functional-tests.md - frontend-tests.md diff --git a/spec/fixtures/approvals/katextag/render/generates_katex_output.approved.html b/spec/fixtures/approvals/katextag/render/generates_katex_output.approved.html deleted file mode 100644 index de3d7d542..000000000 --- a/spec/fixtures/approvals/katextag/render/generates_katex_output.approved.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -
- c=±a2+b2c = \pm\sqrt{a^2 + b^2} -
- - diff --git a/spec/fixtures/approvals/parlertag/id/accepts_a_valid_parler_url.approved.html b/spec/fixtures/approvals/parlertag/id/accepts_a_valid_parler_url.approved.html deleted file mode 100644 index 9e1c5aad4..000000000 --- a/spec/fixtures/approvals/parlertag/id/accepts_a_valid_parler_url.approved.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/spec/liquid_tags/codepen_tag_spec.rb b/spec/liquid_tags/codepen_tag_spec.rb index 5a01c1455..ff1b49af2 100644 --- a/spec/liquid_tags/codepen_tag_spec.rb +++ b/spec/liquid_tags/codepen_tag_spec.rb @@ -19,8 +19,11 @@ RSpec.describe CodepenTag, type: :liquid_tag do it "accepts codepen link" do liquid = generate_new_liquid(codepen_link) - rendered_codepen_iframe = liquid.render - Approvals.verify(rendered_codepen_iframe, name: "codepen_liquid_tag", format: :html) + + expect(liquid.render).to include("Click to see the answer!') # rubocop:disable Style/StringLiterals end end end diff --git a/spec/liquid_tags/dotnet_fiddle_tag_spec.rb b/spec/liquid_tags/dotnet_fiddle_tag_spec.rb index 12341d754..98471dfce 100644 --- a/spec/liquid_tags/dotnet_fiddle_tag_spec.rb +++ b/spec/liquid_tags/dotnet_fiddle_tag_spec.rb @@ -17,8 +17,9 @@ RSpec.describe DotnetFiddleTag, type: :liquid_tag do it "accepts dotnet link" do liquid = generate_new_liquid(dotnetfiddle_link) - rendered_dotnet_iframe = liquid.render - Approvals.verify(rendered_dotnet_iframe, name: "dotnetfiddle_liquid_tag", format: :html) + + expect(liquid.render).to include("') + # rubocop:enable Style/StringLiterals end it "rejects invalid ids" do diff --git a/spec/liquid_tags/js_fiddle_tag_spec.rb b/spec/liquid_tags/js_fiddle_tag_spec.rb index 94ae506c0..b3cd67c68 100644 --- a/spec/liquid_tags/js_fiddle_tag_spec.rb +++ b/spec/liquid_tags/js_fiddle_tag_spec.rb @@ -18,8 +18,11 @@ RSpec.describe JsFiddleTag, type: :liquid_tag do it "accepts jsfiddle link" do liquid = generate_new_liquid(jsfiddle_link) - rendered_jsfiddle_iframe = liquid.render - Approvals.verify(rendered_jsfiddle_iframe, name: "jsfiddle_liquid_tag", format: :html) + + # rubocop:disable Style/StringLiterals + expect(liquid.render).to include('