Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 2832 Bytes
1 | require File.dirname(__FILE__) + '/../spec_helper' |
2 | |
3 | context 'With the contents and users fixtures loaded' do |
4 | fixtures :users, :contents, :blogs |
5 | |
6 | setup do |
7 | User.stub!(:salt).and_return('change-me') |
8 | end |
9 | |
10 | specify 'Calling User.authenticate with a valid user/password combo returns a user' do |
11 | User.authenticate('bob', 'test').should == users(:bob) |
12 | end |
13 | |
14 | specify 'User.authenticate(user,invalid) returns nil' do |
15 | User.authenticate('bob', 'wrong password').should_be nil |
16 | end |
17 | |
18 | specify 'User.authenticate(invalid,whatever) returns nil' do |
19 | User.authenticate('userwhodoesnotexist', 'what ever').should_be nil |
20 | end |
21 | |
22 | specify 'The various article finders work appropriately' do |
23 | User.find(1).articles.size.should == 8 |
24 | # User.find(1).articles.find_published.size.should == Article.find(:all, :conditions => {:published => true}).size |
25 | User.find(1).articles.published.size == 7 |
26 | end |
27 | |
28 | specify 'authenticate? works as expected' do |
29 | User.should_authenticate('bob', 'test') |
30 | User.should_not_authenticate('bob', 'duff password') |
31 | end |
32 | end |
33 | |
34 | context 'With a new user' do |
35 | setup do |
36 | @user = User.new :login => 'not_bob' |
37 | set_password 'a secure password' |
38 | end |
39 | |
40 | specify 'password cannot be too short' do |
41 | set_password 'tiny' |
42 | @user.should_not_be_valid |
43 | @user.errors.should_be_invalid('password') |
44 | end |
45 | |
46 | specify 'password cannot be too long' do |
47 | set_password 'x' * 80 |
48 | @user.should_not_be_valid |
49 | @user.errors.should_be_invalid('password') |
50 | end |
51 | |
52 | specify 'password cannot be blank' do |
53 | set_password '' |
54 | @user.should_not_be_valid |
55 | @user.errors.should_be_invalid('password') |
56 | end |
57 | |
58 | specify 'password can be just right' do |
59 | set_password 'Just right' |
60 | @user.should_be_valid |
61 | end |
62 | |
63 | specify 'login cannot be too short' do |
64 | @user.login = 'x' |
65 | @user.should_not_be_valid |
66 | @user.errors.should_be_invalid('login') |
67 | end |
68 | |
69 | specify 'login cannot be too long' do |
70 | @user.login = 'repetitivebob' * 10 |
71 | @user.should_not_be_valid |
72 | @user.errors.should_be_invalid('login') |
73 | end |
74 | |
75 | specify 'login cannot be blank' do |
76 | @user.login = '' |
77 | @user.should_not_be_valid |
78 | @user.errors.should_be_invalid('login') |
79 | end |
80 | |
81 | specify 'login can be just right' do |
82 | @user.login = 'okbob' |
83 | @user.should_be_valid |
84 | end |
85 | |
86 | def set_password(newpass) |
87 | @user.password = @user.password_confirmation = newpass |
88 | end |
89 | end |
90 | |
91 | context 'With a user, "bob" in the database' do |
92 | setup do |
93 | User.delete_all |
94 | u = User.new(:login => 'bob') |
95 | u.password = u.password_confirmation = 'secure password' |
96 | u.save! |
97 | end |
98 | |
99 | specify 'should not be able to create another user with the same login' do |
100 | u = User.new(:login => 'bob') {|u| u.password = u.password_confirmation = 'secure password'} |
101 | |
102 | u.should_not_be_valid |
103 | u.errors.should_be_invalid('login') |
104 | end |
105 | end |