can-has-lolcat 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,20 +6,35 @@ class TestCanHasLolcat < Test::Unit::TestCase
6
6
 
7
7
  context "Lolcat" do
8
8
  context "#can_has" do
9
- LOLCAT = /http:\/\/icanhascheezburger\.files\.wordpress\.com\/.+/
9
+ LOLCAT_URL = "http://icanhascheezburger.com/?random"
10
+ LOLDOG_URL = "http://dogs.icanhascheezburger.com/?random"
11
+
12
+ LOLCAT_REGEX = /http:\/\/icanhascheezburger\.files\.wordpress\.com\/.+/
13
+ LOLDOG_REGEX = /http:\/\/ihasahotdog\.files\.wordpress\.com\/.+/
14
+ MAX_STRING_LENGTH = 200
10
15
 
11
16
  setup do
12
- stub(Lolcat).random_from_internetz do
13
- File.read(File.dirname(__FILE__) + "/fixtures/lolcat.html")
17
+ stub(Lolcat).get_html(LOLCAT_URL) do
18
+ File.read(File.dirname(__FILE__) + "/fixtures/lolcat.html")
19
+ end
20
+
21
+ stub(Lolcat).get_html(LOLDOG_URL) do
22
+ File.read(File.dirname(__FILE__) + "/fixtures/loldog.html")
14
23
  end
15
24
  end
16
25
 
17
26
  should "without any arguments give clean `lolcat` url" do
18
- assert Lolcat.can_has =~ LOLCAT
27
+ cat = Lolcat.can_has
28
+ assert cat =~ LOLCAT_REGEX
29
+ assert cat.length < MAX_STRING_LENGTH
19
30
  end
20
31
 
21
- should "with url as argument sgive clean url" do
22
- assert Lolcat.can_has(:url) =~ LOLCAT
32
+ should "with (url, dog) as arguments give clean `loldog` url" do
33
+ assert Lolcat.can_has(:url, :dog) =~ LOLDOG_REGEX
34
+ end
35
+
36
+ should "with url as argument give clean url" do
37
+ assert Lolcat.can_has(:url) =~ LOLCAT_REGEX
23
38
  end
24
39
 
25
40
  should "with html as argument give HTML formatted `lolcat`" do
@@ -29,6 +44,24 @@ class TestCanHasLolcat < Test::Unit::TestCase
29
44
  should "with bbcode as argument give bbcode formatted `lolcat`" do
30
45
  assert Lolcat.can_has(:bbcode) =~ /\[img\].+\[\/img\]/
31
46
  end
47
+
48
+ should "retry when video returned" do
49
+ attempts = 0
50
+
51
+ # This stub returns the video fixture the first time it's called
52
+ # and the correct image file the second time.
53
+ stub(Lolcat).get_html(LOLDOG_URL) do
54
+ if 0 == attempts
55
+ attempts += 1
56
+ File.read(File.dirname(__FILE__) + "/fixtures/lolvideo.html")
57
+ else
58
+ File.read(File.dirname(__FILE__) + "/fixtures/loldog.html")
59
+ end
60
+ end
61
+
62
+ assert Lolcat.can_has(:url, :dog) =~ LOLDOG_REGEX
63
+ end
64
+
32
65
  end
33
66
  end
34
67
  end
metadata CHANGED
@@ -1,91 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: can-has-lolcat
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- version: 1.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Sirupsen
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-08-18 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2013-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: shoulda
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :development
34
- version_requirements: *id001
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
35
27
  description: Fetches a random lolcat, and returns the appropriate output format.
36
28
  email: sirup@sirupsen.com
37
29
  executables: []
38
-
39
30
  extensions: []
40
-
41
- extra_rdoc_files:
31
+ extra_rdoc_files:
42
32
  - LICENSE
43
33
  - README.md
44
- files:
34
+ files:
45
35
  - .document
46
- - .gitignore
47
36
  - LICENSE
48
37
  - README.md
49
38
  - Rakefile
50
39
  - VERSION
40
+ - can-has-lolcat.gemspec
51
41
  - lib/can-has-lolcat.rb
52
42
  - test/fixtures/lolcat.html
43
+ - test/fixtures/loldog.html
44
+ - test/fixtures/lolvideo.html
53
45
  - test/helper.rb
54
46
  - test/test_can-has-lolcat.rb
55
- has_rdoc: true
56
47
  homepage: http://github.com/Sirupsen/can-has-lolcat
57
48
  licenses: []
58
-
49
+ metadata: {}
59
50
  post_install_message:
60
- rdoc_options:
61
- - --charset=UTF-8
62
- require_paths:
51
+ rdoc_options: []
52
+ require_paths:
63
53
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
73
- required_rubygems_version: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 3
79
- segments:
80
- - 0
81
- version: "0"
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
82
64
  requirements: []
83
-
84
65
  rubyforge_project:
85
- rubygems_version: 1.3.7
66
+ rubygems_version: 2.0.3
86
67
  signing_key:
87
- specification_version: 3
68
+ specification_version: 4
88
69
  summary: can haz random lolcat?
89
- test_files:
90
- - test/test_can-has-lolcat.rb
91
- - test/helper.rb
70
+ test_files: []
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC