by_star 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/database.yml ADDED
@@ -0,0 +1,9 @@
1
+ mysql:
2
+ username: root
3
+ password:
4
+ database: by_star
5
+ adapter: mysql
6
+
7
+ sqlite3:
8
+ adapter: sqlite3
9
+ database: by_star.sqlite3
@@ -15,6 +15,12 @@ class Event < ActiveRecord::Base
15
15
  named_scope :private, :conditions => { :public => false }
16
16
  end
17
17
 
18
+ class Invoice < ActiveRecord::Base
19
+ def self.factory(value, created_at = nil)
20
+ create!(:value => value, :created_at => created_at, :number => value)
21
+ end
22
+ end
23
+
18
24
  ## seed data:
19
25
 
20
26
  year = Time.zone.now.year
@@ -25,6 +31,18 @@ year = Time.zone.now.year
25
31
  end
26
32
  end
27
33
 
34
+ 1.upto(12) do |month|
35
+ month.times do |n|
36
+ Invoice.factory n * 1000 + 1000, Time.local(year, month, 1)
37
+ end
38
+ end
39
+
40
+ # Invoice from last year
41
+ Invoice.factory 10000, Time.local(Time.now.year-1, 1, 1)
42
+
43
+ # Invoice without a number
44
+ Invoice.create!(:value => 10000, :number => nil)
45
+
28
46
  Post.factory "Today's post", Time.zone.now
29
47
  Post.factory "Yesterday's post", Time.zone.now - 1.day
30
48
  Post.factory "Tomorrow's post", Time.zone.now + 1.day
@@ -1,6 +1,12 @@
1
1
  ActiveRecord::Schema.define do
2
2
  self.verbose = false
3
3
 
4
+ create_table :invoices, :force => true do |t|
5
+ t.integer :value
6
+ t.integer :number
7
+ t.timestamps
8
+ end
9
+
4
10
  create_table :posts, :force => true do |t|
5
11
  t.string :text
6
12
  t.timestamps
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,6 @@ require 'rubygems'
2
2
  require 'activerecord'
3
3
  require 'fileutils'
4
4
  FileUtils.mkdir_p("tmp")
5
- ActiveRecord::Base.establish_connection(
6
- :adapter => "sqlite3",
7
- :database => ":memory:"
8
- )
9
5
 
10
6
  ActiveRecord::Base.logger = Logger.new("tmp/activerecord.log")
11
7
  $:.unshift(File.join(File.dirname(__FILE__), "../lib"))
@@ -19,8 +15,11 @@ zone = "UTC"
19
15
  Time.zone = zone
20
16
  ActiveRecord::Base.default_timezone = zone
21
17
 
22
- load File.dirname(__FILE__) + "/fixtures/schema.rb"
23
- load File.dirname(__FILE__) + "/fixtures/models.rb"
18
+ YAML::load_file(File.dirname(__FILE__) + "/database.yml").each do |key, connection|
19
+ ActiveRecord::Base.establish_connection(connection)
20
+ load File.dirname(__FILE__) + "/fixtures/schema.rb"
21
+ load File.dirname(__FILE__) + "/fixtures/models.rb"
22
+ end
24
23
 
25
24
  # bootstraping the plugin through init.rb
26
25
  # tests how it would load in a real application
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.2.5
4
+ version: 0.3.0
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: 2009-10-15 00:00:00 +10:00
13
+ date: 2009-10-17 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -38,9 +38,18 @@ files:
38
38
  - Rakefile
39
39
  - VERSION
40
40
  - by_star.gemspec
41
+ - by_star.sqlite3
41
42
  - lib/by_star.rb
43
+ - lib/calculations.rb
44
+ - lib/calculations/count.rb
45
+ - lib/calculations/sum.rb
46
+ - lib/range_calculations.rb
47
+ - lib/shared.rb
48
+ - lib/time_ext.rb
49
+ - lib/vanilla.rb
42
50
  - rails/init.rb
43
51
  - spec/by_star_spec.rb
52
+ - spec/database.yml
44
53
  - spec/fixtures/models.rb
45
54
  - spec/fixtures/schema.rb
46
55
  - spec/spec_helper.rb