Skip to content
Newer
Older
100644 58 lines (47 sloc) 1.55 KB
68ad1d5 @gleuch adding spec test for retweet.
authored
1 require 'rubygems'
2 require 'sinatra'
3 Sinatra::Application.environment = 'test'
4 require 'spec'
5 require 'sinatra/test/rspec'
6
7 require 'retweet'
8
9 Tweet.auto_migrate!
10 User.auto_migrate!
11
12
13 describe 'Retweet Fucker' do
14 # before(:all) do; end
15
16 # Index
17 it "should show an index" do
18 get '/'
19 @response.should be_ok
20 @response.body.should include('Connect your Twitter account')
21 end
22
23 # Retweeting
24 it "should allow retweet round if passkey is correct" do
25 get "/run/#{configatron.secret_launch_code}"
26 @response.should be_ok
27 @response.body.should_not include('Fuck off')
28 end
29
30 it "should not allow retweet round if passkey is correct" do
31 get "/run/fuck-this-#{configatron.secret_launch_code}"
32 @response.should be_ok
33 @response.body.should include('Fuck off')
34 end
35
36 # Forced retweeting
37 it "should allow forced retweet round if passkey is correct" do
38 get "/forced/#{configatron.secret_launch_code}?msg=TEST"
39 @response.should be_ok
40 @response.body.should_not include('Fuck off')
41 @response.body.should_not include('dumbass')
42 end
43
44 it "should not allow retweet round if no tweet given" do
45 get "/forced/#{configatron.secret_launch_code}"
46 @response.should be_ok
47 @response.body.should_not include('Fuck off')
48 @response.body.should include('dumbass')
49 end
50
51 it "should not allow retweet round if passkey is correct" do
52 get "/forced/fuck-this-#{configatron.secret_launch_code}?msg=TEST"
53 @response.should be_ok
54 @response.body.should include('Fuck off')
55 @response.body.should_not include('dumbass')
56 end
57
58 end
Something went wrong with that request. Please try again.