activerecord-userstamp 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -5
  3. data/.rspec +2 -2
  4. data/CHANGELOG.md +103 -99
  5. data/Gemfile +3 -3
  6. data/LICENSE +21 -21
  7. data/README.md +189 -189
  8. data/Rakefile +17 -17
  9. data/activerecord-userstamp.gemspec +34 -34
  10. data/lib/active_record/userstamp.rb +30 -30
  11. data/lib/active_record/userstamp/configuration.rb +49 -49
  12. data/lib/active_record/userstamp/controller_additions.rb +50 -50
  13. data/lib/active_record/userstamp/migration_additions.rb +14 -14
  14. data/lib/active_record/userstamp/model_additions.rb +10 -10
  15. data/lib/active_record/userstamp/stampable.rb +123 -123
  16. data/lib/active_record/userstamp/stamper.rb +54 -54
  17. data/lib/active_record/userstamp/utilities.rb +55 -54
  18. data/lib/active_record/userstamp/version.rb +4 -4
  19. data/lib/activerecord/userstamp.rb +1 -1
  20. data/spec/controllers/posts_controller_spec.rb +44 -44
  21. data/spec/controllers/users_controller_spec.rb +50 -50
  22. data/spec/dummy/README.rdoc +28 -28
  23. data/spec/dummy/Rakefile +6 -6
  24. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  25. data/spec/dummy/app/assets/stylesheets/application.css +15 -15
  26. data/spec/dummy/app/controllers/application_controller.rb +13 -13
  27. data/spec/dummy/app/controllers/posts_controller.rb +36 -36
  28. data/spec/dummy/app/controllers/users_controller.rb +22 -22
  29. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  30. data/spec/dummy/app/models/comment.rb +5 -5
  31. data/spec/dummy/app/models/person.rb +3 -3
  32. data/spec/dummy/app/models/post.rb +14 -14
  33. data/spec/dummy/app/models/tag.rb +3 -0
  34. data/spec/dummy/app/models/user.rb +3 -3
  35. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  36. data/spec/dummy/bin/bundle +3 -3
  37. data/spec/dummy/bin/rails +4 -4
  38. data/spec/dummy/bin/rake +4 -4
  39. data/spec/dummy/bin/setup +29 -29
  40. data/spec/dummy/config.ru +4 -4
  41. data/spec/dummy/config/application.rb +30 -30
  42. data/spec/dummy/config/boot.rb +5 -5
  43. data/spec/dummy/config/database.yml +23 -23
  44. data/spec/dummy/config/environment.rb +5 -5
  45. data/spec/dummy/config/environments/development.rb +41 -41
  46. data/spec/dummy/config/environments/production.rb +79 -79
  47. data/spec/dummy/config/environments/test.rb +37 -37
  48. data/spec/dummy/config/initializers/assets.rb +11 -11
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -3
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  52. data/spec/dummy/config/initializers/inflections.rb +16 -16
  53. data/spec/dummy/config/initializers/mime_types.rb +4 -4
  54. data/spec/dummy/config/initializers/session_store.rb +3 -3
  55. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  56. data/spec/dummy/config/locales/en.yml +23 -23
  57. data/spec/dummy/config/routes.rb +56 -56
  58. data/spec/dummy/config/secrets.yml +22 -22
  59. data/spec/dummy/db/schema.rb +54 -45
  60. data/spec/dummy/public/404.html +67 -67
  61. data/spec/dummy/public/422.html +67 -67
  62. data/spec/dummy/public/500.html +66 -66
  63. data/spec/lib/configuration_spec.rb +20 -20
  64. data/spec/lib/migration_spec.rb +71 -71
  65. data/spec/lib/stamper_spec.rb +66 -66
  66. data/spec/lib/stamping_spec.rb +250 -238
  67. data/spec/lib/userstamp_spec.rb +7 -7
  68. data/spec/rails_helper.rb +7 -7
  69. data/spec/spec_helper.rb +97 -97
  70. data/spec/support/database_helpers.rb +22 -22
  71. data/spec/support/with_temporary_table.rb +51 -51
  72. metadata +3 -2
@@ -1,7 +1,7 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe ActiveRecord::Userstamp do
4
- it 'has a VERSION' do
5
- expect(ActiveRecord::Userstamp::VERSION).to match(/^\d+\.\d+\.\d+$/)
6
- end
7
- end
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe ActiveRecord::Userstamp do
4
+ it 'has a VERSION' do
5
+ expect(ActiveRecord::Userstamp::VERSION).to match(/^\d+\.\d+\.\d+$/)
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require 'spec_helper'
3
-
4
- require File.expand_path('dummy/config/environment.rb', __dir__)
5
- require 'rspec/rails'
6
-
7
- Dir[__dir__ + '/support/**/*'].each { |f| require f if File.file?(f) }
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require 'spec_helper'
3
+
4
+ require File.expand_path('dummy/config/environment.rb', __dir__)
5
+ require 'rspec/rails'
6
+
7
+ Dir[__dir__ + '/support/**/*'].each { |f| require f if File.file?(f) }
@@ -1,97 +1,97 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause
4
- # this file to always be loaded, without a need to explicitly require it in any
5
- # files.
6
- #
7
- # Given that it is always loaded, you are encouraged to keep this file as
8
- # light-weight as possible. Requiring heavyweight dependencies from this file
9
- # will add to the boot time of your test suite on EVERY test run, even for an
10
- # individual file that may not need all of that loaded. Instead, consider making
11
- # a separate helper file that requires the additional dependencies and performs
12
- # the additional setup, and require it from the spec files that actually need
13
- # it.
14
- #
15
- # The `.rspec` file also contains a few flags that are not defaults but that
16
- # users commonly want.
17
- #
18
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
- require 'bundler/setup'
20
- Bundler.setup
21
-
22
- require 'coverage_helper'
23
-
24
- RSpec.configure do |config|
25
- # rspec-expectations config goes here. You can use an alternate
26
- # assertion/expectation library such as wrong or the stdlib/minitest
27
- # assertions if you prefer.
28
- config.expect_with :rspec do |expectations|
29
- # This option will default to `true` in RSpec 4. It makes the `description`
30
- # and `failure_message` of custom matchers include text for helper methods
31
- # defined using `chain`, e.g.:
32
- # be_bigger_than(2).and_smaller_than(4).description
33
- # # => "be bigger than 2 and smaller than 4"
34
- # ...rather than:
35
- # # => "be bigger than 2"
36
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
37
- end
38
-
39
- # rspec-mocks config goes here. You can use an alternate test double
40
- # library (such as bogus or mocha) by changing the `mock_with` option here.
41
- config.mock_with :rspec do |mocks|
42
- # Prevents you from mocking or stubbing a method that does not exist on
43
- # a real object. This is generally recommended, and will default to
44
- # `true` in RSpec 4.
45
- mocks.verify_partial_doubles = true
46
- end
47
-
48
- # These two settings work together to allow you to limit a spec run
49
- # to individual examples or groups you care about by tagging them with
50
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
- # get run.
52
- config.filter_run :focus
53
- config.run_all_when_everything_filtered = true
54
-
55
- # Allows RSpec to persist some state between runs in order to support
56
- # the `--only-failures` and `--next-failure` CLI options. We recommend
57
- # you configure your source control system to ignore this file.
58
- config.example_status_persistence_file_path = "spec/examples.txt"
59
-
60
- # Limits the available syntax to the non-monkey patched syntax that is
61
- # recommended. For more details, see:
62
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
65
- config.disable_monkey_patching!
66
-
67
- # This setting enables warnings. It's recommended, but in some cases may
68
- # be too noisy due to issues in dependencies.
69
- config.warnings = true
70
-
71
- # Many RSpec users commonly either run the entire suite or an individual
72
- # file, and it's useful to allow more verbose output when running an
73
- # individual spec file.
74
- if config.files_to_run.one?
75
- # Use the documentation formatter for detailed output,
76
- # unless a formatter has already been configured
77
- # (e.g. via a command-line flag).
78
- config.default_formatter = 'doc'
79
- end
80
-
81
- # Print the 10 slowest examples and example groups at the
82
- # end of the spec run, to help surface which specs are running
83
- # particularly slow.
84
- config.profile_examples = 10
85
-
86
- # Run specs in random order to surface order dependencies. If you find an
87
- # order dependency and want to debug it, you can fix the order by providing
88
- # the seed, which is printed after each run.
89
- # --seed 1234
90
- config.order = :random
91
-
92
- # Seed global randomization in this process using the `--seed` CLI option.
93
- # Setting this allows you to use `--seed` to deterministically reproduce
94
- # test failures related to randomization by passing the same `--seed` value
95
- # as the one that triggered the failure.
96
- Kernel.srand config.seed
97
- end
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ require 'bundler/setup'
20
+ Bundler.setup
21
+
22
+ require 'coverage_helper'
23
+
24
+ RSpec.configure do |config|
25
+ # rspec-expectations config goes here. You can use an alternate
26
+ # assertion/expectation library such as wrong or the stdlib/minitest
27
+ # assertions if you prefer.
28
+ config.expect_with :rspec do |expectations|
29
+ # This option will default to `true` in RSpec 4. It makes the `description`
30
+ # and `failure_message` of custom matchers include text for helper methods
31
+ # defined using `chain`, e.g.:
32
+ # be_bigger_than(2).and_smaller_than(4).description
33
+ # # => "be bigger than 2 and smaller than 4"
34
+ # ...rather than:
35
+ # # => "be bigger than 2"
36
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
37
+ end
38
+
39
+ # rspec-mocks config goes here. You can use an alternate test double
40
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
41
+ config.mock_with :rspec do |mocks|
42
+ # Prevents you from mocking or stubbing a method that does not exist on
43
+ # a real object. This is generally recommended, and will default to
44
+ # `true` in RSpec 4.
45
+ mocks.verify_partial_doubles = true
46
+ end
47
+
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Allows RSpec to persist some state between runs in order to support
56
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
57
+ # you configure your source control system to ignore this file.
58
+ config.example_status_persistence_file_path = "spec/examples.txt"
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is
61
+ # recommended. For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ end
@@ -1,22 +1,22 @@
1
- def define_first_post
2
- @first_post = Post.create!(title: 'a title')
3
- end
4
-
5
- RSpec.configure do |config|
6
- config.before(:each) do
7
- User.delete_all
8
- Person.delete_all
9
- Post.delete_all
10
- Comment.delete_all
11
- User.reset_stamper
12
- Person.reset_stamper
13
-
14
- @zeus = User.create!(name: 'Zeus')
15
- @hera = User.create!(name: 'Hera')
16
- User.stamper = @zeus.id
17
-
18
- @delynn = Person.create!(name: 'Delynn')
19
- @nicole = Person.create!(name: 'Nicole')
20
- Person.stamper = @delynn.id
21
- end
22
- end
1
+ def define_first_post
2
+ @first_post = Post.create!(title: 'a title')
3
+ end
4
+
5
+ RSpec.configure do |config|
6
+ config.before(:each) do
7
+ User.delete_all
8
+ Person.delete_all
9
+ Post.delete_all
10
+ Comment.delete_all
11
+ User.reset_stamper
12
+ Person.reset_stamper
13
+
14
+ @zeus = User.create!(name: 'Zeus')
15
+ @hera = User.create!(name: 'Hera')
16
+ User.stamper = @zeus.id
17
+
18
+ @delynn = Person.create!(name: 'Delynn')
19
+ @nicole = Person.create!(name: 'Nicole')
20
+ Person.stamper = @delynn.id
21
+ end
22
+ end
@@ -1,51 +1,51 @@
1
- # Test group helpers for creating tables.
2
- # The latest version can be gound at https://gist.github.com/lowjoel/bda0d44b48aac2925079
3
- module ActiveRecord::TemporaryTable; end
4
- module ActiveRecord::TemporaryTable::TestGroupHelpers
5
- # Defines a temporary table that is instantiated when needed, within a `with_temporary_table`
6
- # block.
7
- #
8
- # @param [Symbol] table_name The name of the table to define.
9
- # @param [Proc] proc The table definition, same as that of a block given to
10
- # +ActiveRecord::Migration::create_table+
11
- def temporary_table(table_name, &proc)
12
- define_method(table_name) do
13
- proc
14
- end
15
- end
16
-
17
- # Using the temporary table defined previously, run the examples in this group.
18
- #
19
- # @param [Symbol] table_name The name of the table to use.
20
- # @param [Symbol] create_at When to create the table. Defaults to :context.
21
- # @param [Proc] proc The examples requiring the use of the temporary table.
22
- def with_temporary_table(table_name, create_at = :context, &proc)
23
- context "with temporary table #{table_name}" do |*params|
24
- before(create_at) do
25
- ActiveRecord::TemporaryTable::TestGroupHelpers.create_table(table_name, send(table_name))
26
- end
27
-
28
- after(create_at) do
29
- ActiveRecord::TemporaryTable::TestGroupHelpers.drop_table(table_name)
30
- end
31
-
32
- module_exec(*params, &proc)
33
- end
34
- end
35
-
36
- def self.create_table(table_name, table_definition)
37
- ActiveRecord::Migration.suppress_messages do
38
- ActiveRecord::Migration.create_table(table_name, &table_definition)
39
- end
40
- end
41
-
42
- def self.drop_table(table_name)
43
- ActiveRecord::Migration.suppress_messages do
44
- ActiveRecord::Migration.drop_table(table_name)
45
- end
46
- end
47
- end
48
-
49
- RSpec.configure do |config|
50
- config.extend ActiveRecord::TemporaryTable::TestGroupHelpers, type: :model
51
- end
1
+ # Test group helpers for creating tables.
2
+ # The latest version can be gound at https://gist.github.com/lowjoel/bda0d44b48aac2925079
3
+ module ActiveRecord::TemporaryTable; end
4
+ module ActiveRecord::TemporaryTable::TestGroupHelpers
5
+ # Defines a temporary table that is instantiated when needed, within a `with_temporary_table`
6
+ # block.
7
+ #
8
+ # @param [Symbol] table_name The name of the table to define.
9
+ # @param [Proc] proc The table definition, same as that of a block given to
10
+ # +ActiveRecord::Migration::create_table+
11
+ def temporary_table(table_name, &proc)
12
+ define_method(table_name) do
13
+ proc
14
+ end
15
+ end
16
+
17
+ # Using the temporary table defined previously, run the examples in this group.
18
+ #
19
+ # @param [Symbol] table_name The name of the table to use.
20
+ # @param [Symbol] create_at When to create the table. Defaults to :context.
21
+ # @param [Proc] proc The examples requiring the use of the temporary table.
22
+ def with_temporary_table(table_name, create_at = :context, &proc)
23
+ context "with temporary table #{table_name}" do |*params|
24
+ before(create_at) do
25
+ ActiveRecord::TemporaryTable::TestGroupHelpers.create_table(table_name, send(table_name))
26
+ end
27
+
28
+ after(create_at) do
29
+ ActiveRecord::TemporaryTable::TestGroupHelpers.drop_table(table_name)
30
+ end
31
+
32
+ module_exec(*params, &proc)
33
+ end
34
+ end
35
+
36
+ def self.create_table(table_name, table_definition)
37
+ ActiveRecord::Migration.suppress_messages do
38
+ ActiveRecord::Migration.create_table(table_name, &table_definition)
39
+ end
40
+ end
41
+
42
+ def self.drop_table(table_name)
43
+ ActiveRecord::Migration.suppress_messages do
44
+ ActiveRecord::Migration.drop_table(table_name)
45
+ end
46
+ end
47
+ end
48
+
49
+ RSpec.configure do |config|
50
+ config.extend ActiveRecord::TemporaryTable::TestGroupHelpers, type: :model
51
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-userstamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Low
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-12 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -210,6 +210,7 @@ files:
210
210
  - spec/dummy/app/models/concerns/.keep
211
211
  - spec/dummy/app/models/person.rb
212
212
  - spec/dummy/app/models/post.rb
213
+ - spec/dummy/app/models/tag.rb
213
214
  - spec/dummy/app/models/user.rb
214
215
  - spec/dummy/app/views/layouts/application.html.erb
215
216
  - spec/dummy/bin/bundle