File: title_anchor_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 (39 lines) | stat: -rw-r--r-- 931 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
$:.unshift(File.dirname(__FILE__))
require 'spec_helper'

describe "title_anchor plugin" do
	def setup_title_anchor_plugin(mode)
		fake_plugin(:title_anchor) { |plugin|
			plugin.mode = mode
			plugin.conf.index = ''
			plugin.conf.html_title = "HsbtDiary"
		}
	end

	describe "in day mode" do
		before do
			@plugin = setup_title_anchor_plugin('day')
		end

		it { expect(@plugin.title_anchor).to  eq(expected_html_title_in_day(
				:index => '',
				:html_title => 'HsbtDiary'))}
	end

	describe "in latest mode" do
		before do
			@plugin = setup_title_anchor_plugin('latest')
		end

		it { expect(@plugin.title_anchor).to  eq(expected_html_title_in_latest(
				:html_title => 'HsbtDiary'))}
	end

	def expected_html_title_in_day(options)
		expected = %{<h1><a href="#{options[:index]}">#{options[:html_title]}</a></h1>}
	end

	def expected_html_title_in_latest(options)
		expected = %{<h1>#{options[:html_title]}</h1>}
	end
end