public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
port membership_test to membership_spec

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@3053 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Nov 23 18:44:05 -0800 2007
commit  3f0212ed4514a89bd3b4178cc308f488432254d9
tree    739d6694ecced79908785f713e6c2d3c046f3d56
parent  81dd998b82020e38841198e896bb84b700033cd7
...
2
3
4
 
 
 
 
 
 
 
 
 
 
 
 
 
5
6
7
...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
@@ -2,6 +2,19 @@
0
   # only put minimal, core models in here if specs require interaction
0
   # with lots of models
0
   
0
+ time 2007, 6, 15
0
+
0
+ model Site do
0
+ stub :title => "Mephisto", :host => 'test.host', :filter => 'textile_filter', :approve_comments => false,
0
+ :comment_age => 30, :timezone => "America/New_York", :articles_per_page => 15, :permalink_style => ":year/:month/:day/:permalink",
0
+ :tag_path => 'tags', :search_path => 'search', :current_theme_path => 'current'
0
+ end
0
+
0
+ model User do
0
+ stub :login => 'quentin', :email => 'quentin@example.com', :filter => 'textile_filter', :token => 'quentintoken', :admin => true,
0
+ :salt => '7e3041ebc2fc05a40c60028e2c4901a81035d3cd', :crypted_password => '00742970dc9e6319f8019fd54864d3ea740f04b1'
0
+ end
0
+
0
   # model Article do
0
   # stub :title => 'foobar'
0
   # end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0
@@ -1 +1,40 @@
0
+require File.dirname(__FILE__) + '/../spec_helper'
0
+
0
+describe Membership do
0
+ define_models do
0
+ model Site do
0
+ stub :cupcake, :title => "Cupcake", :host => 'cupcake.com'
0
+ end
0
+
0
+ model User do
0
+ stub :non_admin, :login => 'arthur', :admin => false
0
+ stub :deleted, :login => "aaron", :admin => false, :deleted_at => current_time - 5.minutes
0
+ end
0
+
0
+ model Membership do
0
+ stub :admin_on_default, :site => all_stubs(:site), :user => all_stubs(:user), :admin => true
0
+ stub :admin_on_cupcake, :site => all_stubs(:cupcake_site), :user => all_stubs(:user), :admin => true
0
+ stub :user_on_default, :site => all_stubs(:site), :user => all_stubs(:non_admin_user), :admin => false
0
+ stub :deleted_on_default, :site => all_stubs(:site), :user => all_stubs(:deleted_user), :admin => false
0
+ end
0
+ end
0
+
0
+ it "finds user sites" do
0
+ users(:default).sites.sort_by { |s| s.title }.should == [sites(:cupcake), sites(:default)]
0
+ end
0
+
0
+ it "finds site members" do
0
+ sites(:default).members.sort_by { |u| u.login }.should == [users(:non_admin), users(:default)]
0
+ User.find_all_by_site(sites(:default)).sort_by { |u| u.login }.should == [users(:non_admin), users(:default)]
0
+ end
0
+
0
+ it "finds site admins" do
0
+ sites(:default).admins.should == [users(:default)]
0
+ end
0
+
0
+ it "finds all users with deleted" do
0
+ sites(:default).users_with_deleted.sort_by { |u| u.login }.should == [users(:deleted), users(:non_admin), users(:default)]
0
+ User.find_all_by_site_with_deleted(sites(:default)).sort_by { |u| u.login }.should == [users(:deleted), users(:non_admin), users(:default)]
0
+ end
0
+end
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
+# DEPRECATED, see spec/filters/absolute_url_spec.rb
0
+
0
 context "Default Url" do
0
   include Mephisto::Liquid::UrlMethods
0
   
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
+# DEPRECATED, see spec/models/membership_spec.rb
0
+
0
 class MembershipTest < Test::Unit::TestCase
0
   fixtures :memberships, :users, :sites
0
 

Comments

    No one has commented yet.