ledermann-rails-settings 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +2 -3
- data/Changelog.md +12 -1
- data/Gemfile +1 -1
- data/MIT-LICENSE +6 -5
- data/README.md +133 -153
- data/Rakefile +4 -9
- data/ci/Gemfile.rails-3.1.x +4 -3
- data/ci/Gemfile.rails-3.2.x +4 -3
- data/lib/generators/rails_settings/migration/migration_generator.rb +23 -0
- data/lib/generators/rails_settings/migration/templates/migration.rb +15 -0
- data/lib/rails-settings.rb +14 -4
- data/lib/rails-settings/base.rb +36 -0
- data/lib/rails-settings/configuration.rb +32 -0
- data/lib/rails-settings/scopes.rb +33 -0
- data/lib/rails-settings/setting_object.rb +64 -0
- data/lib/rails-settings/version.rb +2 -2
- data/rails-settings.gemspec +18 -20
- data/spec/configuration_spec.rb +108 -0
- data/spec/queries_spec.rb +108 -0
- data/spec/scopes_spec.rb +31 -0
- data/spec/serialize_spec.rb +40 -0
- data/spec/setting_object_spec.rb +119 -0
- data/spec/settings_spec.rb +206 -0
- data/spec/spec_helper.rb +90 -0
- data/spec/support/matchers/perform_queries.rb +18 -0
- data/spec/support/query_counter.rb +17 -0
- metadata +59 -72
- data/ci/Gemfile.rails-2.3.x +0 -5
- data/ci/Gemfile.rails-3.0.x +0 -5
- data/init.rb +0 -1
- data/lib/rails-settings/active_record.rb +0 -38
- data/lib/rails-settings/scoped_settings.rb +0 -20
- data/lib/rails-settings/settings.rb +0 -121
- data/test/settings_test.rb +0 -258
- data/test/test_helper.rb +0 -30
data/test/test_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'active_record'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
require "#{File.dirname(__FILE__)}/../init"
|
5
|
-
|
6
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
7
|
-
ActiveRecord::Migration.verbose = false
|
8
|
-
|
9
|
-
class User < ActiveRecord::Base
|
10
|
-
has_settings
|
11
|
-
end
|
12
|
-
|
13
|
-
def setup_db
|
14
|
-
ActiveRecord::Schema.define(:version => 1) do
|
15
|
-
create_table :settings do |t|
|
16
|
-
t.string :var, :null => false
|
17
|
-
t.text :value, :null => true
|
18
|
-
t.integer :target_id, :null => true
|
19
|
-
t.string :target_type, :limit => 30, :null => true
|
20
|
-
t.timestamps
|
21
|
-
end
|
22
|
-
add_index :settings, [ :target_type, :target_id, :var ], :unique => true
|
23
|
-
|
24
|
-
create_table :users do |t|
|
25
|
-
t.string :name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
puts "Testing with ActiveRecord #{ActiveRecord::VERSION::STRING}"
|