ismasan-ar_publish_control 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ar_publish_control}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ismael Celis"]
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module ArPublishControl
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'
6
6
  # This is a gem version of http://github.com/avdgaag/acts_as_publishable ( a Rails plugin)
7
7
  # Thanks to Avdaag for his awesome, super readable code which I ripped off for this gem.
8
8
  #
@@ -100,7 +100,7 @@ module ArPublishControl
100
100
  bool = (args.first.nil? ? true : (args.first)) # nil = true by default
101
101
  bool ? {:conditions => published_conditions} : {}
102
102
  }
103
- before_validation :init_publish_date # don't allow empty publish_at
103
+
104
104
  validate :validate_publish_date_consistency
105
105
  before_create :publish_by_default if options[:publish_by_default]
106
106
  end
@@ -146,12 +146,7 @@ module ArPublishControl
146
146
 
147
147
  module InstanceMethods
148
148
 
149
- def publish_at
150
- read_attribute(:publish_at) || Time.now
151
- end
152
-
153
- # Publish at is NOW if not set
154
- def init_publish_date
149
+ def after_initialize
155
150
  write_attribute(:publish_at, Time.now) if publish_at.nil?
156
151
  end
157
152
 
@@ -163,9 +163,9 @@ end
163
163
 
164
164
  describe "new record" do
165
165
  it "should default to Time.now" do
166
- d = Time.now
167
- Time.stub!(:now).and_return d
166
+ # d = Time.now
167
+ # Time.stub!(:now).and_return d
168
168
  a = Article.new
169
- a.publish_at.should == d
169
+ a.publish_at.should_not be_nil
170
170
  end
171
171
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ismasan-ar_publish_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis