File: apple_webclip_spec.rb

package info (click to toggle)
tdiary-contrib 5.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,660 kB
  • sloc: ruby: 17,024; lisp: 546; xml: 451; php: 61; sql: 40; makefile: 18
file content (46 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$:.unshift(File.dirname(__FILE__))
require 'spec_helper'

describe "apple_webclip plugin" do
	def setup_apple_webclip_plugin( url )
		fake_plugin(:apple_webclip) { |plugin|
			plugin.conf['apple_webclip.url'] = url
		}
	end

	describe "url is enabled" do
		before do
			plugin = setup_apple_webclip_plugin('http://example.com/example.png')
			@header_snippet = plugin.header_proc
		end

		it "header include url" do
			expect(@header_snippet).to eq(%Q|\t<link rel="apple-touch-icon" href="http://example.com/example.png">|)
		end
	end

	describe "url is disabled" do
		describe "url is empty" do
			before do
				plugin = setup_apple_webclip_plugin('')
				@header_snippet = plugin.header_proc
			end

			it "header is empty" do
				expect(@header_snippet).to be_empty
			end
		end

		describe "url is nil" do
			before do
				plugin = setup_apple_webclip_plugin(nil)
				@header_snippet = plugin.header_proc
			end

			it "header is empty" do
				expect(@header_snippet).to be_empty
			end
		end
	end

end