phrasing 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ac13135c189add2c1c995372d8afaff63863d697
4
- data.tar.gz: a2a0ac009155ff6a8438e1e086567ef326e08539
2
+ SHA256:
3
+ metadata.gz: 3fa80ff59b5b335272a27f88818c9b527182c7e91d367f4baeea71b680122372
4
+ data.tar.gz: dd0343b4dc10fdb3434251fb5f44124cc52b99fd0e6065391155a8072246f6ad
5
5
  SHA512:
6
- metadata.gz: 31618d8667c75fad47e5dc4cbe460af00dd8c48916f53831b8c2eea722795616e3dbf8d8c0f62bcf0b5d5a2ed4ee19df7d34f2f6302efedc8c22e78b0553a400
7
- data.tar.gz: c9f5575d6f24427aed3b837a0881129142eadae7d0a504c5bdc629183843b310c899fcacad487c974909ab308ba76cc4f53996bfff19fc3a70a0f4e75a4b8ca2
6
+ metadata.gz: eef3283f9cdf3dbda9a2de72e1628fac2403cb174e4a8ce64c5a9b7a45fa3ee4c5e68fe93bf3e52a92be2b190699007446cc663b7b52ac7ec6e403a9c7118fbd
7
+ data.tar.gz: '0873b3672640c7203f5b1f0a6c01a0f4ead2b4f24b4f1bdeb18ca6bd80db29d50099aff1fbbb05082345f1a7419334955a179855790cc381dbb82944d32c64a0'
data/.travis.yml CHANGED
@@ -1,16 +1,17 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  before_install:
4
- - gem update bundler
4
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
5
+ - gem install bundler -v '< 2'
5
6
  script:
6
7
  - RAILS_ENV=test bundle exec rake db:migrate --trace
7
8
  - bundle exec rspec spec/
8
9
 
9
10
  matrix:
10
11
  include:
11
- - rvm: 2.1.2
12
+ - rvm: 2.3.0
12
13
  env: "RAILS_VERSION=4.1.0"
13
- - rvm: 2.2.0
14
+ - rvm: 2.4.0
14
15
  env: "RAILS_VERSION=4.2.0"
15
- - rvm: 2.3.0
16
+ - rvm: 2.5.0
16
17
  env: "RAILS_VERSION=5.0.0"
data/Gemfile CHANGED
@@ -8,11 +8,12 @@ gem 'nokogiri', '~> 1.8.3'
8
8
  gem 'rails', "~> #{rails_version}"
9
9
 
10
10
  gem 'capybara'
11
- gem 'factory_girl_rails'
11
+ gem 'factory_bot_rails'
12
12
  gem 'jasmine-core', '~> 2.9.1'
13
13
  gem 'jasmine-rails'
14
14
  gem 'poltergeist'
15
15
  gem 'pry-rails'
16
+ gem 'rdoc'
16
17
  gem 'rspec-rails', '~> 3.7.1'
17
18
  gem 'sass'
18
- gem 'sqlite3'
19
+ gem 'sqlite3', '~> 1.3.6'
data/README.md CHANGED
@@ -100,14 +100,13 @@ config.allow_update_on_all_models_and_attributes = true
100
100
 
101
101
  ## Turbolinks
102
102
 
103
- If you're experiencing problems with Rails apps using Turbolinks, include the [jQuery-turbolinks](https://github.com/kossnocorp/jquery.turbolinks) gem in your application and simply require it in the following order:
103
+ If you're using Turbolinks make sure the phrasing gem is required after it:
104
104
 
105
105
  ```javascript
106
106
  //= require jquery
107
107
  //= require jquery_ujs
108
- //= require jquery.turbolinks
109
- //= require phrasing
110
108
  //= require turbolinks
109
+ //= require phrasing
111
110
  ```
112
111
 
113
112
  ## Phrasing Appearance
@@ -163,7 +163,11 @@ var phrasing_setup = function(){
163
163
  }
164
164
  };
165
165
 
166
- $(document).ready(phrasing_setup);
166
+ if(typeof Turbolinks == "object") {
167
+ $(document).on('turbolinks:load', phrasing_setup);
168
+ } else {
169
+ $(document).ready(phrasing_setup);
170
+ }
167
171
 
