by_star 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ class Tag < ActiveRecord::Base
12
12
  end
13
13
 
14
14
  class Event < ActiveRecord::Base
15
- named_scope :private, :conditions => { :public => false }
15
+ named_scope :secret, :conditions => { :public => false }
16
16
  end
17
17
 
18
18
  class Invoice < ActiveRecord::Base
@@ -28,22 +28,24 @@ end
28
28
 
29
29
  ## seed data:
30
30
 
31
+ [Post, Event, Invoice, Tag, DayEntry].map(&:delete_all)
32
+
31
33
  year = Time.zone.now.year
32
34
 
33
35
  1.upto(12) do |month|
34
36
  month.times do |n|
35
- Post.factory "post #{n}", Time.local(year, month, 1)
37
+ Post.factory "post #{month}-#{n}", Time.zone.now.beginning_of_year + (month - 1).months
36
38
  end
37
39
  end
38
40
 
39
41
  1.upto(12) do |month|
40
42
  month.times do |n|
41
- Invoice.factory n * 1000 + 1000, Time.local(year, month, 1)
43
+ Invoice.factory n * 1000 + 1000, Time.zone.now.beginning_of_year + (month - 1).months
42
44
  end
43
45
  end
44
46
 
45
47
  # Invoice from last year
46
- Invoice.factory 10000, Time.local(Time.now.year-1, 1, 1)
48
+ Invoice.factory 10000, Time.local(Time.zone.now.year-1, 1, 1)
47
49
 
48
50
  # Invoice without a number
49
51
  Invoice.create!(:value => 10000, :number => nil)
@@ -56,7 +58,7 @@ Post.factory "That's it!", Time.zone.now.end_of_year
56
58
 
57
59
  # For by_weekend scoped test
58
60
  # We need to calculate the weekend.
59
- time = Time.now.beginning_of_year
61
+ time = Time.zone.now.beginning_of_year
60
62
  while time.wday != 6
61
63
  time += 1.day
62
64
  end
data/spec/spec_helper.rb CHANGED
@@ -4,34 +4,27 @@ require 'fileutils'
4
4
  require 'logger'
5
5
  FileUtils.mkdir_p("tmp")
6
6
 
7
- ActiveRecord::Base.logger = Logger.new("tmp/activerecord.log")
8
7
  $:.unshift(File.join(File.dirname(__FILE__), "../lib"))
9
8
 
10
9
  require 'active_support'
10
+ require 'active_support/core_ext/string/conversions'
11
11
  require 'by_star'
12
12
  require 'spec'
13
13
 
14
- # Define time zone before loading test_helper
15
- zone = "UTC"
16
- Time.zone = zone
17
- ActiveRecord::Base.default_timezone = zone
18
-
19
- YAML::load_file(File.dirname(__FILE__) + "/database.yml").each do |key, connection|
20
- ActiveRecord::Base.establish_connection(connection)
21
- load File.dirname(__FILE__) + "/fixtures/schema.rb"
22
- load File.dirname(__FILE__) + "/fixtures/models.rb"
23
- end
24
-
25
14
  # bootstraping the plugin through init.rb
26
15
  # tests how it would load in a real application
27
16
  load File.dirname(__FILE__) + "/../rails/init.rb"
17
+
18
+ ActiveRecord::Base.logger = Logger.new("tmp/activerecord.log")
19
+
28
20
  # Print the location of puts/p calls so you can find them later
29
- def puts str
30
- super caller.first if caller.first.index("shoulda.rb") == -1
31
- super str
32
- end
33
21
 
34
- def p obj
35
- puts caller.first
36
- super obj
37
- end
22
+ # def puts str
23
+ # super caller.first if caller.first.index("shoulda.rb") == -1
24
+ # super str
25
+ # end
26
+ #
27
+ # def p obj
28
+ # puts caller.first
29
+ # super obj
30
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: by_star
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-18 00:00:00 +10:00
13
+ date: 2010-01-29 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency