rails_dictionary 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/lib/rails_dictionary/models/active_record_extension.rb +1 -1
- data/lib/rails_dictionary/version.rb +1 -1
- data/rails_dictionary.gemspec +1 -2
- data/spec/fake_app.rb +7 -3
- data/spec/rails_dictionary_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3cc435df2a7cdf214af4e1843755b3c56b56edc2680fe644a8f38a991236567
|
4
|
+
data.tar.gz: 573815dc3115fc14232cbf0cca60c2fd3721f4676ff68a87541abf465a68f1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb51afd93704440a426dee3e366ca80912c578be74836466afe7d3d567fd5880fff2fa99de4d9dd0f9fc988566e96b34be0e0ef2498ac173ae85232fa71f835f
|
7
|
+
data.tar.gz: 04c1f6992583f8b9d76675d912a4fb9cc5068b1254d928fc07ad92bb77df616d212d8d4041fc3563b313da1abbe6a9f52a2343e411992e3d595987525d9f560b
|
data/Gemfile
CHANGED
@@ -34,7 +34,7 @@ module RailsDictionary
|
|
34
34
|
def acts_as_dict_slave(ops={})
|
35
35
|
include RailsDictionary::ActsAsDictSlave
|
36
36
|
class_attribute :default_dict_locale, :instance_writer => false
|
37
|
-
cattr_accessor :dict_mapping_columns, :
|
37
|
+
cattr_accessor :dict_mapping_columns, :instance_writer => false
|
38
38
|
self.default_dict_locale = ops[:locale] if ops[:locale]
|
39
39
|
self.dict_mapping_columns = dict_columns(ops)
|
40
40
|
unless dict_mapping_columns.nil?
|
data/rails_dictionary.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
$:.push File.expand_path("../lib", __FILE__)
|
3
2
|
require "rails_dictionary/version"
|
4
3
|
|
@@ -14,7 +13,7 @@ Gem::Specification.new do |s|
|
|
14
13
|
|
15
14
|
s.rubyforge_project = "rails_dictionary"
|
16
15
|
|
17
|
-
s.add_runtime_dependency 'rails', '>
|
16
|
+
s.add_runtime_dependency 'rails', '> 4.0'
|
18
17
|
|
19
18
|
s.files = `git ls-files`.split("\n")
|
20
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/spec/fake_app.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
|
2
1
|
# database
|
3
2
|
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
|
4
|
-
|
3
|
+
|
4
|
+
if ActiveRecord::VERSION::MAJOR >= 5
|
5
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
6
|
+
else
|
7
|
+
ActiveRecord::Base.establish_connection(:test)
|
8
|
+
end
|
5
9
|
|
6
10
|
# config
|
7
11
|
app = Class.new(Rails::Application)
|
@@ -22,7 +26,7 @@ class Student < ActiveRecord::Base
|
|
22
26
|
end
|
23
27
|
|
24
28
|
#migrations
|
25
|
-
class CreateAllTables < ActiveRecord::Migration
|
29
|
+
class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
|
26
30
|
def self.up
|
27
31
|
create_table(:dict_types) {|t| t.string :name}
|
28
32
|
create_table(:dictionaries) {|t| t.string :name_en; t.string :name_zh ; t.string :name_fr ; t.integer :dict_type_id}
|
@@ -4,7 +4,7 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
4
4
|
describe RailsDictionary::ActiveRecordExtension do
|
5
5
|
%w[acts_as_dict_type acts_as_dictionary acts_as_dict_slave].each do |method_name|
|
6
6
|
it "contains #{method_name}" do
|
7
|
-
ActiveRecord::Base.methods.include
|
7
|
+
expect(ActiveRecord::Base.methods).to include(method_name.to_sym)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -88,7 +88,7 @@ describe RailsDictionary do
|
|
88
88
|
it "update city by set city_name to a value" do
|
89
89
|
stu_shanghai.update_attributes city_name: "wuhan"
|
90
90
|
stu_shanghai.reload.city_name.should == "wuhan"
|
91
|
-
Dictionary.student_city.map(&:name_en).include?("wuhan").should
|
91
|
+
Dictionary.student_city.map(&:name_en).include?("wuhan").should be_truthy
|
92
92
|
end
|
93
93
|
|
94
94
|
it "update city by set city_name to an exist dictionary name" do
|
data/spec/spec_helper.rb
CHANGED
@@ -16,6 +16,8 @@ $stdout = StringIO.new # remove the noise output
|
|
16
16
|
|
17
17
|
RSpec.configure do |config|
|
18
18
|
config.use_transactional_fixtures = true
|
19
|
+
# not work, must syntax error
|
20
|
+
# config.expect_with(:rspec) { |c| c.syntax = :should }
|
19
21
|
CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'dict_types'
|
20
22
|
end
|
21
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_dictionary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raykin Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
description: Rails plugin for mapping static data of web application to Dictionary
|
28
28
|
class
|
29
29
|
email:
|
@@ -67,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
|
71
|
-
rubygems_version: 2.7.7
|
70
|
+
rubygems_version: 3.0.1
|
72
71
|
signing_key:
|
73
72
|
specification_version: 4
|
74
73
|
summary: dictionary data for web application
|