File: save_conf_plugin_spec.rb

package info (click to toggle)
tdiary 5.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,092 kB
  • sloc: ruby: 23,031; javascript: 1,029; xml: 325; makefile: 26; sh: 2
file content (68 lines) | stat: -rw-r--r-- 1,793 bytes parent folder | download | duplicates (5)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'acceptance_helper'

feature 'プラグイン選択設定の利用' do
	plugin_path = "#{TDiary.root}/misc/plugin/rspec.rb"

	scenario '新入荷のプラグインが表示される' do
		FileUtils.rm plugin_path if File.exist? plugin_path

		visit '/update.rb?conf=sp'
		page.all('div.saveconf').first.click_button 'OK'
		expect(page).not_to have_content '新入荷'

		FileUtils.touch plugin_path

		click_link 'プラグイン選択'

		expect(page).to have_content '新入荷'
		expect(page).to have_content 'rspec.rb'

		FileUtils.rm plugin_path
	end

	scenario 'プラグイン設定を保存する' do
		FileUtils.touch plugin_path

		visit '/update.rb?conf=sp'

		check "sp.rspec.rb"
		page.all('div.saveconf').first.click_button 'OK'

		expect(page).to have_checked_field "sp.rspec.rb"

		FileUtils.rm plugin_path
	end

	scenario 'プラグインが消えたら表示されない' do
		FileUtils.touch plugin_path

		visit '/update.rb?conf=sp'
		expect(page).to have_content 'rspec.rb'

		FileUtils.rm plugin_path

		click_link 'プラグイン選択'
		expect(page).not_to have_content 'rspec.rb'
	end

	scenario '外部の Javascript を追加するプラグインを有効にする' do
		visit '/update.rb?conf=sp'

		check "sp.category_autocomplete.rb"
		page.all('div.saveconf').first.click_button 'OK'

		visit '/update.rb'

		expect(page.body).to be_include('caretposition.js')
		expect(page.body).to be_include('category_autocomplete.js')
		expect(page.body).to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js')
		expect(page.body).not_to be_include('//ajax.googleapis.com/ajax/libs/jqueryui/1.12/1/jquery-ui.min.js?')
	end
end
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3