middleman-robots 1.3.2 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/tests/test_group.rb DELETED
@@ -1,121 +0,0 @@
1
- require 'minitest/autorun'
2
- require_relative '../lib/middleman-robots/group.rb'
3
-
4
- class Test_Group < MiniTest::Test
5
-
6
- def test_initialize
7
- rule = {
8
- user_agent: 'GoogleBot',
9
- disallow: %w(tmp/* /someting/dir/disallow.html),
10
- allow: %w(allow/* /someting/dir/allow.html),
11
- }
12
- group = Middleman::Robots::Group.new(rule)
13
-
14
- assert_equal rule[:user_agent], group.user_agent
15
- assert_equal %w(/tmp/* /someting/dir/disallow.html), group.disallow
16
- assert_equal %w(/allow/* /someting/dir/allow.html), group.allow
17
- end
18
-
19
- def test_initialize_without_user_agent
20
- rule = {
21
- disallow: %w(/tmp/*),
22
- allow: %w(/allow/*),
23
- }
24
- group = Middleman::Robots::Group.new(rule)
25
-
26
- assert_equal '*', group.user_agent
27
- assert_equal rule[:disallow], group.disallow
28
- assert_equal rule[:allow], group.allow
29
- end
30
-
31
- def test_initialize_without_disallow
32
- rule = {
33
- user_agent: 'GoogleBot',
34
- allow: %w(/allow/* /someting/dir/allow.html),
35
- }
36
- group = Middleman::Robots::Group.new(rule)
37
-
38
- assert_equal rule[:user_agent], group.user_agent
39
- assert_equal [], group.disallow
40
- assert_equal rule[:allow], group.allow
41
- end
42
-
43
- def test_initialize_without_allow
44
- rule = {
45
- user_agent: 'GoogleBot',
46
- disallow: %w(/tmp/* /someting/dir/disallow.html),
47
- }
48
- group = Middleman::Robots::Group.new(rule)
49
-
50
- assert_equal rule[:user_agent], group.user_agent
51
- assert_equal rule[:disallow], group.disallow
52
- assert_equal [], group.allow
53
- end
54
-
55
- def test_text
56
- rule = {
57
- user_agent: 'GoogleBot',
58
- disallow: %w(tmp/* /someting/dir/disallow.html),
59
- allow: %w(allow/* /someting/dir/allow.html),
60
- }
61
- group = Middleman::Robots::Group.new(rule)
62
-
63
- expected = <<-END
64
- User-Agent: GoogleBot
65
- Disallow: /tmp/*
66
- Disallow: /someting/dir/disallow.html
67
- Allow: /allow/*
68
- Allow: /someting/dir/allow.html
69
- END
70
-
71
- assert_equal expected, group.text
72
- end
73
-
74
- def test_text_without_user_agent
75
- rule = {
76
- disallow: %w(/tmp/*),
77
- allow: %w(/allow/*),
78
- }
79
- group = Middleman::Robots::Group.new(rule)
80
-
81
- expected = <<-END
82
- User-Agent: *
83
- Disallow: /tmp/*
84
- Allow: /allow/*
85
- END
86
-
87
- assert_equal expected, group.text
88
- end
89
-
90
- def test_text_without_disallow
91
- rule = {
92
- user_agent: 'GoogleBot',
93
- allow: %w(/allow/* /someting/dir/allow.html),
94
- }
95
- group = Middleman::Robots::Group.new(rule)
96
-
97
- expected = <<-END
98
- User-Agent: GoogleBot
99
- Allow: /allow/*
100
- Allow: /someting/dir/allow.html
101
- END
102
-
103
- assert_equal expected, group.text
104
- end
105
-
106
- def test_text_without_allow
107
- rule = {
108
- user_agent: 'GoogleBot',
109
- disallow: %w(/tmp/* /someting/dir/disallow.html),
110
- }
111
- group = Middleman::Robots::Group.new(rule)
112
-
113
- expected = <<-END
114
- User-Agent: GoogleBot
115
- Disallow: /tmp/*
116
- Disallow: /someting/dir/disallow.html
117
- END
118
-
119
- assert_equal expected, group.text
120
- end
121
- end