168
172
  $(document).on('page:before-change', function() {
169
173
  Phrasing.Bus.off();
@@ -25,12 +25,10 @@ class PhrasingGenerator < Rails::Generators::Base
25
25
  end
26
26
 
27
27
  def migration_version
28
- if rails5?
29
- "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
30
- end
28
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails_major_version >= 5
31
29
  end
32
30
 
33
- def rails5?
34
- Rails.version.start_with? '5'
31
+ def rails_major_version
32
+ Rails.version.first.to_i
35
33
  end
36
34
  end
@@ -1,3 +1,3 @@
1
1
  module Phrasing
2
- VERSION = '4.2.1'.freeze
2
+ VERSION = '4.3.0'.freeze
3
3
  end
@@ -7,7 +7,7 @@ describe PhrasingPhrasesController do
7
7
  expect(response).to render_template(:index)
8
8
  end
9
9
 
10
- let(:phrase) { FactoryGirl.create(:phrasing_phrase, value: 'old_value') }
10
+ let(:phrase) { FactoryBot.create(:phrasing_phrase, value: 'old_value') }
11
11
 
12
12
  it 'updates phrase' do
13
13
  expect do
@@ -43,4 +43,3 @@ module Dummy
43
43
  config.assets.version = '1.0'
44
44
  end
45
45
  end
46
-
@@ -5,3 +5,4 @@
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  Dummy::Application.config.secret_token = '58a2a6a84d84c3e438f9ca2616323039174f7da3337e52de287033934caa5d32051779feec0aba01731cd4811d60150b208b856b706bee47f510c8a0648f1600'
8
+ Dummy::Application.config.secret_key_base = '91f7361433a40ea1fb938722ec727bd89312d0a2431a0e3f2770ebf4fe5ada502e8e9920ce5743e965c219cc153ef9f68fbcfd0f4c837cdb96174dc4068f3a69'
@@ -1,12 +1,11 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  sequence :string do |n|
3
3
  "string%09d" % n
4
4
  end
5
-
5
+
6
6
  factory :phrasing_phrase do
7
- key { FactoryGirl.generate(:string) }
8
- value { FactoryGirl.generate(:string) }
9
- locale I18n.default_locale
7
+ key { FactoryBot.generate(:string) }
8
+ value { FactoryBot.generate(:string) }
9
+ locale { I18n.default_locale }
10
10
  end
11
11
  end
12
-
@@ -9,7 +9,7 @@ feature "use #phrase" do
9
9
 
10
10
  it "should see the header phrase modified if created before visiting" do
11
11
  PhrasingPhrase.where(key: 'site.index.header').destroy_all
12
- FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header1')
12
+ FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header1')
13
13
  visit root_path
14
14
  expect(page).to have_content 'The Header1'
15
15
  end
@@ -30,7 +30,7 @@ feature "use #phrase" do
30
30
 
31
31
  it "shows the phrasing_phrase instead of the yaml" do
32
32
  PhrasingPhrase.where(key: 'site.index.header').destroy_all
33
- FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'A different header')
33
+ FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: 'A different header')
34
34
  visit root_path
35
35
  expect(page).not_to have_content 'The Header'
36
36
  expect(page).to have_content 'A different header'
@@ -38,7 +38,7 @@ feature "use #phrase" do
38
38
 
39
39
  it "allows to treat every translation as html safe" do
40
40
  PhrasingPhrase.where(key: 'site.index.header').destroy_all
41
- FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: '<strong>Strong header</strong>')
41
+ FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: '<strong>Strong header</strong>')
42
42
  visit root_path
43
43
  expect(page).to have_content 'Strong header'
44
44
  visit root_path
@@ -93,8 +93,8 @@ feature "locales" do
93
93
  end
94
94
 
95
95
  it "displays different text based on users' locale" do
96
- FactoryGirl.create(:phrasing_phrase, locale: 'en', key: 'site.index.intro', value: 'world')
97
- FactoryGirl.create(:phrasing_phrase, locale: 'es', key: 'site.index.intro', value: 'mundo')
96
+ FactoryBot.create(:phrasing_phrase, locale: 'en', key: 'site.index.intro', value: 'world')
97
+ FactoryBot.create(:phrasing_phrase, locale: 'es', key: 'site.index.intro', value: 'mundo')
98
98
 
99
99
  I18n.locale = :en
100
100
  visit root_path
@@ -24,26 +24,12 @@ feature 'edit mode bubble' do
24
24
  find(:css, ".phrasing-edit-all-phrases-link").click
25
25
  expect(current_path).to eq phrasing_phrases_path
26
26
  end
