publish 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  ## Next Release (branch: master)
4
4
 
5
- ### Improvements
5
+ * Create a todo list
6
6
 
7
- * Now supports mongoid master
7
+ ## 0.1.2 - 2013-03-04
8
8
 
9
- * Callbacks (after_publish, before_publish).
9
+ * Define scopes as lazy to prevent it from using class loading date instead of scope calling date (it will be default in rails 4)
10
+
11
+ * Now supports mongoid master
12
+
13
+ ## 0.1.1 - 2012-10-02
14
+
15
+ * Callbacks (after_publish, before_publish) (lucas renan) - resolve issue #4
10
16
 
11
17
  ## 0.1.0 - 2012-09-04
12
18
 
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "factory_girl_rails", "~> 3.5.0"
5
+ gem "factory_girl_rails", "~> 4.2.0"
6
6
  gem "colorific", "~> 1.0.2"
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Publish [![Build Status](https://secure.travis-ci.org/lucasrenan/publish.png?branch=master)](http://travis-ci.org/lucasrenan/publish) [![Build Status](https://gemnasium.com/lucasrenan/publish.png)](http://gemnasium.com/lucasrenan/publish) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/lucasrenan/publish)
1
+ # Publish [![Build Status](https://secure.travis-ci.org/lucasrenan/publish.png?branch=master)](http://travis-ci.org/lucasrenan/publish) [![Build Status](https://gemnasium.com/lucasrenan/publish.png)](http://gemnasium.com/lucasrenan/publish) [![Code Climate](https://codeclimate.com/github/lucasrenan/publish.png)](https://codeclimate.com/github/lucasrenan/publish)
2
2
 
3
3
 
4
4
  Publish is a gem that adds the common functionality to publish (or set as draft) a document using Mongoid.
@@ -8,7 +8,7 @@ Publish is a gem that adds the common functionality to publish (or set as draft)
8
8
  Add to Gemfile
9
9
 
10
10
  ``` ruby
11
- gem "publish", "~> 0.1.0"
11
+ gem "publish", "~> 0.1.2"
12
12
  ```
13
13
 
14
14
  Then run
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  require 'rake'
10
- require 'rake/rdoctask'
10
+ require 'rdoc/task'
11
11
 
12
12
  require 'rake/testtask'
13
13
 
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'mongoid', github: 'mongoid/mongoid'
4
4
 
5
- gem 'factory_girl_rails', '~> 3.5.0'
5
+ gem 'factory_girl_rails', '~> 4.2.0'
6
6
  gem 'colorific', '~> 1.0.2'
7
7
 
8
8
  gemspec path: '../'
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Publish
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -5,9 +5,9 @@ module Mongoid
5
5
  included do
6
6
  field :published_at, :type => Date
7
7
  field :published, :type => Boolean, :default => false
8
-
9
- scope :published, where(:published => true, :published_at.lte => Date.today)
10
- scope :published_and_orderly, where(:published => true, :published_at.lte => Date.today).desc(:published_at, :created_at)
8
+
9
+ scope :published, -> { where(:published => true, :published_at.lte => Date.today) }
10
+ scope :published_and_orderly, -> { where(:published => true, :published_at.lte => Date.today).desc(:published_at, :created_at) }
11
11
 
12
12
  before_save :set_published_at
13
13
  end
data/publish.gemspec CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
18
18
  gem.platform = Gem::Platform::RUBY
19
19
 
20
20
 
21
- gem.add_dependency "mongoid", ">= 3.0.0"
21
+ gem.add_dependency "mongoid", ">= 3.1.0"
22
22
 
23
23
  gem.add_development_dependency "rails", "~> 3.2.0"
24
- gem.add_development_dependency "rake", "~> 0.9"
25
- gem.add_development_dependency "simplecov", "~> 0.6.1"
24
+ gem.add_development_dependency "rake", "~> 10.0"
25
+ gem.add_development_dependency "simplecov", "~> 0.7.0"
26
26
  end
@@ -4,7 +4,7 @@ class CallbacksTest < ActiveSupport::TestCase
4
4
 
5
5
  setup do
6
6
  @klass = Product
7
- @product = FactoryGirl.build(:product)
7
+ @product = build(:product)
8
8
  end
9
9
 
10
10
  test "should includes the before_publish callback" do
@@ -3,7 +3,7 @@ require File.expand_path("../../../test_helper", __FILE__)
3
3
  class PublishTest < ActiveSupport::TestCase
4
4
 
5
5
  setup do
6
- @post = FactoryGirl.create(:post)
6
+ @post = create(:post)
7
7
  end
8
8
 
9
9
  test "should create published at field" do
@@ -17,7 +17,7 @@ class PublishTest < ActiveSupport::TestCase
17
17
  end
18
18
 
19
19
  test "should be unpublished if published at is not setted" do
20
- post = FactoryGirl.build(:post)
20
+ post = build(:post)
21
21
  post.published = true
22
22
 
23
23
  assert_equal post.published?, false
@@ -33,21 +33,21 @@ class PublishTest < ActiveSupport::TestCase
33
33
  end
34
34
 
35
35
  test "should return published posts" do
36
- 2.times { FactoryGirl.create(:post, :published => true) }
36
+ 2.times { create(:post, :published => true) }
37
37
 
38
38
  assert_equal Post.published.size, 2
39
39
  end
40
40
 
41
41
  test "should return orderly published posts" do
42
- FactoryGirl.create(:post, :title => "2", :published => true, :published_at => 1.month.ago)
43
- FactoryGirl.create(:post, :title => "3", :published => true, :published_at => 1.year.ago)
44
- FactoryGirl.create(:post, :title => "1", :published => true, :published_at => 1.day.ago)
42
+ create(:post, :title => "2", :published => true, :published_at => 1.month.ago)
43
+ create(:post, :title => "3", :published => true, :published_at => 1.year.ago)
44
+ create(:post, :title => "1", :published => true, :published_at => 1.day.ago)
45
45
 
46
46
  assert_equal Post.published_and_orderly.map(&:title), ["1", "2", "3"]
47
47
  end
48
48
 
49
49
  test "should publish a post" do
50
- post = FactoryGirl.build(:post)
50
+ post = build(:post)
51
51
  post.publish!
52
52
  post.reload
53
53
 
@@ -56,8 +56,8 @@ class PublishTest < ActiveSupport::TestCase
56
56
  end
57
57
 
58
58
  test "should concat with criteria methods" do
59
- FactoryGirl.create(:post, :published => true, :title => "normal post")
60
- FactoryGirl.create(:post, :published => true, :title => "my special post")
59
+ create(:post, :published => true, :title => "normal post")
60
+ create(:post, :published => true, :title => "my special post")
61
61
 
62
62
  assert_equal Post.where(:title => /special/).published.count, 1
63
63
  assert_equal Post.published.where(:title => /special/).count, 1
data/test/test_helper.rb CHANGED
@@ -20,6 +20,8 @@ Rails.backtrace_cleaner.remove_silencers!
20
20
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
21
21
 
22
22
  class ActiveSupport::TestCase
23
+ include FactoryGirl::Syntax::Methods
24
+
23
25
  teardown do
24
26
  Mongoid.default_session.collections.select {|c| c.name !~ /system/ }.each(&:drop)
25
27
  end
@@ -29,4 +31,4 @@ class ActionController::TestCase
29
31
  teardown do
30
32
  Mongoid.default_session.collections.select {|c| c.name !~ /system/ }.each(&:drop)
31
33
  end
32
- end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-10-03 00:00:00.000000000 Z
14
+ date: 2013-03-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: mongoid
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ! '>='
22
22
  - !ruby/object:Gem::Version
23
- version: 3.0.0
23
+ version: 3.1.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ! '>='
30
30
  - !ruby/object:Gem::Version
31
- version: 3.0.0
31
+ version: 3.1.0
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: rails
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: '0.9'
55
+ version: '10.0'
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- version: '0.9'
63
+ version: '10.0'
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: simplecov
66
66
  requirement: !ruby/object:Gem::Requirement
@@ -68,7 +68,7 @@ dependencies:
68
68
  requirements:
69
69
  - - ~>
70
70
  - !ruby/object:Gem::Version
71
- version: 0.6.1
71
+ version: 0.7.0
72
72
  type: :development
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
@@ -76,7 +76,7 @@ dependencies:
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- version: 0.6.1
79
+ version: 0.7.0
80
80
  description: Adds the functionality to publish/unpublish mongoid docs
81
81
  email:
82
82
  - contato@lucasrenan.com
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 1.8.24
168
+ rubygems_version: 1.8.25
169
169
  signing_key:
170
170
  specification_version: 3
171
171
  summary: Adds the functionality to publish/unpublish mongoid docs