diff options
author | Rémy Coutable <remy@rymai.me> | 2019-03-12 20:20:46 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-03-19 10:46:22 +0300 |
commit | b789bfaeefd9838c33f13c028893424025ade1ad (patch) | |
tree | 3fcd3267fc58c5330ddc0a408b42fb2f34adaebd /lib/tasks | |
parent | 68aacd65ae3c53f3c1d2cf081adc89e3758c52de (diff) |
Simplify the JavaScriptFixturesHelpers module
- Only storing fixtures in one place
- This place changes whether we are in CE or EE
We discovered with @winh that only fixtures located under
spec/javascripts/fixtures are used, even in EE so there's no need to
clean/create fixtures in ee/spec/javascripts/fixtures.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/karma.rake | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/tasks/karma.rake b/lib/tasks/karma.rake index 53325d492d1..02987f2beef 100644 --- a/lib/tasks/karma.rake +++ b/lib/tasks/karma.rake @@ -1,13 +1,24 @@ unless Rails.env.production? namespace :karma do desc 'GitLab | Karma | Generate fixtures for JavaScript tests' - RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args| + task fixtures: ['karma:copy_emojis_from_public_folder', 'karma:rspec_fixtures'] + + desc 'GitLab | Karma | Generate fixtures using RSpec' + RSpec::Core::RakeTask.new(:rspec_fixtures, [:pattern]) do |t, args| args.with_defaults(pattern: '{spec,ee/spec}/javascripts/fixtures/*.rb') ENV['NO_KNAPSACK'] = 'true' t.pattern = args[:pattern] t.rspec_opts = '--format documentation' end + desc 'GitLab | Karma | Copy emojis file' + task :copy_emojis_from_public_folder do + # Copying the emojis.json from the public folder + fixture_file_name = Rails.root.join('spec/javascripts/fixtures/emojis/emojis.json') + FileUtils.mkdir_p(File.dirname(fixture_file_name)) + FileUtils.cp(Rails.root.join('public/-/emojis/1/emojis.json'), fixture_file_name) + end + desc 'GitLab | Karma | Run JavaScript tests' task tests: ['yarn:check'] do sh "yarn run karma" do |ok, res| |