summaryrefslogtreecommitdiff
path: root/vendor/plugins/will_paginate/test/fixtures
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-02-17 12:47:49 +0100
committerhukl <contact@smyck.org>2009-02-17 12:47:49 +0100
commit3cdcb5ca02a94b2b342c30903a27d47d35d46e55 (patch)
treeef3e1154fe262561b3955c07edcaee3824a21f47 /vendor/plugins/will_paginate/test/fixtures
parent7a282f2605f6fb3689940e5c7072b4801653deb2 (diff)
added will_paginate plugin
Diffstat (limited to 'vendor/plugins/will_paginate/test/fixtures')
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/admin.rb3
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/developer.rb14
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/developers_projects.yml13
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/project.rb15
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/projects.yml6
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/replies.yml29
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/reply.rb7
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/topic.rb10
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/topics.yml30
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/user.rb2
-rw-r--r--vendor/plugins/will_paginate/test/fixtures/users.yml35
11 files changed, 164 insertions, 0 deletions
diff --git a/vendor/plugins/will_paginate/test/fixtures/admin.rb b/vendor/plugins/will_paginate/test/fixtures/admin.rb
new file mode 100644
index 00000000..1d5e7f36
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/admin.rb
@@ -0,0 +1,3 @@
1class Admin < User
2 has_many :companies, :finder_sql => 'SELECT * FROM companies'
3end
diff --git a/vendor/plugins/will_paginate/test/fixtures/developer.rb b/vendor/plugins/will_paginate/test/fixtures/developer.rb
new file mode 100644
index 00000000..0224f4bf
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/developer.rb
@@ -0,0 +1,14 @@
1class Developer < User
2 has_and_belongs_to_many :projects, :include => :topics, :order => 'projects.name'
3
4 def self.with_poor_ones(&block)
5 with_scope :find => { :conditions => ['salary <= ?', 80000], :order => 'salary' } do
6 yield
7 end
8 end
9
10 named_scope :distinct, :select => 'DISTINCT `users`.*'
11 named_scope :poor, :conditions => ['salary <= ?', 80000], :order => 'salary'
12
13 def self.per_page() 10 end
14end
diff --git a/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml b/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
new file mode 100644
index 00000000..cee359c7
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
@@ -0,0 +1,13 @@
1david_action_controller:
2 developer_id: 1
3 project_id: 2
4 joined_on: 2004-10-10
5
6david_active_record:
7 developer_id: 1
8 project_id: 1
9 joined_on: 2004-10-10
10
11jamis_active_record:
12 developer_id: 2
13 project_id: 1 \ No newline at end of file
diff --git a/vendor/plugins/will_paginate/test/fixtures/project.rb b/vendor/plugins/will_paginate/test/fixtures/project.rb
new file mode 100644
index 00000000..0f85ef5e
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/project.rb
@@ -0,0 +1,15 @@
1class Project < ActiveRecord::Base
2 has_and_belongs_to_many :developers, :uniq => true
3
4 has_many :topics
5 # :finder_sql => 'SELECT * FROM topics WHERE (topics.project_id = #{id})',
6 # :counter_sql => 'SELECT COUNT(*) FROM topics WHERE (topics.project_id = #{id})'
7
8 has_many :replies, :through => :topics do
9 def find_recent(params = {})
10 with_scope :find => { :conditions => ['replies.created_at > ?', 15.minutes.ago] } do
11 find :all, params
12 end
13 end
14 end
15end
diff --git a/vendor/plugins/will_paginate/test/fixtures/projects.yml b/vendor/plugins/will_paginate/test/fixtures/projects.yml
new file mode 100644
index 00000000..74f3c32f
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/projects.yml
@@ -0,0 +1,6 @@
1active_record:
2 id: 1
3 name: Active Record
4action_controller:
5 id: 2
6 name: Active Controller
diff --git a/vendor/plugins/will_paginate/test/fixtures/replies.yml b/vendor/plugins/will_paginate/test/fixtures/replies.yml
new file mode 100644
index 00000000..9a83c004
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/replies.yml
@@ -0,0 +1,29 @@
1witty_retort:
2 id: 1
3 topic_id: 1
4 content: Birdman is better!
5 created_at: <%= 6.hours.ago.to_s(:db) %>
6
7another:
8 id: 2
9 topic_id: 2
10 content: Nuh uh!
11 created_at: <%= 1.hour.ago.to_s(:db) %>
12
13spam:
14 id: 3
15 topic_id: 1
16 content: Nice site!
17 created_at: <%= 1.hour.ago.to_s(:db) %>
18
19decisive:
20 id: 4
21 topic_id: 4
22 content: "I'm getting to the bottom of this"
23 created_at: <%= 30.minutes.ago.to_s(:db) %>
24
25brave:
26 id: 5
27 topic_id: 4
28 content: "AR doesn't scare me a bit"
29 created_at: <%= 10.minutes.ago.to_s(:db) %>
diff --git a/vendor/plugins/will_paginate/test/fixtures/reply.rb b/vendor/plugins/will_paginate/test/fixtures/reply.rb
new file mode 100644
index 00000000..ecaf3c1f
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/reply.rb
@@ -0,0 +1,7 @@
1class Reply < ActiveRecord::Base
2 belongs_to :topic, :include => [:replies]
3
4 named_scope :recent, :conditions => ['replies.created_at > ?', 15.minutes.ago]
5
6 validates_presence_of :content
7end
diff --git a/vendor/plugins/will_paginate/test/fixtures/topic.rb b/vendor/plugins/will_paginate/test/fixtures/topic.rb
new file mode 100644
index 00000000..2c2ce722
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/topic.rb
@@ -0,0 +1,10 @@
1class Topic < ActiveRecord::Base
2 has_many :replies, :dependent => :destroy, :order => 'replies.created_at DESC'
3 belongs_to :project
4
5 named_scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%']
6
7 named_scope :with_replies_starting_with, lambda { |text|
8 { :conditions => "replies.content LIKE '#{text}%' ", :include => :replies }
9 }
10end
diff --git a/vendor/plugins/will_paginate/test/fixtures/topics.yml b/vendor/plugins/will_paginate/test/fixtures/topics.yml
new file mode 100644
index 00000000..0a269047
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/topics.yml
@@ -0,0 +1,30 @@
1futurama:
2 id: 1
3 title: Isnt futurama awesome?
4 subtitle: It really is, isnt it.
5 content: I like futurama
6 created_at: <%= 1.day.ago.to_s(:db) %>
7 updated_at:
8
9harvey_birdman:
10 id: 2
11 title: Harvey Birdman is the king of all men
12 subtitle: yup
13 content: He really is
14 created_at: <%= 2.hours.ago.to_s(:db) %>
15 updated_at:
16
17rails:
18 id: 3
19 project_id: 1
20 title: Rails is nice
21 subtitle: It makes me happy
22 content: except when I have to hack internals to fix pagination. even then really.
23 created_at: <%= 20.minutes.ago.to_s(:db) %>
24
25ar:
26 id: 4
27 project_id: 1
28 title: ActiveRecord sometimes freaks me out
29 content: "I mean, what's the deal with eager loading?"
30 created_at: <%= 15.minutes.ago.to_s(:db) %>
diff --git a/vendor/plugins/will_paginate/test/fixtures/user.rb b/vendor/plugins/will_paginate/test/fixtures/user.rb
new file mode 100644
index 00000000..4a57cf07
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/user.rb
@@ -0,0 +1,2 @@
1class User < ActiveRecord::Base
2end
diff --git a/vendor/plugins/will_paginate/test/fixtures/users.yml b/vendor/plugins/will_paginate/test/fixtures/users.yml
new file mode 100644
index 00000000..ed2c03ae
--- /dev/null
+++ b/vendor/plugins/will_paginate/test/fixtures/users.yml
@@ -0,0 +1,35 @@
1david:
2 id: 1
3 name: David
4 salary: 80000
5 type: Developer
6
7jamis:
8 id: 2
9 name: Jamis
10 salary: 150000
11 type: Developer
12
13<% for digit in 3..10 %>
14dev_<%= digit %>:
15 id: <%= digit %>
16 name: fixture_<%= digit %>
17 salary: 100000
18 type: Developer
19<% end %>
20
21poor_jamis:
22 id: 11
23 name: Jamis
24 salary: 9000
25 type: Developer
26
27admin:
28 id: 12
29 name: admin
30 type: Admin
31
32goofy:
33 id: 13
34 name: Goofy
35 type: Admin