undo-serializer-active_model 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +7 -0
  4. data/Appraisals +24 -0
  5. data/Gemfile +2 -1
  6. data/README.md +9 -1
  7. data/VERSION +1 -1
  8. data/gemfiles/3.0.gemfile +31 -0
  9. data/gemfiles/3.1.gemfile +31 -0
  10. data/gemfiles/3.2.gemfile +31 -0
  11. data/gemfiles/4.0.gemfile +31 -0
  12. data/gemfiles/4.1.gemfile +31 -0
  13. data/lib/undo/serializer/active_model.rb +31 -19
  14. data/spec/{spec_helper_lite.rb → spec_helper.rb} +1 -1
  15. data/spec/support/active_record.rb +16 -0
  16. data/spec/{rails_app/app/models → support/active_record}/role.rb +0 -0
  17. data/spec/{rails_app/db → support/active_record}/schema.rb +7 -0
  18. data/spec/{rails_app/app/models → support/active_record}/user.rb +0 -0
  19. data/spec/{rails_app/app/models → support/active_record}/user_serializer.rb +1 -1
  20. data/spec/{coverage_helper.rb → support/ci_helper.rb} +2 -0
  21. data/spec/{factories.rb → support/factories.rb} +2 -0
  22. data/spec/undo/serializer/active_model_integration_spec.rb +10 -3
  23. data/spec/undo/serializer/active_model_spec.rb +1 -1
  24. metadata +23 -47
  25. data/spec/rails_app/.gitignore +0 -4
  26. data/spec/rails_app/Rakefile +0 -7
  27. data/spec/rails_app/app/models/.gitkeep +0 -0
  28. data/spec/rails_app/config.ru +0 -4
  29. data/spec/rails_app/config/application.rb +0 -13
  30. data/spec/rails_app/config/boot.rb +0 -6
  31. data/spec/rails_app/config/database.yml +0 -7
  32. data/spec/rails_app/config/environment.rb +0 -5
  33. data/spec/rails_app/config/environments/development.rb +0 -34
  34. data/spec/rails_app/config/environments/test.rb +0 -34
  35. data/spec/rails_app/config/routes.rb +0 -2
  36. data/spec/rails_app/db/migrate/20140214213610_create_users.rb +0 -10
  37. data/spec/rails_app/db/migrate/20140214213614_create_roles.rb +0 -10
  38. data/spec/rails_app/db/seeds.rb +0 -7
  39. data/spec/rails_app/script/rails +0 -6
  40. data/spec/spec_helper_rails.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6188d00d90207d48156387473c490acea184f15f
4
- data.tar.gz: bdbd1c4a303f7bd9369b14b44e80f7efd4670d6d
3
+ metadata.gz: a8f6129e916df1177c739956b56adcfb3b1f337b
4
+ data.tar.gz: 09f23cd4001f82babd417949d40dced4323e359e
5
5
  SHA512:
6
- metadata.gz: 784789d8a4f0312a731133d06fa067fb960c22344202f645c58a7a3722720928e709878d4b31b4f220dad34777cc437726001bd3c7f3140f1c2f7d7076d22ec6
7
- data.tar.gz: 2559ff72d0eff7ecff7bb9bdcd9c298444afe5fb39287faac00cbbfb151dff88184f0921929693fa497ffb074579f39fed5e2487715c7adff4b5ed9b974100ce
6
+ metadata.gz: 4d219d7d0189d6eeb4bd05bc144e663c543aaeb902d1832545e7b0b4003a353a7514a24cf5d9fdc7417f39dfc57675bc68ea320d6cadf073c89373ccc4c7c034
7
+ data.tar.gz: afda0a79e726b1656deaed0c48d73f6f6052d5414560c91d21a2f9804e20d7d574afa44c3b737bbfa6f7ea7fbba944bd6df5d3c4f8bea346db63bc1b24224e03
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  /tags
19
+ *.gemfile.lock
data/.travis.yml CHANGED
@@ -10,6 +10,13 @@ rvm:
10
10
  - jruby-19mode
11
11
  - jruby-head
12
12
 
13
+ gemfile:
14
+ - gemfiles/3.0.gemfile
15
+ - gemfiles/3.1.gemfile
16
+ - gemfiles/3.2.gemfile
17
+ - gemfiles/4.0.gemfile
18
+ - gemfiles/4.1.gemfile
19
+
13
20
  matrix:
14
21
  allow_failures:
15
22
  - rvm: ruby-head
data/Appraisals ADDED
@@ -0,0 +1,24 @@
1
+ appraise "3.0" do
2
+ gem "activerecord", "~> 3.0.20"
3
+ gem "undo-serializer-active_model", :path => "../"
4
+ end
5
+
6
+ appraise "3.1" do
7
+ gem "activerecord", "~> 3.1.12"
8
+ gem "undo-serializer-active_model", :path => "../"
9
+ end
10
+
11
+ appraise "3.2" do
12
+ gem "activerecord", "~> 3.2.15"
13
+ gem "undo-serializer-active_model", :path => "../"
14
+ end
15
+
16
+ appraise "4.0" do
17
+ gem "activerecord", "~> 4.0.0"
18
+ gem "undo-serializer-active_model", :path => "../"
19
+ end
20
+
21
+ appraise "4.1" do
22
+ gem "activerecord", "~> 4.1.0.beta"
23
+ gem "undo-serializer-active_model", :path => "../"
24
+ end
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ group :development do
7
7
  platforms :ruby_19, :ruby_20 do
8
8
  gem 'pry-plus'
9
9
  end
10
+ gem "appraisal", github: "thoughtbot/appraisal"
10
11
  end
11
12
 
12
13
  group :test do
@@ -15,7 +16,7 @@ end
15
16
 
16
17
  group :test, :development do
17
18
  gem "rspec", ">= 3.0.0.beta1"
18
- gem 'rails', '4.0.2'
19
+ gem 'activerecord', '>= 3.0.0'
19
20
  gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
20
21
  gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
21
22
  gem 'factory_girl'
data/README.md CHANGED
@@ -97,7 +97,7 @@ Found a bug or have enhancement request? You are welcome at [Github bugtracker](
97
97
 
98
98
  Compatibility
99
99
  -------------
100
- tested with Ruby
100
+ tested with Ruby:
101
101
 
102
102
  * 2.1
103
103
  * 2.0
@@ -107,6 +107,14 @@ tested with Ruby
107
107
  * jruby-19mode
108
108
  * jruby-head
109
109
 
110
+ and ActiveRecord:
111
+
112
+ * 3.0
113
+ * 3.1
114
+ * 3.2
115
+ * 4.0
116
+ * 4.1
117
+
110
118
  See [build history](http://travis-ci.org/#!/AlexParamonov/undo-serializer-active_model/builds)
111
119
 
112
120
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -0,0 +1,31 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "activerecord", "~> 3.0.20"
7
+ gem "undo-serializer-active_model", :path=>"../"
8
+
9
+ group :development do
10
+ gem "pry"
11
+ gem "appraisal", :github=>"thoughtbot/appraisal"
12
+
13
+ platforms :ruby_19, :ruby_20 do
14
+ gem "pry-plus"
15
+ end
16
+ end
17
+
18
+ group :test do
19
+ gem "coveralls", :require=>false
20
+ end
21
+
22
+ group :test, :development do
23
+ gem "rspec", ">= 3.0.0.beta1"
24
+ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
25
+ gem "sqlite3", :platform=>[:ruby, :mswin, :mingw]
26
+ gem "factory_girl"
27
+ gem "faker"
28
+ gem "active_model_serializers", "~> 0.8"
29
+ end
30
+
31
+ gemspec :path=>".././"
@@ -0,0 +1,31 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "activerecord", "~> 3.1.12"
7
+ gem "undo-serializer-active_model", :path=>"../"
8
+
9
+ group :development do
10
+ gem "pry"
11
+ gem "appraisal", :github=>"thoughtbot/appraisal"
12
+
13
+ platforms :ruby_19, :ruby_20 do
14
+ gem "pry-plus"
15
+ end
16
+ end
17
+
18
+ group :test do
19
+ gem "coveralls", :require=>false
20
+ end
21
+
22
+ group :test, :development do
23
+ gem "rspec", ">= 3.0.0.beta1"
24
+ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
25
+ gem "sqlite3", :platform=>[:ruby, :mswin, :mingw]
26
+ gem "factory_girl"
27
+ gem "faker"
28
+ gem "active_model_serializers", "~> 0.8"
29
+ end
30
+
31
+ gemspec :path=>".././"
@@ -0,0 +1,31 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "activerecord", "~> 3.2.15"
7
+ gem "undo-serializer-active_model", :path=>"../"
8
+
9
+ group :development do
10
+ gem "pry"
11
+ gem "appraisal", :github=>"thoughtbot/appraisal"
12
+
13
+ platforms :ruby_19, :ruby_20 do
14
+ gem "pry-plus"
15
+ end
16
+ end
17
+
18
+ group :test do
19
+ gem "coveralls", :require=>false
20
+ end
21
+
22
+ group :test, :development do
23
+ gem "rspec", ">= 3.0.0.beta1"
24
+ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
25
+ gem "sqlite3", :platform=>[:ruby, :mswin, :mingw]
26
+ gem "factory_girl"
27
+ gem "faker"
28
+ gem "active_model_serializers", "~> 0.8"
29
+ end
30
+
31
+ gemspec :path=>".././"
@@ -0,0 +1,31 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "activerecord", "~> 4.0.0"
7
+ gem "undo-serializer-active_model", :path=>"../"
8
+
9
+ group :development do
10
+ gem "pry"
11
+ gem "appraisal", :github=>"thoughtbot/appraisal"
12
+
13
+ platforms :ruby_19, :ruby_20 do
14
+ gem "pry-plus"
15
+ end
16
+ end
17
+
18
+ group :test do
19
+ gem "coveralls", :require=>false
20
+ end
21
+
22
+ group :test, :development do
23
+ gem "rspec", ">= 3.0.0.beta1"
24
+ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
25
+ gem "sqlite3", :platform=>[:ruby, :mswin, :mingw]
26
+ gem "factory_girl"
27
+ gem "faker"
28
+ gem "active_model_serializers", "~> 0.8"
29
+ end
30
+
31
+ gemspec :path=>".././"
@@ -0,0 +1,31 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "activerecord", "~> 4.1.0.beta"
7
+ gem "undo-serializer-active_model", :path=>"../"
8
+
9
+ group :development do
10
+ gem "pry"
11
+ gem "appraisal", :github=>"thoughtbot/appraisal"
12
+
13
+ platforms :ruby_19, :ruby_20 do
14
+ gem "pry-plus"
15
+ end
16
+ end
17
+
18
+ group :test do
19
+ gem "coveralls", :require=>false
20
+ end
21
+
22
+ group :test, :development do
23
+ gem "rspec", ">= 3.0.0.beta1"
24
+ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
25
+ gem "sqlite3", :platform=>[:ruby, :mswin, :mingw]
26
+ gem "factory_girl"
27
+ gem "faker"
28
+ gem "active_model_serializers", "~> 0.8"
29
+ end
30
+
31
+ gemspec :path=>".././"
@@ -15,26 +15,25 @@ module Undo
15
15
  end
16
16
 
17
17
  def deserialize(hash)
18
- hash.each do |object_class, data|
19
- next unless data.is_a? Hash
20
- data.stringify_keys!
21
-
22
- object_class = object_class.to_s.camelize.constantize
23
- object = object_class.where(id: data.fetch("id")).first_or_initialize
24
-
25
- data.each do |field, value|
26
- next if "id" == field && object.persisted?
27
- _, association = field.to_s.split("___")
28
- if association
29
- deserialize_association(association, value)
30
- else
31
- object.send "#{field}=", value # not public_send!
18
+ object_handler, data = hash.first
19
+ return unless data.is_a? Hash
20
+ data.stringify_keys!
21
+
22
+ ActiveRecord::Base.transaction do
23
+ initialize_object(object_handler, data).tap do |object|
24
+ data.each do |field, value|
25
+ next if "id" == field && object.persisted?
26
+
27
+ case field
28
+ when /___(.*)/ then deserialize_association object, $1, value
29
+ else deserialize_field object, field, value
30
+ end
32
31
  end
33
- end
34
32
 
35
- object.save!
36
- return object
33
+ object.save!
34
+ end
37
35
  end
36
+
38
37
  end
39
38
 
40
39
  private
@@ -44,11 +43,24 @@ module Undo
44
43
  @serializer ||= serializer_source.call object
45
44
  end
46
45
 
47
- def deserialize_association(association, values)
46
+ def deserialize_association(object, association, values)
48
47
  Array.wrap(values).each do |value|
49
- deserialize(association.singularize => value)
48
+ deserialize object.public_send(association) => value
50
49
  end
51
50
  end
51
+
52
+ def deserialize_field(object, field, value)
53
+ object.send "#{field}=", value # not public_send!
54
+ end
55
+
56
+ def initialize_object(object_handler, data)
57
+ id = data.fetch "id"
58
+ relation = case object_handler
59
+ when String, Symbol then object_handler.to_s.camelize.constantize
60
+ else object_handler end
61
+
62
+ relation.where(id: id).first || relation.new(id: id)
63
+ end
52
64
  end
53
65
  end
54
66
  end
@@ -1,4 +1,4 @@
1
- require_relative "coverage_helper"
1
+ require_relative "support/ci_helper"
2
2
  require "undo/serializer/active_model"
3
3
 
4
4
  RSpec.configure do |config|
@@ -0,0 +1,16 @@
1
+ require 'active_record'
2
+ $: << File.expand_path('active_record', File.dirname(__FILE__))
3
+
4
+ require_relative 'factories'
5
+
6
+ ActiveRecord::Base.establish_connection(
7
+ adapter: "jruby" == RUBY_ENGINE ? "jdbcsqlite3" : "sqlite3",
8
+ database: ":memory:",
9
+ timeout: 5000
10
+ )
11
+
12
+ require_relative "active_record/schema.rb"
13
+
14
+ RSpec.configure do |config|
15
+ config.include FactoryGirl::Syntax::Methods
16
+ end
@@ -20,4 +20,11 @@ ActiveRecord::Schema.define(version: 20140214213610) do
20
20
  t.datetime "updated_at"
21
21
  end
22
22
 
23
+ create_table "roles", force: true do |t|
24
+ t.string "name"
25
+ t.integer "user_id"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
23
30
  end
@@ -1,6 +1,6 @@
1
1
  require "active_model_serializers"
2
2
 
3
3
  class UserSerializer < ActiveModel::Serializer
4
- attributes *User.attribute_names.map(&:to_sym)
4
+ attributes :id, :name, :email
5
5
  has_many :roles, key: :has_many___roles
6
6
  end
@@ -11,4 +11,6 @@ if !!ENV["CI"] || "test" == ENV["RAILS_ENV"]
11
11
  add_filter '/vendor/'
12
12
  minimum_coverage(90)
13
13
  end
14
+ else
15
+ require "pry"
14
16
  end
@@ -1,3 +1,5 @@
1
+ require 'factory_girl'
2
+ require "faker"
1
3
  FactoryGirl.define do
2
4
  factory :user do
3
5
  name { Faker::Name.name }
@@ -1,4 +1,8 @@
1
- require "spec_helper_rails"
1
+ require "spec_helper"
2
+ require "support/active_record"
3
+ require "user"
4
+ require "role"
5
+ require "user_serializer"
2
6
 
3
7
  describe Undo::Serializer::ActiveModel do
4
8
  subject { described_class }
@@ -7,7 +11,7 @@ describe Undo::Serializer::ActiveModel do
7
11
 
8
12
  it "restores object" do
9
13
  hash = serializer.serialize user
10
- user.destroy
14
+ user.delete
11
15
  restored_user = serializer.deserialize hash
12
16
 
13
17
  expect(restored_user).to eq user
@@ -18,9 +22,12 @@ describe Undo::Serializer::ActiveModel do
18
22
  it "restores object and associations" do
19
23
  roles = create_list :role, 3, user: user
20
24
  hash = serializer.serialize user
21
- user.destroy
25
+ user.delete
26
+ Role.delete_all # HACK for ActiveRecord 3.0
27
+
22
28
  restored_user = serializer.deserialize hash
23
29
 
30
+ restored_user.reload # HACK for ActiveRecord 3.0
24
31
  expect(restored_user).to eq user
25
32
  expect(restored_user.roles).to eq roles
26
33
  end
@@ -1,4 +1,4 @@
1
- require "spec_helper_lite"
1
+ require "spec_helper"
2
2
 
3
3
  describe Undo::Serializer::ActiveModel do
4
4
  subject { described_class }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undo-serializer-active_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Paramonov
@@ -51,35 +51,26 @@ files:
51
51
  - ".ruby-gemset"
52
52
  - ".ruby-version"
53
53
  - ".travis.yml"
54
+ - Appraisals
54
55
  - Gemfile
55
56
  - LICENSE.txt
56
57
  - README.md
57
58
  - Rakefile
58
59
  - VERSION
60
+ - gemfiles/3.0.gemfile
61
+ - gemfiles/3.1.gemfile
62
+ - gemfiles/3.2.gemfile
63
+ - gemfiles/4.0.gemfile
64
+ - gemfiles/4.1.gemfile
59
65
  - lib/undo/serializer/active_model.rb
60
- - spec/coverage_helper.rb
61
- - spec/factories.rb
62
- - spec/rails_app/.gitignore
63
- - spec/rails_app/Rakefile
64
- - spec/rails_app/app/models/.gitkeep
65
- - spec/rails_app/app/models/role.rb
66
- - spec/rails_app/app/models/user.rb
67
- - spec/rails_app/app/models/user_serializer.rb
68
- - spec/rails_app/config.ru
69
- - spec/rails_app/config/application.rb
70
- - spec/rails_app/config/boot.rb
71
- - spec/rails_app/config/database.yml
72
- - spec/rails_app/config/environment.rb
73
- - spec/rails_app/config/environments/development.rb
74
- - spec/rails_app/config/environments/test.rb
75
- - spec/rails_app/config/routes.rb
76
- - spec/rails_app/db/migrate/20140214213610_create_users.rb
77
- - spec/rails_app/db/migrate/20140214213614_create_roles.rb
78
- - spec/rails_app/db/schema.rb
79
- - spec/rails_app/db/seeds.rb
80
- - spec/rails_app/script/rails
81
- - spec/spec_helper_lite.rb
82
- - spec/spec_helper_rails.rb
66
+ - spec/spec_helper.rb
67
+ - spec/support/active_record.rb
68
+ - spec/support/active_record/role.rb
69
+ - spec/support/active_record/schema.rb
70
+ - spec/support/active_record/user.rb
71
+ - spec/support/active_record/user_serializer.rb
72
+ - spec/support/ci_helper.rb
73
+ - spec/support/factories.rb
83
74
  - spec/undo/serializer/active_model_integration_spec.rb
84
75
  - spec/undo/serializer/active_model_spec.rb
85
76
  - undo-serializer-active_model.gemspec
@@ -108,29 +99,14 @@ signing_key:
108
99
  specification_version: 4
109
100
  summary: ActiveModel serializer for Undo gem.
110
101
  test_files:
111
- - spec/coverage_helper.rb
112
- - spec/factories.rb
113
- - spec/rails_app/.gitignore
114
- - spec/rails_app/Rakefile
115
- - spec/rails_app/app/models/.gitkeep
116
- - spec/rails_app/app/models/role.rb
117
- - spec/rails_app/app/models/user.rb
118
- - spec/rails_app/app/models/user_serializer.rb
119
- - spec/rails_app/config.ru
120
- - spec/rails_app/config/application.rb
121
- - spec/rails_app/config/boot.rb
122
- - spec/rails_app/config/database.yml
123
- - spec/rails_app/config/environment.rb
124
- - spec/rails_app/config/environments/development.rb
125
- - spec/rails_app/config/environments/test.rb
126
- - spec/rails_app/config/routes.rb
127
- - spec/rails_app/db/migrate/20140214213610_create_users.rb
128
- - spec/rails_app/db/migrate/20140214213614_create_roles.rb
129
- - spec/rails_app/db/schema.rb
130
- - spec/rails_app/db/seeds.rb
131
- - spec/rails_app/script/rails
132
- - spec/spec_helper_lite.rb
133
- - spec/spec_helper_rails.rb
102
+ - spec/spec_helper.rb
103
+ - spec/support/active_record.rb
104
+ - spec/support/active_record/role.rb
105
+ - spec/support/active_record/schema.rb
106
+ - spec/support/active_record/user.rb
107
+ - spec/support/active_record/user_serializer.rb
108
+ - spec/support/ci_helper.rb
109
+ - spec/support/factories.rb
134
110
  - spec/undo/serializer/active_model_integration_spec.rb
135
111
  - spec/undo/serializer/active_model_spec.rb
136
112
  has_rdoc:
@@ -1,4 +0,0 @@
1
- .bundle
2
- db/*.sqlite3
3
- log/*.log
4
- tmp/
@@ -1,7 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
- require 'rake'
6
-
7
- RailsApp::Application.load_tasks
File without changes
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run RailsApp::Application
@@ -1,13 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require "rails/all"
4
-
5
- # If you have a Gemfile, require the gems listed there, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(:default, Rails.env) if defined?(Bundler)
8
-
9
- module RailsApp
10
- class Application < Rails::Application
11
- I18n.enforce_available_locales = false
12
- end
13
- end
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,7 +0,0 @@
1
- test: &test
2
- adapter: <%= "jruby" == RUBY_ENGINE ? "jdbcsqlite3" : "sqlite3" %>
3
- database: ":memory:"
4
- timeout: 5000
5
-
6
- development:
7
- <<: *test
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- RailsApp::Application.initialize!
@@ -1,34 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
- config.eager_load = false
10
-
11
- # Show full error reports and disable caching
12
- config.consider_all_requests_local = true
13
- config.action_controller.perform_caching = false
14
-
15
- # Raise exceptions instead of rendering exception templates
16
- config.action_dispatch.show_exceptions = false
17
-
18
- # Disable request forgery protection in test environment
19
- config.action_controller.allow_forgery_protection = false
20
-
21
- # Tell Action Mailer not to deliver emails to the real world.
22
- # The :test delivery method accumulates sent emails in the
23
- # ActionMailer::Base.deliveries array.
24
- config.action_mailer.delivery_method = :test
25
- config.action_mailer.default_url_options = { :host => 'www.example.com' }
26
-
27
- # Use SQL instead of Active Record's schema dumper when creating the test database.
28
- # This is necessary if your schema can't be completely dumped by the schema dumper,
29
- # like if you have constraints or database-specific column types
30
- # config.active_record.schema_format = :sql
31
-
32
- # Print deprecation notices to the stderr
33
- config.active_support.deprecation = :stderr
34
- end
@@ -1,34 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
- config.eager_load = false
10
-
11
- # Show full error reports and disable caching
12
- config.consider_all_requests_local = true
13
- config.action_controller.perform_caching = false
14
-
15
- # Raise exceptions instead of rendering exception templates
16
- config.action_dispatch.show_exceptions = false
17
-
18
- # Disable request forgery protection in test environment
19
- config.action_controller.allow_forgery_protection = false
20
-
21
- # Tell Action Mailer not to deliver emails to the real world.
22
- # The :test delivery method accumulates sent emails in the
23
- # ActionMailer::Base.deliveries array.
24
- config.action_mailer.delivery_method = :test
25
- config.action_mailer.default_url_options = { :host => 'www.example.com' }
26
-
27
- # Use SQL instead of Active Record's schema dumper when creating the test database.
28
- # This is necessary if your schema can't be completely dumped by the schema dumper,
29
- # like if you have constraints or database-specific column types
30
- # config.active_record.schema_format = :sql
31
-
32
- # Print deprecation notices to the stderr
33
- config.active_support.deprecation = :stderr
34
- end
@@ -1,2 +0,0 @@
1
- RailsApp::Application.routes.draw do
2
- end
@@ -1,10 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table :users do |t|
4
- t.string :name
5
- t.string :email
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- class CreateRoles < ActiveRecord::Migration
2
- def change
3
- create_table :roles do |t|
4
- t.string :name
5
- t.integer :user_id
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,10 +0,0 @@
1
- require_relative 'spec_helper_lite'
2
- require_relative 'rails_app/config/environment'
3
- require_relative 'factories'
4
-
5
- ActiveRecord::Migration.verbose = false
6
- ActiveRecord::Migrator.migrate(Rails.root.join('db', 'migrate').to_s)
7
-
8
- RSpec.configure do |config|
9
- config.include FactoryGirl::Syntax::Methods
10
- end