27
-
28
- xit "phrases should have class shouldn't have class phrasable on when edit mode is off", js: true do
29
- edit_mode_checkbox = find(:css, ".onoffswitch-checkbox")
30
- edit_mode_checkbox.click
31
- expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable'
32
- end
33
-
34
- xit 'edit phrases', js: true do
35
- header_phrase = page.find('.header').first('.phrasable')
36
- header_phrase['class'].should eq 'phrasable phrasable_on'
37
- expect(header_phrase.text).to eq 'The Header'
38
- header_phrase.set "content"
39
- expect(header_phrase.expect.text).to eq 'content'
40
- end
41
27
  end
42
28
 
43
29
  feature "phrasing index" do
44
30
 
45
31
  before do
46
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar")
32
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
47
33
  visit phrasing_phrases_path
48
34
  end
49
35
 
@@ -87,23 +73,23 @@ feature "phrasing index" do
87
73
  end
88
74
 
89
75
  it "searches in the middles of strings" do
90
- FactoryGirl.create(:phrasing_phrase, key: "site.index.something")
76
+ FactoryBot.create(:phrasing_phrase, key: "site.index.something")
91
77
  fill_in 'search', with: 'index'
92
78
  click_button 'Search'
93
79
  expect(page).to have_content 'site.index.something'
94
80
  end
95
81
 
96
82
  it "can show all" do
97
- FactoryGirl.create(:phrasing_phrase, key: "foe", value: "beer")
83
+ FactoryBot.create(:phrasing_phrase, key: "foe", value: "beer")
98
84
  click_button 'Search'
99
85
  expect(page).to have_content 'foo'
100
86
  expect(page).to have_content 'foe'
101
87
  end
102
88
 
103
89
  it 'not null values first, global order by key' do
104
- FactoryGirl.create(:phrasing_phrase, key: "foo1", value: nil)
105
- FactoryGirl.create(:phrasing_phrase, key: "foo2", value: "beer")
106
- FactoryGirl.create(:phrasing_phrase, key: "foo3", value: nil)
90
+ FactoryBot.create(:phrasing_phrase, key: "foo1", value: nil)
91
+ FactoryBot.create(:phrasing_phrase, key: "foo2", value: "beer")
92
+ FactoryBot.create(:phrasing_phrase, key: "foo3", value: nil)
107
93
  visit phrasing_phrases_path
108
94
  expect(page.body).to match /foo[\s\S]*foo2[\s\S]*foo1[\s\S]*foo3/
109
95
  end
@@ -112,9 +98,9 @@ feature "phrasing index" do
112
98
 
113
99
  before do
114
100
  PhrasingPhrase.destroy_all
115
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar1", locale: "en")
116
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar2", locale: "fa")
117
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar3", locale: "it")
101
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar1", locale: "en")
102
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar2", locale: "fa")
103
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar3", locale: "it")
118
104
  end
119
105
 
120
106
  it "nil locale, blank search" do
@@ -216,7 +202,7 @@ end
216
202
 
217
203
  feature "phrasing edit" do
218
204
  before do
219
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar")
205
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
220
206
  visit phrasing_phrases_path
221
207
  end
222
208
 
@@ -234,7 +220,7 @@ end
234
220
 
235
221
  feature "phrasing update" do
236
222
  before do
237
- FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar")
223
+ FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
238
224
  visit phrasing_phrases_path
239
225
  fill_in 'search', with: 'foo'
240
226
  click_button 'Search'
@@ -257,7 +243,7 @@ end
257
243
 
258
244
  feature 'phrase versions' do
259
245
  before do
260
- phrase = FactoryGirl.create(:phrasing_phrase, key: "foo", value: "bar")
246
+ phrase = FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
261
247
  visit edit_phrasing_phrase_path(phrase)
262
248
  end
263
249
 
@@ -299,11 +285,11 @@ feature "downloading and uploading yaml files" do
299
285
  end
300
286
 
301
287
  it "round-trips the YAML" do
302
- FactoryGirl.create(:phrasing_phrase, key: "a.foo1", value: "bar1")
303
- FactoryGirl.create(:phrasing_phrase, key: "a.foo2:", value: "bar2")
304
- FactoryGirl.create(:phrasing_phrase, key: "a.b.foo3", value: "bar3")
305
- FactoryGirl.create(:phrasing_phrase, key: "c.foo4", value: "bar4")
306
- FactoryGirl.create(:phrasing_phrase, key: 2, value: "bar5")
288
+ FactoryBot.create(:phrasing_phrase, key: "a.foo1", value: "bar1")
289
+ FactoryBot.create(:phrasing_phrase, key: "a.foo2:", value: "bar2")
290
+ FactoryBot.create(:phrasing_phrase, key: "a.b.foo3", value: "bar3")
291
+ FactoryBot.create(:phrasing_phrase, key: "c.foo4", value: "bar4")
292
+ FactoryBot.create(:phrasing_phrase, key: 2, value: "bar5")
307
293
  expect(PhrasingPhrase.count).to eq 5
