integration_wrapper 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/header.txt +1 -1
- data/lib/integration_wrapper/base.rb +6 -2
- data/lib/integration_wrapper/online_test.rb +11 -6
- data/lib/integration_wrapper.rb +44 -3
- data/test/test_helper.rb +14 -1
- data/test/test_integration_wrapper.rb +11 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -13,7 +13,7 @@ When you call a method 'foo', 'foo_online' or 'foo_offline' will be called,
|
|
13
13
|
depending on the mode currently used.
|
14
14
|
|
15
15
|
== SYNOPSIS:
|
16
|
-
# First, create a directory called '
|
16
|
+
# First, create a directory called 'online' in your 'test' dir which will contain your online tests.
|
17
17
|
|
18
18
|
# lib/internet_wrapper.rb
|
19
19
|
class InternetChecker < IntegrationWrapper::Base
|
@@ -50,7 +50,7 @@ depending on the mode currently used.
|
|
50
50
|
|
51
51
|
== REQUIREMENTS:
|
52
52
|
|
53
|
-
- Rails (Tested with 2.
|
53
|
+
- Rails (Tested with 3.2.13)
|
54
54
|
|
55
55
|
== INSTALL:
|
56
56
|
|
data/header.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###############################################################################
|
2
2
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
3
3
|
# Licensed under the MIT License
|
4
|
-
# Year:
|
4
|
+
# Year: 2013
|
5
5
|
###############################################################################
|
6
6
|
|
@@ -3,9 +3,13 @@
|
|
3
3
|
###############################################################################
|
4
4
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
5
5
|
# Licensed under the MIT License
|
6
|
-
# Year:
|
6
|
+
# Year: 2013
|
7
7
|
###############################################################################
|
8
8
|
|
9
|
+
|
10
|
+
#<Sui88> 67% of girls are stupid
|
11
|
+
#<V-girl> i belong with the other 13%
|
12
|
+
|
9
13
|
# -- end header --
|
10
14
|
# Wrapper that can be used to still properly test online integration with 3rd party tools such as Amazon S3.
|
11
15
|
module IntegrationWrapper
|
@@ -47,7 +51,7 @@ module IntegrationWrapper
|
|
47
51
|
begin
|
48
52
|
self.send name, *args, &block
|
49
53
|
rescue NoMethodError => e
|
50
|
-
puts "Error trying to call method #{name}. Maybe you forgot to add it? I need all methods to be suffixed with either #{IntegrationWrapper::MODE_ONLINE} or #{IntegrationWrapper::MODE_OFFLINE}. Example: foo_online. Methods: #{methods.inspect}. Error was: #{e}."
|
54
|
+
puts "Error trying to call method #{name}. Maybe you forgot to add it? I need all methods to be suffixed with either #{IntegrationWrapper::Base::MODE_ONLINE} or #{IntegrationWrapper::Base::MODE_OFFLINE}. Example: foo_online. Methods: #{methods.inspect}. Error was: #{e}."
|
51
55
|
puts "Trace:"
|
52
56
|
puts e.backtrace
|
53
57
|
raise e
|
@@ -3,11 +3,16 @@
|
|
3
3
|
###############################################################################
|
4
4
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
5
5
|
# Licensed under the MIT License
|
6
|
-
# Year:
|
6
|
+
# Year: 2013
|
7
7
|
###############################################################################
|
8
8
|
|
9
|
+
|
10
|
+
#<Fulgore> whats the complement to a 43 degree angle?
|
11
|
+
#<sparks> My you're looking "acute" today
|
12
|
+
#<Fulgore> fuck you
|
13
|
+
|
9
14
|
# -- end header --
|
10
|
-
require 'test_helper'
|
15
|
+
#require 'test_helper'
|
11
16
|
|
12
17
|
# Nifty class that helps you do online integration tests (e.g. FooTest < OnlineTest)
|
13
18
|
# An online integration test is an integration test that uses your Internet connection
|
@@ -33,19 +38,19 @@ module IntegrationWrapper
|
|
33
38
|
# Switch to online and back. Supplanted by the setup and teardown methods.
|
34
39
|
def switch_to_online_and_back
|
35
40
|
# Go to online
|
36
|
-
IntegrationWrapper.mode = IntegrationWrapper::MODE_ONLINE
|
41
|
+
IntegrationWrapper::Base.mode = IntegrationWrapper::Base::MODE_ONLINE
|
37
42
|
# yield
|
38
43
|
yield
|
39
44
|
# Set it back to offline because other tests will be using this as well.
|
40
|
-
IntegrationWrapper.mode = IntegrationWrapper::MODE_OFFLINE
|
45
|
+
IntegrationWrapper::Base.mode = IntegrationWrapper::Base::MODE_OFFLINE
|
41
46
|
end
|
42
47
|
|
43
48
|
def setup
|
44
|
-
IntegrationWrapper.mode = IntegrationWrapper::MODE_ONLINE
|
49
|
+
IntegrationWrapper::Base.mode = IntegrationWrapper::Base::MODE_ONLINE
|
45
50
|
end
|
46
51
|
|
47
52
|
def teardown
|
48
|
-
IntegrationWrapper.mode = IntegrationWrapper::MODE_OFFLINE
|
53
|
+
IntegrationWrapper::Base.mode = IntegrationWrapper::Base::MODE_OFFLINE
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
data/lib/integration_wrapper.rb
CHANGED
@@ -3,15 +3,56 @@
|
|
3
3
|
###############################################################################
|
4
4
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
5
5
|
# Licensed under the MIT License
|
6
|
-
# Year:
|
6
|
+
# Year: 2013
|
7
7
|
###############################################################################
|
8
8
|
|
9
|
+
|
10
|
+
#<Dark_Fox> Kami: if you changed your name to Kame, you would have a much more interesting name :)
|
11
|
+
#<Kami> Dark_Fox: And if you changed yours to Dark_Fax, you'd have a more communicative name. :)
|
12
|
+
#* Dark_Fox is now known as Dark_Fax
|
13
|
+
#<Kami> It'd be... 'telecommunicative.'
|
14
|
+
#* Dark_Fax makes noises and bitches because he's out of paper ant toner *
|
15
|
+
#<Kami> Oh god, that happened at work today.
|
16
|
+
#<Dark_Fax> FEED MEE!!!
|
17
|
+
#<SailorV> Nuuuuuuuu
|
18
|
+
#* Dark_Fax displays wrong time *
|
19
|
+
#* Dark_Fax rings for no reason *
|
20
|
+
#* Kami is now known as VCR-clock
|
21
|
+
#* Dark_Fax gets a paper jam *
|
22
|
+
#* VCR-clock blinks
|
23
|
+
#* VCR-clock blinks
|
24
|
+
#* VCR-clock blinks
|
25
|
+
#* VCR-clock blinks
|
26
|
+
#* VCR-clock blinks
|
27
|
+
#* VCR-clock blinks
|
28
|
+
#<Dark_Fax> PAPPPERRRRR
|
29
|
+
#* VCR-clock blinks
|
30
|
+
#<Dark_Fax> TOOOOOONEEERRRR
|
31
|
+
#* VCR-clock blinks
|
32
|
+
#<VCR-clock> :)
|
33
|
+
#* Dark_Fax breaks a bearing and bounces around on the counter *
|
34
|
+
#<Dark_Fax> FEEEED ERROORRR!!!! NEED PAPER!!
|
35
|
+
#* Dark_Fax rings again for no reason *
|
36
|
+
#* VCR-clock blinks some more
|
37
|
+
#* SailorV runs and hides becuz there are weirdo's in here
|
38
|
+
#* Dark_Fax chases SailorV * MY PAPER!!! MY PREEESCIOUUUS!!
|
39
|
+
#* VCR-clock blinks
|
40
|
+
#* VCR-clock blinks
|
41
|
+
#<SailorV> EEEE!
|
42
|
+
#* SailorV unplugs the VCR
|
43
|
+
#* VCR-clock has quit IRC
|
44
|
+
#* Dark_Fax is now known as Dark_Fox
|
45
|
+
#<Dark_Fox> ok i think ive peaked the humor of that
|
46
|
+
|
9
47
|
# -- end header --
|
10
48
|
$:.unshift(File.dirname(__FILE__)) unless
|
11
49
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
12
50
|
|
13
51
|
module IntegrationWrapper
|
14
|
-
VERSION = '0.0.
|
52
|
+
VERSION = '0.0.3'
|
15
53
|
end
|
16
54
|
|
17
|
-
|
55
|
+
if defined?(Rails)
|
56
|
+
require 'integration_wrapper/base'
|
57
|
+
require 'integration_wrapper/online_test'
|
58
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -3,9 +3,22 @@
|
|
3
3
|
###############################################################################
|
4
4
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
5
5
|
# Licensed under the MIT License
|
6
|
-
# Year:
|
6
|
+
# Year: 2013
|
7
7
|
###############################################################################
|
8
8
|
|
9
|
+
|
10
|
+
#<third_planet> The other night my friend had some pot and wanted me to smoke it with him, but we had nowhere to smoke it because both our parents were home.
|
11
|
+
#<third-planet> So we drove around looking for a place to park so we could smoke in the car.
|
12
|
+
#<third-planet> We eventually settled on a Wendys parking lot..
|
13
|
+
#<Mr-Butlertron> The logic is all there...
|
14
|
+
#<third-planet> I know, it was a ridiculous idea. We were just desperate and that was the first place to pull off..
|
15
|
+
#<third-planet> So we park in the back of the parking lot under this tree, and it's dark out, so we figure we're secluded enough. We start to light up and a cop pulls in. So we both sit really still and hope the cop will think the car is empty and just parked there. Or that he won't notice.
|
16
|
+
#<third-planet> The cop circles the parking lot once, then parks behind us and we're both freaking out. So Bobby, my friend, takes all the pot and shoves it in the glove compartment. But the car smells like pot, so we figure we're busted.
|
17
|
+
#<third-planet> So Bobby says we've gotta distract the cop from the pot. In a huge flash, he rips his shirt off, undoes my pants and sticks his hand inside. Before I can process what's happening, the cop knocks on my window. Then he looks in and sees Bobby shirtless, with his hand down my pants and turns bright red.
|
18
|
+
#<third-planet> I roll my window down and the cop says in this really flustered voice, his face bright red, "you guys be good now" and walks quickly back to his car and drives off.
|
19
|
+
#<third-planet> He didn't even notice the smell of pot.
|
20
|
+
#<third-planet> We drove home in the most uncomfortable fucking silence ever.
|
21
|
+
|
9
22
|
# -- end header --
|
10
23
|
require 'stringio'
|
11
24
|
require 'test/unit'
|
@@ -3,9 +3,19 @@
|
|
3
3
|
###############################################################################
|
4
4
|
# Author: Commander Johnson <commanderjohnson@gmail.com>
|
5
5
|
# Licensed under the MIT License
|
6
|
-
# Year:
|
6
|
+
# Year: 2013
|
7
7
|
###############################################################################
|
8
8
|
|
9
|
+
|
10
|
+
#<Hiroe> he was dressed as a big fuckin devil
|
11
|
+
#<Hiroe> like, HUGE costume
|
12
|
+
#<Hiroe> 8-foot lizard wings, giant horns on the head
|
13
|
+
#<Hiroe> at some anime con in california
|
14
|
+
#<Hiroe> they were double booked with a southern Baptist group in the same hotel
|
15
|
+
#<Hiroe> he's riding the elevator down to the con space
|
16
|
+
#<Hiroe> doors open, little old baptist woman standing there
|
17
|
+
#<Hiroe> he just says "Going Down" in his best evil voice
|
18
|
+
|
9
19
|
# -- end header --
|
10
20
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
11
21
|
|