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:
- 2384 Bytes
1 | require File.dirname(__FILE__) + '/../spec_helper' |
2 | |
3 | context 'With the various trackback filters loaded and DNS mocked out appropriately' do |
4 | setup do |
5 | IPSocket.stub!(:getaddress).and_return { raise SocketError.new("getaddrinfo: Name or service not known") } |
6 | end |
7 | |
8 | specify 'Incomplete trackbacks should not be accepted' do |
9 | tb = Trackback.new(:blog_name => 'Blog name', :title => 'Title', :excerpt => 'Excerpt') |
10 | tb.should_not_be_valid |
11 | tb.errors.should_be_invalid('url') |
12 | |
13 | tb.url = 'http://foo.com' |
14 | tb.should_be_valid |
15 | tb.save |
16 | tb.guid.size.should_be > 15 |
17 | tb.should_not_be_spam |
18 | end |
19 | |
20 | specify 'Trackbacks with a spammy link in the excerpt should be rejected' do |
21 | IPSocket.should_receive(:getaddress).with('chinaaircatering.com.bsb.empty.us').at_least(:once).and_return('127.0.0.2') |
22 | |
23 | tb = Trackback.new(ham_params.merge(:excerpt => '<a href="http://chinaaircatering.com">spam</a>')) |
24 | tb.should_be_spam |
25 | end |
26 | |
27 | specify 'Trackbacks with a spammy source url should be rejected' do |
28 | add_spam_domain |
29 | tb = Trackback.new(ham_params.merge(:url => 'http://www.chinaircatering.com')) |
30 | tb.should_be_spam |
31 | end |
32 | |
33 | specify 'Trackbacks from a spammy ip address should be rejected' do |
34 | add_spam_ip('212.42.230.207') |
35 | tb = Trackback.new(ham_params.merge(:ip => '212.42.230.207')) |
36 | tb.should_be_spam |
37 | end |
38 | |
39 | specify 'Trackbacks with a blacklisted pattern in the excerpt should be rejected' do |
40 | BlacklistPattern.should_receive(:find).with(:all).at_least(:once)\ |
41 | .and_return([StringPattern.new(:pattern => 'poker'), |
42 | RegexPattern.new(:pattern => '^Texas')]) |
43 | Trackback.new(ham_params.merge(:excerpt => 'Mmm... come to my shiny poker site')).should_be_spam |
44 | Trackback.new(ham_params.merge(:excerpt => 'Texas hold-em rules!')).should_be_spam |
45 | end |
46 | |
47 | def add_spam_domain(domain = 'chinaircatering.com') |
48 | IPSocket.should_receive(:getaddress).with("#{domain}.bsb.empty.us").at_least(:once).and_return('127.0.0.2') |
49 | end |
50 | |
51 | def add_spam_ip(addr = '212.42.230.206') |
52 | rbl_domain = addr.split(/\./).reverse.join('.') + '.opm.blitzed.us' |
53 | IPSocket.should_receive(:getaddress).with(rbl_domain).at_least(:once).and_return('127.0.0.2') |
54 | end |
55 | |
56 | def ham_params |
57 | { :blog_name => 'Blog', :title => 'trackback', :excerpt => 'bland', |
58 | :url => 'http://notaspammer.com', :ip => '212.42.230.206' } |
59 | end |
60 | end |