308
294
 
309
295
  visit import_export_phrasing_phrases_path
@@ -332,7 +318,7 @@ feature "downloading and uploading yaml files" do
332
318
 
333
319
  it "round-trips the yaml with complicated text" do
334
320
  value = "“hello world“ üokåa®fgsdf;::fs;kdf"
335
- FactoryGirl.create(:phrasing_phrase, key: "a.foo", value: value)
321
+ FactoryBot.create(:phrasing_phrase, key: "a.foo", value: value)
336
322
 
337
323
  visit import_export_phrasing_phrases_path
338
324
  click_link 'Download as YAML'
@@ -396,8 +382,8 @@ feature "locales" do
396
382
  end
397
383
 
398
384
  it "exports yaml containing multiple locales" do
399
- FactoryGirl.create(:phrasing_phrase, locale: 'en', key: 'hello', value: 'world')
400
- FactoryGirl.create(:phrasing_phrase, locale: 'es', key: 'hello', value: 'mundo')
385
+ FactoryBot.create(:phrasing_phrase, locale: 'en', key: 'hello', value: 'world')
386
+ FactoryBot.create(:phrasing_phrase, locale: 'es', key: 'hello', value: 'mundo')
401
387
 
402
388
  visit download_phrasing_phrases_path
403
389
  yaml = page.source
@@ -90,8 +90,8 @@ describe Phrasing::Serializer do
90
90
  end
91
91
 
92
92
  it 'overrides old values' do
93
- FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
94
- FactoryGirl.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
93
+ FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
94
+ FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
95
95
 
96
96
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
97
97
  expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
@@ -112,8 +112,8 @@ describe Phrasing::Serializer do
112
112
 
113
113
  context 'imports and exports' do
114
114
  it 'without changing, should return 0 number of changes' do
115
- FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
116
- FactoryGirl.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
115
+ FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
116
+ FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
117
117
 
118
118
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
119
119
  expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
@@ -133,8 +133,8 @@ describe Phrasing::Serializer do
133
133
  PhrasingPhrase.destroy_all
134
134
  end
135
135
  it 'flattened phrases' do
136
- FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
137
- FactoryGirl.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
136
+ FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
137
+ FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
138
138
 
139
139
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
140
140
  expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
@@ -146,8 +146,8 @@ describe Phrasing::Serializer do
146
146
  end
147
147
 
148
148
  it 'with different locales' do
149
- FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Hello", locale: :en)
150
- FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Bonjour", locale: :fr)
149
+ FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Hello", locale: :en)
150
+ FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Bonjour", locale: :fr)
151
151
 
152
152
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Hello")
153
153
  expect(french_phrases.where(key: "site.intro").first.value).to eq("Bonjour")
@@ -31,7 +31,7 @@
31
31
  # end
32
32
 
33
33
  # it "returns phrasing_phrase if present" do
34
- # cct = FactoryGirl.create(:phrasing_phrase)
34
+ # cct = FactoryBot.create(:phrasing_phrase)
35
35
  # base.lookup(cct.locale, cct.key).should == cct.value
36
36
  # end
37
37
 
@@ -9,7 +9,7 @@ describe PhrasingPhrase do
9
9
  it 'on #save! should raise errors if the key and locale are the same for two phrases' do
10
10
  PhrasingPhrase.create(key: "foo", locale: "en", value: "bar")
11
11
  new_phrase = PhrasingPhrase.new(key: "foo", locale: "en", value: "bar2")
12
- expect { new_phrase.save! }.to raise_error
12
+ expect { new_phrase.save! }.to raise_error(ActiveRecord::RecordInvalid)
13
13
  end
14
14
 
15
15
  it 'on #save, if the key and locale are the same for two phrases, the latter one should be invalid' do
@@ -29,7 +29,3 @@ describe PhrasingPhrase do
29
29
  end
30
30
 
31
31
  end
32
-
33
-
34
-
35
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrasing
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-05 00:00:00.000000000 Z
12
+ date: 2019-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  requirements: []
202
202
  rubyforge_project:
203
- rubygems_version: 2.6.11
203
+ rubygems_version: 2.7.3
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Edit phrases inline for Rails applications!