lokalise_rails 0.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe LokaliseRails::TaskDefinition::Importer do
4
- describe '.download_files' do
5
- it 'returns a proper download URL' do
6
- expect(LokaliseRails).to receive(:project_id).and_return('189934715f57a162257d74.88352370')
7
- response = VCR.use_cassette('download_files') do
8
- described_class.download_files
9
- end
10
-
11
- expect(response['project_id']).to eq('189934715f57a162257d74.88352370')
12
- expect(response['bundle_url']).to include('s3-eu-west-1.amazonaws.com')
13
- end
14
- end
15
-
16
- describe '.import!' do
17
- it 'halts when the API key is not set' do
18
- expect(LokaliseRails).to receive(:api_token).and_return(nil)
19
- result = described_class.import!
20
- expect(result).to include('API token is not set')
21
- expect(count_translations).to eq(0)
22
- end
23
-
24
- it 'halts when the project_id is not set' do
25
- expect(LokaliseRails).to receive(:project_id).and_return(nil)
26
- result = described_class.import!
27
- expect(result).to include('Project ID is not set')
28
- expect(count_translations).to eq(0)
29
- end
30
- end
31
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FileUtils
4
- def mkdir_locales
5
- FileUtils.mkdir_p(LokaliseRails.locales_path) unless File.directory?(LokaliseRails.locales_path)
6
- end
7
-
8
- def rm_translation_files
9
- FileUtils.rm_rf locales_dir
10
- end
11
-
12
- def locales_dir
13
- Dir["#{LokaliseRails.locales_path}/*"]
14
- end
15
-
16
- def count_translations
17
- locales_dir.count { |file| File.file?(file) }
18
- end
19
-
20
- def remove_config
21
- FileUtils.remove_file config_file if File.file?(config_file)
22
- end
23
-
24
- def config_file
25
- "#{Rails.root}/config/lokalise_rails.rb"
26
- end
27
- end