linkto 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -9,3 +9,6 @@ lib/linkto/google.rb
9
9
  lib/linkto/untappd.rb
10
10
  lib/linkto/version.rb
11
11
  lib/linkto/wikipedia.rb
12
+ test/helper.rb
13
+ test/test_google.rb
14
+ test/test_wikipedia.rb
@@ -20,9 +20,9 @@ module Linkto
20
20
  ###############################
21
21
  # shortcuts / aliases
22
22
 
23
- def google_search( q, opts ) link_to_google_search( q, opts ) end
24
- def google_de_search( q, opts ) link_to_google_de_search( q, opts) end
25
- def google_search_images( q, opts ) link_to_google_search_images( q, opts ) end
23
+ def google_search( q, opts={} ) link_to_google_search( q, opts ) end
24
+ def google_de_search( q, opts={} ) link_to_google_de_search( q, opts ) end
25
+ def google_search_images( q, opts={} ) link_to_google_search_images( q, opts ) end
26
26
 
27
27
 
28
28
  end # module GoogleHelper
@@ -12,7 +12,7 @@ module Linkto
12
12
  ###############################
13
13
  # shortcuts / aliases
14
14
 
15
- def untappd_search( q, opts ) link_to_untappd_search( q, opts ) end
15
+ def untappd_search( q, opts={} ) link_to_untappd_search( q, opts ) end
16
16
 
17
17
 
18
18
  end # module UntappdHelper
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Linkto
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
 
6
6
 
@@ -16,8 +16,8 @@ module Linkto
16
16
  ###############################
17
17
  # shortcuts / aliases
18
18
 
19
- def wikipedia_search( q, opts ) link_to_wikipedia_search( q, opts ) end
20
- def wikipedia_de_search( q, opts ) link_to_wikipedia_de_search( q, opts ) end
19
+ def wikipedia_search( q, opts={} ) link_to_wikipedia_search( q, opts ) end
20
+ def wikipedia_de_search( q, opts={} ) link_to_wikipedia_de_search( q, opts ) end
21
21
 
22
22
 
23
23
  end # module WikipediaHelper
@@ -0,0 +1,29 @@
1
+ ## $:.unshift(File.dirname(__FILE__))
2
+
3
+ ## minitest setup
4
+
5
+ # require 'minitest/unit'
6
+ require 'minitest/autorun'
7
+
8
+ # include MiniTest::Unit # lets us use TestCase instead of MiniTest::Unit::TestCase
9
+
10
+ ## make sure activesupport gets included/required
11
+ # note: just activesupport or active_support will NOT work
12
+ # require 'active_support/all'
13
+
14
+ ## our own code
15
+
16
+ require 'linkto'
17
+
18
+
19
+ ### simple link_to method
20
+ # - no need to include UrlHelper from Rails
21
+
22
+ def link_to( title, link, opts={} )
23
+ ###
24
+ # fix:
25
+ # opts get ignored for now!!
26
+
27
+ "<a href='#{link}'>#{title}</a>"
28
+ end
29
+
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ require 'helper'
5
+
6
+
7
+ class TestGoogle < MiniTest::Unit::TestCase
8
+
9
+ include LinktoHelper
10
+
11
+ def test_search
12
+
13
+ ###
14
+ # fix: use + for spaces ??? why? why not? e.g
15
+ # ?q=open+mundi
16
+
17
+ assert_equal "<a href='https://www.google.com/search?q=open mundi'>open mundi</a>", google_search( 'open mundi' )
18
+ assert_equal "<a href='https://www.google.de/search?hl=de&q=open mundi'>open mundi</a>", google_de_search( 'open mundi' )
19
+
20
+ end
21
+
22
+ end # class TestGoogle
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ require 'helper'
5
+
6
+
7
+ class TestWikipedia < MiniTest::Unit::TestCase
8
+
9
+ include LinktoHelper
10
+
11
+ def test_search
12
+
13
+ assert_equal "<a href='http://en.wikipedia.org/?search=ottakringer'>ottakringer</a>", wikipedia_search( 'ottakringer' )
14
+ assert_equal "<a href='http://de.wikipedia.org/?search=ottakringer'>ottakringer</a>", wikipedia_de_search( 'ottakringer' )
15
+
16
+ end
17
+
18
+ end # class TestWikipedia
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-15 00:00:00.000000000 Z
12
+ date: 2014-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &86033990 !ruby/object:Gem::Requirement
16
+ requirement: &73684860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *86033990
24
+ version_requirements: *73684860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &86033620 !ruby/object:Gem::Requirement
27
+ requirement: &73684500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *86033620
35
+ version_requirements: *73684500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &86033320 !ruby/object:Gem::Requirement
38
+ requirement: &73684220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.3'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *86033320
46
+ version_requirements: *73684220
47
47
  description: linkto - link_to helpers for google search, bing search, flickr photo
48
48
  search, flickr photo tag, etc.
49
49
  email: webslideshow@googlegroups.com
@@ -63,6 +63,10 @@ files:
63
63
  - lib/linkto/untappd.rb
64
64
  - lib/linkto/version.rb
65
65
  - lib/linkto/wikipedia.rb
66
+ - test/helper.rb
67
+ - test/test_google.rb
68
+ - test/test_wikipedia.rb
69
+ - .gemtest
66
70
  homepage: https://github.com/rubylibs/linkto
67
71
  licenses:
68
72
  - Public Domain
@@ -91,4 +95,6 @@ signing_key:
91
95
  specification_version: 3
92
96
  summary: linkto - link_to helpers for google search, bing search, flickr photo search,
93
97
  flickr photo tag, etc.
94
- test_files: []
98
+ test_files:
99
+ - test/test_google.rb
100
+ - test/test_wikipedia.rb