after_timestamps 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
- require File.dirname(__FILE__) + "/lib/mcmire/after_timestamps/version.rb"
4
+ require File.dirname(__FILE__) + "/lib/mcmire/after_timestamps"
5
5
 
6
6
  begin
7
7
  require 'jeweler'
@@ -13,11 +13,11 @@ begin
13
13
  gem.authors = ["Elliot Winkler"]
14
14
  gem.email = "elliot.winkler@gmail.com"
15
15
  gem.homepage = "http://github.com/mcmire/after_timestamps"
16
- gem.add_dependency "activerecord", ">= 1.2.6"
17
- gem.add_development_dependency "mcmire-context", ">= 0.5.6"
18
- gem.add_development_dependency "mcmire-matchy", ">= 0.4.1"
19
- gem.add_development_dependency "rr", ">= 0.10.5"
20
- gem.add_development_dependency "rr-matchy", ">= 0.1.0"
16
+ gem.add_dependency "activerecord", "< 3.0"
17
+ gem.add_development_dependency "mcmire-protest", "~> 0.2.4"
18
+ gem.add_development_dependency "mcmire-matchy", "~> 0.4.1"
19
+ gem.add_development_dependency "mcmire-mocha", "~> 0.9.8"
20
+ gem.add_development_dependency "mocha-protest-integration"
21
21
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
22
  end
23
23
  Jeweler::GemcutterTasks.new
@@ -27,7 +27,7 @@ end
27
27
 
28
28
  require 'rake/testtask'
29
29
  Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
30
+ test.libs << File.dirname(__FILE__) << 'lib' << 'test'
31
31
  test.pattern = 'test/**/*_test.rb'
32
32
  test.verbose = true
33
33
  end
@@ -49,12 +49,11 @@ task :test => :check_dependencies
49
49
 
50
50
  task :default => :test
51
51
 
52
- require 'rake/rdoctask'
53
- Rake::RDocTask.new do |rdoc|
54
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
55
-
56
- rdoc.rdoc_dir = 'rdoc'
57
- rdoc.title = "after_timestamps #{version}"
58
- rdoc.rdoc_files.include('README*')
59
- rdoc.rdoc_files.include('lib/**/*.rb')
52
+ begin
53
+ require 'yard'
54
+ YARD::Rake::YardocTask.new
55
+ rescue LoadError
56
+ task :yardoc do
57
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
58
+ end
60
59
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{after_timestamps}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Elliot Winkler"]
12
- s.date = %q{2010-01-07}
12
+ s.date = %q{2010-01-09}
13
13
  s.description = %q{Plugin for Ruby on Rails that gives you a way to add a callback to the ActiveRecord callback chain that will be executed right after the record's timestamp columns are set, but before the record is actually saved to the database. This is useful if you want to do something with the timestamps, such as defaulting another time column to created_at, or rolling back a timestamp by a certain amount.}
14
14
  s.email = %q{elliot.winkler@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
20
20
  "Rakefile",
21
21
  "after_timestamps.gemspec",
22
22
  "lib/mcmire/after_timestamps.rb",
23
- "lib/mcmire/after_timestamps/version.rb",
24
23
  "rails/init.rb",
25
24
  "test/after_timestamps_test.rb",
26
25
  "test/helper.rb"
@@ -40,24 +39,24 @@ Gem::Specification.new do |s|
40
39
  s.specification_version = 3
41
40
 
42
41
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
43
- s.add_runtime_dependency(%q<activerecord>, [">= 1.2.6"])
44
- s.add_development_dependency(%q<mcmire-context>, [">= 0.5.6"])
45
- s.add_development_dependency(%q<mcmire-matchy>, [">= 0.4.1"])
46
- s.add_development_dependency(%q<rr>, [">= 0.10.5"])
47
- s.add_development_dependency(%q<rr-matchy>, [">= 0.1.0"])
42
+ s.add_runtime_dependency(%q<activerecord>, ["< 3.0"])
43
+ s.add_development_dependency(%q<mcmire-protest>, ["~> 0.2.4"])
44
+ s.add_development_dependency(%q<mcmire-matchy>, ["~> 0.4.1"])
45
+ s.add_development_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
46
+ s.add_development_dependency(%q<mocha-protest-integration>, [">= 0"])
48
47
  else
49
- s.add_dependency(%q<activerecord>, [">= 1.2.6"])
50
- s.add_dependency(%q<mcmire-context>, [">= 0.5.6"])
51
- s.add_dependency(%q<mcmire-matchy>, [">= 0.4.1"])
52
- s.add_dependency(%q<rr>, [">= 0.10.5"])
53
- s.add_dependency(%q<rr-matchy>, [">= 0.1.0"])
48
+ s.add_dependency(%q<activerecord>, ["< 3.0"])
49
+ s.add_dependency(%q<mcmire-protest>, ["~> 0.2.4"])
50
+ s.add_dependency(%q<mcmire-matchy>, ["~> 0.4.1"])
51
+ s.add_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
52
+ s.add_dependency(%q<mocha-protest-integration>, [">= 0"])
54
53
  end
55
54
  else
56
- s.add_dependency(%q<activerecord>, [">= 1.2.6"])
57
- s.add_dependency(%q<mcmire-context>, [">= 0.5.6"])
58
- s.add_dependency(%q<mcmire-matchy>, [">= 0.4.1"])
59
- s.add_dependency(%q<rr>, [">= 0.10.5"])
60
- s.add_dependency(%q<rr-matchy>, [">= 0.1.0"])
55
+ s.add_dependency(%q<activerecord>, ["< 3.0"])
56
+ s.add_dependency(%q<mcmire-protest>, ["~> 0.2.4"])
57
+ s.add_dependency(%q<mcmire-matchy>, ["~> 0.4.1"])
58
+ s.add_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
59
+ s.add_dependency(%q<mocha-protest-integration>, [">= 0"])
61
60
  end
62
61
  end
63
62
 
@@ -72,6 +72,8 @@ module Mcmire
72
72
  # update_without_timestamps to do what we want.
73
73
  #
74
74
  module AfterTimestamps
75
+ VERSION = "0.2.0"
76
+
75
77
  def self.included(klass)
76
78
  klass.class_eval do
77
79
  alias_method_chain :create_without_timestamps, :after_timestamps
@@ -1,4 +1,4 @@
1
- require 'activerecord'
1
+ require 'active_record'
2
2
 
3
3
  require 'mcmire/after_timestamps'
4
4
 
@@ -5,12 +5,14 @@ ActiveRecord::Base.establish_connection(
5
5
  "database" => ":memory:"
6
6
  )
7
7
 
8
- ActiveRecord::Schema.define do
9
- create_table :posts do |t|
10
- t.timestamps
11
- t.datetime :posted_at, :null => false
12
- t.string :formatted_created_at
13
- t.integer :timestamp
8
+ ActiveRecord::Migration.suppress_messages do
9
+ ActiveRecord::Schema.define do
10
+ create_table :posts do |t|
11
+ t.timestamps
12
+ t.datetime :posted_at, :null => false
13
+ t.string :formatted_created_at
14
+ t.integer :timestamp
15
+ end
14
16
  end
15
17
  end
16
18
 
@@ -28,30 +30,30 @@ class Post < ActiveRecord::Base
28
30
  end
29
31
  end
30
32
 
31
- class AfterTimestampsTest < Test::Unit::TestCase
33
+ Protest.context("after_timestamps") do
32
34
  test "after_timestamps_on_create symbol is called on create" do
33
- stub(Time).now { Time.local(2009) }
35
+ Time.stubs(:now).returns(Time.local(2009))
34
36
  post = Post.new
35
37
  post.save!
36
38
  post.posted_at.should == Time.local(2009)
37
39
  end
38
40
 
39
41
  test "after_timestamps_on_create proc is called on create" do
40
- stub(Time).now { Time.local(2009) }
42
+ Time.stubs(:now).returns(Time.local(2009))
41
43
  post = Post.new
42
44
  post.save!
43
45
  post.formatted_created_at.should == "Jan/2009-01 01/01/09 0000..00"
44
46
  end
45
47
 
46
48
  test "after_timestamps_on_update symbol is called on update" do
47
- stub(Time).now { Time.local(2009) }
49
+ Time.stubs(:now).returns(Time.local(2009))
48
50
  post = Post.create!
49
51
  post.save!
50
52
  post.posted_at.should == Time.local(2008, 12, 30)
51
53
  end
52
54
 
53
55
  test "after_timestamp_on_update proc is called on update" do
54
- stub(Time).now { Time.local(2009) }
56
+ Time.stubs(:now).returns(Time.local(2009))
55
57
  post = Post.create!
56
58
  post.save!
57
59
  post.timestamp.should == 1230789600
@@ -1,15 +1,11 @@
1
1
  require 'rubygems'
2
2
 
3
- require 'test/unit'
4
- gem 'mcmire-context'
5
- require 'context'
3
+ gem 'mcmire-protest'
4
+ require 'protest'
6
5
  gem 'mcmire-matchy'
7
6
  require 'matchy'
8
- require 'rr-matchy'
7
+ gem 'mcmire-mocha'
8
+ require 'mocha'
9
+ require 'mocha-protest-integration'
9
10
 
10
- require 'rails/init'
11
-
12
- class Test::Unit::TestCase
13
- include RR::Adapters::TestUnit
14
- include RRMatchy
15
- end
11
+ require 'rails/init'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: after_timestamps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Winkler
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-07 00:00:00 -06:00
12
+ date: 2010-01-09 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,19 +18,19 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - <
22
22
  - !ruby/object:Gem::Version
23
- version: 1.2.6
23
+ version: "3.0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: mcmire-context
26
+ name: mcmire-protest
27
27
  type: :development
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.6
33
+ version: 0.2.4
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: mcmire-matchy
@@ -38,29 +38,29 @@ dependencies:
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.4.1
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
- name: rr
46
+ name: mcmire-mocha
47
47
  type: :development
48
48
  version_requirement:
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 0.10.5
53
+ version: 0.9.8
54
54
  version:
55
55
  - !ruby/object:Gem::Dependency
56
- name: rr-matchy
56
+ name: mocha-protest-integration
57
57
  type: :development
58
58
  version_requirement:
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 0.1.0
63
+ version: "0"
64
64
  version:
65
65
  description: Plugin for Ruby on Rails that gives you a way to add a callback to the ActiveRecord callback chain that will be executed right after the record's timestamp columns are set, but before the record is actually saved to the database. This is useful if you want to do something with the timestamps, such as defaulting another time column to created_at, or rolling back a timestamp by a certain amount.
66
66
  email: elliot.winkler@gmail.com
@@ -75,7 +75,6 @@ files:
75
75
  - Rakefile
76
76
  - after_timestamps.gemspec
77
77
  - lib/mcmire/after_timestamps.rb
78
- - lib/mcmire/after_timestamps/version.rb
79
78
  - rails/init.rb
80
79
  - test/after_timestamps_test.rb
81
80
  - test/helper.rb
@@ -1,5 +0,0 @@
1
- module Mcmire
2
- module AfterTimestamps
3
- VERSION = "0.1.0"
4
- end
5
- end