tophat 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b56ca22052879feee712624be7e4280ba092ebe4
4
+ data.tar.gz: 17028a90e939dff0feb788e70638376330b9d97a
5
+ SHA512:
6
+ metadata.gz: 232aa078654be03c161781b600c5589bbcc1d7b3987282f5856bef5bad67264d3a325eb66aebc5129d442f7afd3b97b5b12811e55a1b80e2774abef2cb1bbb9b
7
+ data.tar.gz: a7b08dbbab148bd2456f2883d1008059f960f1477e6939454f23bfa770943b80edd46fccc74d7e4fbd803687b2fdb0d95a2d1d746958a7e1139e6e5b214213e8
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
- --format=nested
3
2
  --backtrace
@@ -1,13 +1,19 @@
1
1
  bundler_args: --without development
2
2
  language: ruby
3
3
  rvm:
4
- - rbx-18mode
5
- - rbx-19mode
6
- - 1.8.7
7
- - 1.9.2
8
4
  - 1.9.3
9
- - 2.0.0
5
+ - 2.0
6
+ - 2.1
7
+ - jruby-19mode
8
+ - jruby-19mode
9
+ - jruby-head
10
+ - rbx-2
11
+ - ruby-head
10
12
  matrix:
11
13
  allow_failures:
12
- - rvm: rbx-18mode
13
- - rvm: 1.8.7
14
+ - rvm: jruby-head
15
+ - rvm: jruby-19mode
16
+ - rvm: rbx-2
17
+ - rvm: ruby-head
18
+ fash_finish: true
19
+ sudo: false
data/Gemfile CHANGED
@@ -5,11 +5,10 @@ gem 'yard'
5
5
 
6
6
  group :development do
7
7
  gem 'kramdown'
8
- gem 'guard-rspec'
9
8
  end
10
9
 
11
10
  group :test do
12
- gem 'rspec', '>= 2.11'
11
+ gem 'rspec'
13
12
  gem 'simplecov', :require => false
14
13
  gem 'rails', '>= 3.0.0', '< 4.0.0'
15
14
  gem 'webmock'
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # TopHat [![Build Status](https://secure.travis-ci.org/spagalloco/tophat.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/spagalloco/tophat.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/github/spagalloco/tophat.png)][codeclimate]
1
+ # TopHat [![Build Status](https://secure.travis-ci.org/stve/tophat.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/stve/tophat.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/github/stve/tophat.png)][codeclimate]
2
2
 
3
3
 
4
- [travis]: http://travis-ci.org/spagalloco/tophat
5
- [gemnasium]: https://gemnasium.com/spagalloco/tophat
6
- [codeclimate]: https://codeclimate.com/github/spagalloco/tophat
4
+ [travis]: http://travis-ci.org/stve/tophat
5
+ [gemnasium]: https://gemnasium.com/stve/tophat
6
+ [codeclimate]: https://codeclimate.com/github/stve/tophat
7
7
 
8
8
  TopHat is a set of view helpers to keep your layouts and views DRY. Easily include meta tags like keywords and descriptions, Open Graph and Twitter Cards in your Rails views.
9
9
 
@@ -196,4 +196,4 @@ Pull requests welcome: fork, make a topic branch, commit (squash when possible)
196
196
 
197
197
  ## Copyright
198
198
 
199
- Copyright (c) 2012 Steve Agalloco. See [LICENSE](https://github.com/spagalloco/tophat/blob/master/LICENSE.md) for details.
199
+ Copyright (c) 2014 Steve Agalloco. See [LICENSE](https://github.com/stve/tophat/blob/master/LICENSE.md) for details.
@@ -28,7 +28,7 @@ module TopHat
28
28
  else
29
29
  default_description = options.delete(:default)
30
30
  options[:name] = 'description'
31
- options[:content] = TopHat.current['description'] || default_description
31
+ options[:content] = TopHat.current['description'].blank? ? default_description : TopHat.current['description']
32
32
 
33
33
  meta_tag(options) if options[:content]
34
34
  end
@@ -3,25 +3,24 @@ module TopHat
3
3
 
4
4
  DEFAULT_DESCRIPTOR = 'robots'
5
5
 
6
- def noindex(descriptor=nil)
7
- if descriptor
8
- TopHat.current['noindex'] = descriptor || DEFAULT_DESCRIPTOR
9
- else
10
- descriptor = TopHat.current['noindex'] || DEFAULT_DESCRIPTOR
11
- end
12
- tag(:meta, :name => descriptor, :content => 'noindex')
6
+ def noindex(descriptor = nil, content = 'noindex')
7
+ robot_tag(descriptor, content)
8
+ end
9
+
10
+ def nofollow(descriptor = nil, content = 'nofollow')
11
+ robot_tag(descriptor, content)
13
12
  end
14
13
 
15
- def nofollow(descriptor=nil)
14
+ def robot_tag(descriptor = nil, content)
16
15
  if descriptor
17
- TopHat.current['nofollow'] = descriptor || DEFAULT_DESCRIPTOR
16
+ TopHat.current[content] = descriptor || DEFAULT_DESCRIPTOR
18
17
  else
19
- descriptor = TopHat.current['nofollow'] || DEFAULT_DESCRIPTOR
18
+ descriptor = TopHat.current[content] || DEFAULT_DESCRIPTOR
20
19
  end
21
- tag(:meta, :name => descriptor, :content => 'nofollow')
20
+ tag(:meta, :name => descriptor, :content => content)
22
21
  end
23
22
 
24
- def canonical(path=nil)
23
+ def canonical(path = nil)
25
24
  tag(:link, :rel => 'canonical', :href => path) if path
26
25
  end
27
26
 
@@ -1,3 +1,3 @@
1
1
  module TopHat
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -21,3 +21,15 @@ RSpec.configure do |config|
21
21
  TopHat.reset
22
22
  end
23
23
  end
24
+
25
+ def capture_warning
26
+ begin
27
+ old_stderr = $stderr
28
+ $stderr = StringIO.new
29
+ yield
30
+ result = $stderr.string
31
+ ensure
32
+ $stderr = old_stderr
33
+ end
34
+ result
35
+ end
@@ -7,41 +7,41 @@ describe TopHat::HtmlHelper do
7
7
 
8
8
  describe 'html_tag' do
9
9
  it 'returns a simple tag by default' do
10
- @template.html_tag.should eq('<html>')
10
+ expect(@template.html_tag).to eq('<html>')
11
11
  end
12
12
 
13
13
  it 'accepts a version in an options hash' do
14
14
  output = @template.html_tag(:version => '123')
15
- output.should eq('<html version="123">')
15
+ expect(output).to eq('<html version="123">')
16
16
  end
17
17
 
18
18
  context 'xmlns' do
19
19
  it 'accepts xmlns passed as strings' do
20
20
  output = @template.html_tag(:xmlns => 'http://someurl.com')
21
- output.should eq('<html xmlns="http://someurl.com">')
21
+ expect(output).to eq('<html xmlns="http://someurl.com">')
22
22
  end
23
23
 
24
24
  it 'accepts xmlns passed as hashes' do
25
25
  output = @template.html_tag(:xmlns => { :prefix => 'fb', :url => 'http://someurl.com' })
26
- output.should eq('<html xmlns:fb="http://someurl.com">')
26
+ expect(output).to eq('<html xmlns:fb="http://someurl.com">')
27
27
  end
28
28
 
29
29
  it 'accepts xmlns passed as an array of hashes' do
30
30
  xmlns = { :prefix => 'fb', :url => 'http://developers.facebook.com/schema/' }
31
31
  output = @template.html_tag(:xmlns => [xmlns])
32
- output.should eq('<html xmlns:fb="http://developers.facebook.com/schema/">')
32
+ expect(output).to eq('<html xmlns:fb="http://developers.facebook.com/schema/">')
33
33
  end
34
34
  end
35
35
 
36
36
  context 'prefixes' do
37
37
  it 'accepts prefixes passed as strings' do
38
38
  output = @template.html_tag(:prefix => 'ohai')
39
- output.should eq('<html prefix="ohai">')
39
+ expect(output).to eq('<html prefix="ohai">')
40
40
  end
41
41
 
42
42
  it 'accepts prefixes passed as a hash' do
43
43
  output = @template.html_tag(:prefix => { :prefix => 'og', :url => 'http://ogp.me/ns#' })
44
- output.should eq('<html prefix="og: http://ogp.me/ns#">')
44
+ expect(output).to eq('<html prefix="og: http://ogp.me/ns#">')
45
45
  end
46
46
 
47
47
  it 'accepts prefixes passed as an array of hashes' do
@@ -50,12 +50,12 @@ describe TopHat::HtmlHelper do
50
50
  { :prefix => 'fb', :url => 'http://ogp.me/ns/fb#' }
51
51
  ]
52
52
  output = @template.html_tag(:prefix => prefixes)
53
- output.should eq('<html prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">')
53
+ expect(output).to eq('<html prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">')
54
54
  end
55
55
 
56
56
  it 'accepts prefixes passes and an array of strings' do
57
57
  output = @template.html_tag(:prefix => ['og: http://ogp.me/ns#', 'fb: http://ogp.me/ns/fb#'])
58
- output.should eq('<html prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">')
58
+ expect(output).to eq('<html prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">')
59
59
  end
60
60
  end
61
61
 
@@ -8,19 +8,19 @@ describe TopHat::MetaHelper do
8
8
 
9
9
  describe "charset" do
10
10
  it 'renders a meta tag with a charset' do
11
- @template.charset('utf-8').should eq('<meta charset="utf-8">')
11
+ expect(@template.charset('utf-8')).to eq('<meta charset="utf-8">')
12
12
  end
13
13
  end
14
14
 
15
15
  describe "viewport" do
16
16
  it 'renders a meta tag with a viewport' do
17
- @template.viewport('width=device-width').should eq('<meta content="width=device-width" name="viewport">')
17
+ expect(@template.viewport('width=device-width')).to eq('<meta content="width=device-width" name="viewport">')
18
18
  end
19
19
  end
20
20
 
21
21
  describe "meta_tag" do
22
22
  it 'renders meta_tags' do
23
- @template.meta_tag(:charset => 'utf-8').should eq('<meta charset="utf-8" />')
23
+ expect(@template.meta_tag(:charset => 'utf-8')).to eq('<meta charset="utf-8" />')
24
24
  end
25
25
  end
26
26
 
@@ -31,11 +31,11 @@ describe TopHat::MetaHelper do
31
31
  end
32
32
 
33
33
  it "saves keywords" do
34
- @template.keywords(@keywords).should == @keywords.join(', ')
34
+ expect(@template.keywords(@keywords)).to eq(@keywords.join(', '))
35
35
  end
36
36
 
37
37
  it "uses default keywords if keywords is empty" do
38
- @template.keywords(:default => @keywords).should == "<meta content=\"#{@keywords.join(', ')}\" name=\"keywords\" />"
38
+ expect(@template.keywords(:default => @keywords)).to eq("<meta content=\"#{@keywords.join(', ')}\" name=\"keywords\" />")
39
39
  end
40
40
  end
41
41
 
@@ -45,56 +45,61 @@ describe TopHat::MetaHelper do
45
45
  end
46
46
 
47
47
  it "saves keywords" do
48
- @template.keywords(@keywords).should == @keywords
48
+ expect(@template.keywords(@keywords)).to eq(@keywords)
49
49
  end
50
50
 
51
51
  it "uses default keywords passed as a string if keywords is empty" do
52
- @template.keywords(:default => @keywords).should == "<meta content=\"#{@keywords}\" name=\"keywords\" />"
52
+ expect(@template.keywords(:default => @keywords)).to eq("<meta content=\"#{@keywords}\" name=\"keywords\" />")
53
53
  end
54
54
  end
55
55
 
56
56
  it "return nil when no default is configured and no keywords are defined" do
57
- @template.keywords.should be_nil
57
+ expect(@template.keywords).to be_nil
58
58
  end
59
59
 
60
60
  it "returns nil when passed nil" do
61
- @template.keywords(nil).should be_nil
61
+ expect(@template.keywords(nil)).to be_nil
62
62
  end
63
63
 
64
64
  it "merges default tags with page tags, when merge_default is set to true" do
65
65
  @template.keywords("Stu, Pete")
66
- @template.keywords(:default => "John, Paul, George, Ringo", :merge_default => true).should == "<meta content=\"Stu, Pete, John, Paul, George, Ringo\" name=\"keywords\" />"
66
+ expect(@template.keywords(:default => "John, Paul, George, Ringo", :merge_default => true)).to eq("<meta content=\"Stu, Pete, John, Paul, George, Ringo\" name=\"keywords\" />")
67
67
  end
68
68
  end
69
69
 
70
70
  describe ".description" do
71
71
  it "saves the description" do
72
72
  desc = "Cinderella story. Outta nowhere. A former greenskeeper, now, about to become the Masters champion."
73
- @template.description(desc).should == desc
73
+ expect(@template.description(desc)).to eq(desc)
74
74
  end
75
75
 
76
76
  it "uses the default description if no description is defined" do
77
77
  desc = "A flute without holes, is not a flute. A donut without a hole, is a Danish."
78
- @template.description(:default => desc).should == "<meta content=\"#{desc}\" name=\"description\" />"
78
+ expect(@template.description(:default => desc)).to eq("<meta content=\"#{desc}\" name=\"description\" />")
79
79
  end
80
80
 
81
81
  it "returns nil when passed nil" do
82
- @template.description(nil).should be_nil
82
+ expect(@template.description(nil)).to be_nil
83
83
  end
84
84
 
85
85
  it "returns nil when no default is configured and no description is defined" do
86
- @template.description.should be_nil
86
+ expect(@template.description).to be_nil
87
87
  end
88
88
 
89
89
  it 'overrides the default' do
90
90
  @template.description('This is a custom description')
91
- @template.description(:default => 'This is a default description.').should eq('<meta content="This is a custom description" name="description" />')
91
+ expect(@template.description(:default => 'This is a default description.')).to eq('<meta content="This is a custom description" name="description" />')
92
92
  end
93
+
94
+ it "uses the default description if custom description is blank" do
95
+ @template.description('')
96
+ expect(@template.description(:default => 'This is a default description')).to eq('<meta content="This is a default description" name="description" />')
97
+ end
93
98
  end
94
99
 
95
100
  describe ".itemprop" do
96
101
  it "renders an itemprop meta tag" do
97
- @template.itemprop(:rating, '1').should == "<meta content=\"1\" itemprop=\"rating\" />"
102
+ expect(@template.itemprop(:rating, '1')).to eq("<meta content=\"1\" itemprop=\"rating\" />")
98
103
  end
99
104
  end
100
105
 
@@ -14,29 +14,39 @@ describe TopHat::OpenGraphHelper do
14
14
  context 'default style' do
15
15
  it 'renders an html tag with namespace' do
16
16
  output = @template.opengraph_html
17
- output.should =~ /<html/
18
- output.should =~ /xmlns\:og/
19
- output.should =~ /xmlns\:fb/
17
+ expect(output).to match(/<html/)
18
+ expect(output).to match(/xmlns\:og/)
19
+ expect(output).to match(/xmlns\:fb/)
20
20
  end
21
21
  end
22
22
 
23
23
  context 'html5 style' do
24
24
  it 'renders an html tag with namespace' do
25
25
  output = @template.opengraph_html('html5')
26
- output.should =~ /<html/
27
- output.should =~ /xmlns\:og/
28
- output.should =~ /xmlns\:fb/
26
+ expect(output).to match(/<html/)
27
+ expect(output).to match(/xmlns\:og/)
28
+ expect(output).to match(/xmlns\:fb/)
29
29
  end
30
30
  end
31
31
 
32
32
  context 'unknown style' do
33
33
  it 'returns an empty html tag' do
34
- @template.opengraph_html('funny').should eq('<html>')
34
+ expect(@template.opengraph_html('funny')).to eq('<html>')
35
35
  end
36
36
  end
37
37
 
38
38
  it 'it supports deprecated html_with_opengraph' do
39
- @template.opengraph_html.should eq(@template.html_with_opengraph)
39
+ capture_warning do
40
+ expect(@template.opengraph_html).to eq(@template.html_with_opengraph)
41
+ end
42
+ end
43
+
44
+ it 'deprecates html_with_opengraph' do
45
+ warning = capture_warning do
46
+ @template.html_with_opengraph
47
+ end
48
+
49
+ expect(warning).to eq("html_with_opengraph has been deprecated, use opengraph_html instead.\n")
40
50
  end
41
51
  end
42
52
 
@@ -44,14 +54,14 @@ describe TopHat::OpenGraphHelper do
44
54
  context "as a string" do
45
55
  it "generates a site admin tag" do
46
56
  @template.opengraph(:admins => '123,124')
47
- @template.opengraph.should include('<meta content="123,124" property="fb:admins" />')
57
+ expect(@template.opengraph).to include('<meta content="123,124" property="fb:admins" />')
48
58
  end
49
59
  end
50
60
 
51
61
  context "as an array" do
52
62
  it "generates a site admin tag" do
53
63
  @template.opengraph(:admins => [123, 124])
54
- @template.opengraph.should include('<meta content="123,124" property="fb:admins" />')
64
+ expect(@template.opengraph).to include('<meta content="123,124" property="fb:admins" />')
55
65
  end
56
66
  end
57
67
  end
@@ -59,19 +69,19 @@ describe TopHat::OpenGraphHelper do
59
69
  context "app_id when configured" do
60
70
  it "generates an app_id meta tag" do
61
71
  @template.opengraph(:app_id => 'MyApp')
62
- @template.opengraph.should include('<meta content="MyApp" property="fb:app_id" />')
72
+ expect(@template.opengraph).to include('<meta content="MyApp" property="fb:app_id" />')
63
73
  end
64
74
  end
65
75
 
66
76
  context "additional open graph properties" do
67
77
  it "generates opengraph meta tags" do
68
78
  @template.opengraph { |og| og.title 'The Great Gatsby' }
69
- @template.opengraph.should include('<meta content="The Great Gatsby" property="og:title" />')
79
+ expect(@template.opengraph).to include('<meta content="The Great Gatsby" property="og:title" />')
70
80
  end
71
81
 
72
82
  it "allows use of the tag 'type'" do
73
83
  @template.opengraph { |og| og.type 'sports_team' }
74
- @template.opengraph.should include('<meta content="sports_team" property="og:type" />')
84
+ expect(@template.opengraph).to include('<meta content="sports_team" property="og:type" />')
75
85
  end
76
86
 
77
87
  it "supports multiple tags" do
@@ -81,8 +91,8 @@ describe TopHat::OpenGraphHelper do
81
91
  end
82
92
  output = @template.opengraph
83
93
 
84
- output.should include('<meta content="movie" property="og:type" />')
85
- output.should include('<meta content="Austin Powers: International Man of Mystery" property="og:title" />')
94
+ expect(output).to include('<meta content="movie" property="og:type" />')
95
+ expect(output).to include('<meta content="Austin Powers: International Man of Mystery" property="og:title" />')
86
96
  end
87
97
 
88
98
  it 'supports default tags' do
@@ -94,9 +104,9 @@ describe TopHat::OpenGraphHelper do
94
104
  og.rating '5/10'
95
105
  end
96
106
 
97
- output.should include('<meta content="movie" property="og:type" />')
98
- output.should include('<meta content="Rain Man" property="og:title" />')
99
- output.should include('<meta content="5/10" property="og:rating" />')
107
+ expect(output).to include('<meta content="movie" property="og:type" />')
108
+ expect(output).to include('<meta content="Rain Man" property="og:title" />')
109
+ expect(output).to include('<meta content="5/10" property="og:rating" />')
100
110
  end
101
111
  end
102
112
 
@@ -108,10 +118,10 @@ describe TopHat::OpenGraphHelper do
108
118
  end
109
119
  output = @template.opengraph
110
120
 
111
- output.should include('<meta content="MyApp" property="fb:app_id" />')
112
- output.should include('<meta content="123,1234" property="fb:admins" />')
113
- output.should include('<meta content="movie" property="og:type" />')
114
- output.should include('<meta content="Rain Man" property="og:title" />')
121
+ expect(output).to include('<meta content="MyApp" property="fb:app_id" />')
122
+ expect(output).to include('<meta content="123,1234" property="fb:admins" />')
123
+ expect(output).to include('<meta content="movie" property="og:type" />')
124
+ expect(output).to include('<meta content="Rain Man" property="og:title" />')
115
125
  end
116
126
 
117
127
  it "generates all tags when app_id and admins passed as part of rendering" do
@@ -121,10 +131,10 @@ describe TopHat::OpenGraphHelper do
121
131
  end
122
132
  output = @template.opengraph(:app_id => 'MyApp', :admins => [123, 1234])
123
133
 
124
- output.should include('<meta content="MyApp" property="fb:app_id" />')
125
- output.should include('<meta content="123,1234" property="fb:admins" />')
126
- output.should include('<meta content="movie" property="og:type" />')
127
- output.should include('<meta content="Rain Man" property="og:title" />')
134
+ expect(output).to include('<meta content="MyApp" property="fb:app_id" />')
135
+ expect(output).to include('<meta content="123,1234" property="fb:admins" />')
136
+ expect(output).to include('<meta content="movie" property="og:type" />')
137
+ expect(output).to include('<meta content="Rain Man" property="og:title" />')
128
138
  end
129
139
 
130
140
  it 'supports default tags' do
@@ -136,11 +146,11 @@ describe TopHat::OpenGraphHelper do
136
146
  og.rating '5/10'
137
147
  end
138
148
 
139
- output.should include('<meta content="MyApp" property="fb:app_id" />')
140
- output.should include('<meta content="123,1234" property="fb:admins" />')
141
- output.should include('<meta content="movie" property="og:type" />')
142
- output.should include('<meta content="Rain Man" property="og:title" />')
143
- output.should include('<meta content="5/10" property="og:rating" />')
149
+ expect(output).to include('<meta content="MyApp" property="fb:app_id" />')
150
+ expect(output).to include('<meta content="123,1234" property="fb:admins" />')
151
+ expect(output).to include('<meta content="movie" property="og:type" />')
152
+ expect(output).to include('<meta content="Rain Man" property="og:title" />')
153
+ expect(output).to include('<meta content="5/10" property="og:rating" />')
144
154
  end
145
155
  end
146
156
 
@@ -8,53 +8,53 @@ describe TopHat::RobotsHelper do
8
8
 
9
9
  describe ".nofollow" do
10
10
  it "defaults to all robots" do
11
- @template.nofollow.should == "<meta content=\"nofollow\" name=\"robots\" />"
11
+ expect(@template.nofollow).to eq("<meta content=\"nofollow\" name=\"robots\" />")
12
12
  end
13
13
 
14
14
  it "uses a descriptor if one is provided" do
15
- @template.nofollow('googlebot').should == "<meta content=\"nofollow\" name=\"googlebot\" />"
15
+ expect(@template.nofollow('googlebot')).to eq("<meta content=\"nofollow\" name=\"googlebot\" />")
16
16
  end
17
17
 
18
18
  it "generates a default tag when passed nil" do
19
- @template.nofollow(nil).should == "<meta content=\"nofollow\" name=\"robots\" />"
19
+ expect(@template.nofollow(nil)).to eq("<meta content=\"nofollow\" name=\"robots\" />")
20
20
  end
21
21
 
22
22
  it 'stores a descriptor' do
23
23
  @template.nofollow('twitterbot')
24
- @template.nofollow.should == "<meta content=\"nofollow\" name=\"twitterbot\" />"
24
+ expect(@template.nofollow).to eq("<meta content=\"nofollow\" name=\"twitterbot\" />")
25
25
  end
26
26
  end
27
27
 
28
28
  describe ".noindex" do
29
29
  it "defaults to all robots" do
30
- @template.noindex.should == "<meta content=\"noindex\" name=\"robots\" />"
30
+ expect(@template.noindex).to eq("<meta content=\"noindex\" name=\"robots\" />")
31
31
  end
32
32
 
33
33
  it "uses a descriptor if one is provided" do
34
- @template.noindex('googlebot').should == "<meta content=\"noindex\" name=\"googlebot\" />"
34
+ expect(@template.noindex('googlebot')).to eq("<meta content=\"noindex\" name=\"googlebot\" />")
35
35
  end
36
36
 
37
37
  it "generates a default tag when passed nil" do
38
- @template.noindex(nil).should == "<meta content=\"noindex\" name=\"robots\" />"
38
+ expect(@template.noindex(nil)).to eq("<meta content=\"noindex\" name=\"robots\" />")
39
39
  end
40
40
 
41
41
  it 'stores a descriptor' do
42
42
  @template.noindex('twitterbot')
43
- @template.noindex.should == "<meta content=\"noindex\" name=\"twitterbot\" />"
43
+ expect(@template.noindex).to eq("<meta content=\"noindex\" name=\"twitterbot\" />")
44
44
  end
45
45
  end
46
46
 
47
47
  describe ".canonical" do
48
48
  it "returns nil when not passed a path" do
49
- @template.canonical.should be_nil
49
+ expect(@template.canonical).to be_nil
50
50
  end
51
51
 
52
52
  it "renders a tag when passed a path" do
53
- @template.canonical('http://mysite.com/somepath/').should == "<link href=\"http://mysite.com/somepath/\" rel=\"canonical\" />"
53
+ expect(@template.canonical('http://mysite.com/somepath/')).to eq("<link href=\"http://mysite.com/somepath/\" rel=\"canonical\" />")
54
54
  end
55
55
 
56
56
  it "returns nil when passed nil" do
57
- @template.canonical(nil).should be_nil
57
+ expect(@template.canonical(nil)).to be_nil
58
58
  end
59
59
  end
60
60
 
@@ -17,131 +17,131 @@ describe TopHat::StylesheetHelper do
17
17
  end
18
18
 
19
19
  it "defines IE conditionals" do
20
- @template.ie_5_conditional {
20
+ expect(@template.ie_5_conditional {
21
21
  @template.stylesheet_link_tag(@stylesheet)
22
- }.should eq("<!--[if IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
22
+ }).to eq("<!--[if IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
23
23
 
24
- @template.ie_5_5_conditional {
24
+ expect(@template.ie_5_5_conditional {
25
25
  @template.stylesheet_link_tag(@stylesheet)
26
- }.should eq("<!--[if IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
26
+ }).to eq("<!--[if IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
27
27
 
28
- @template.ie_6_conditional {
28
+ expect(@template.ie_6_conditional {
29
29
  @template.stylesheet_link_tag(@stylesheet)
30
- }.should eq("<!--[if IE 6]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
30
+ }).to eq("<!--[if IE 6]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
31
31
 
32
- @template.ie_7_conditional {
32
+ expect(@template.ie_7_conditional {
33
33
  @template.stylesheet_link_tag(@stylesheet)
34
- }.should eq("<!--[if IE 7]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
34
+ }).to eq("<!--[if IE 7]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
35
35
 
36
- @template.ie_8_conditional {
36
+ expect(@template.ie_8_conditional {
37
37
  @template.stylesheet_link_tag(@stylesheet)
38
- }.should eq("<!--[if IE 8]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
38
+ }).to eq("<!--[if IE 8]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
39
39
 
40
- @template.ie_9_conditional {
40
+ expect(@template.ie_9_conditional {
41
41
  @template.stylesheet_link_tag(@stylesheet)
42
- }.should eq("<!--[if IE 9]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
42
+ }).to eq("<!--[if IE 9]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
43
43
  end
44
44
 
45
45
  it "renders defined IE conditional with greater than operator" do
46
- @template.ie_5_conditional(:gt) {
46
+ expect(@template.ie_5_conditional(:gt) {
47
47
  @template.stylesheet_link_tag(@stylesheet)
48
- }.should eq("<!--[if gt IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
48
+ }).to eq("<!--[if gt IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
49
49
 
50
- @template.ie_5_5_conditional(:gt) {
50
+ expect(@template.ie_5_5_conditional(:gt) {
51
51
  @template.stylesheet_link_tag(@stylesheet)
52
- }.should eq("<!--[if gt IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
52
+ }).to eq("<!--[if gt IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
53
53
  end
54
54
 
55
55
  it "renders defined IE conditional with greater than or equal to operator" do
56
- @template.ie_5_conditional(:gte) {
56
+ expect(@template.ie_5_conditional(:gte) {
57
57
  @template.stylesheet_link_tag(@stylesheet)
58
- }.should eq("<!--[if gte IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
58
+ }).to eq("<!--[if gte IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
59
59
 
60
- @template.ie_5_5_conditional(:gte) {
60
+ expect(@template.ie_5_5_conditional(:gte) {
61
61
  @template.stylesheet_link_tag(@stylesheet)
62
- }.should eq("<!--[if gte IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
62
+ }).to eq("<!--[if gte IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
63
63
  end
64
64
 
65
65
  it "renders defined IE conditional with ! operator" do
66
- @template.ie_5_conditional(:not) {
66
+ expect(@template.ie_5_conditional(:not) {
67
67
  @template.stylesheet_link_tag(@stylesheet)
68
- }.should eq("<!--[if !IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
68
+ }).to eq("<!--[if !IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
69
69
 
70
- @template.ie_5_5_conditional(:not) {
70
+ expect(@template.ie_5_5_conditional(:not) {
71
71
  @template.stylesheet_link_tag(@stylesheet)
72
- }.should eq("<!--[if !IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
72
+ }).to eq("<!--[if !IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
73
73
  end
74
74
 
75
75
  it "renders defined IE conditional with less than operator" do
76
- @template.ie_5_conditional(:lt) {
76
+ expect(@template.ie_5_conditional(:lt) {
77
77
  @template.stylesheet_link_tag(@stylesheet)
78
- }.should eq("<!--[if lt IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
78
+ }).to eq("<!--[if lt IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
79
79
 
80
- @template.ie_5_5_conditional(:lt) {
80
+ expect(@template.ie_5_5_conditional(:lt) {
81
81
  @template.stylesheet_link_tag(@stylesheet)
82
- }.should eq("<!--[if lt IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
82
+ }).to eq("<!--[if lt IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
83
83
  end
84
84
 
85
85
  it "renders defined IE conditional with less than or equal to operator" do
86
- @template.ie_5_conditional(:lte) {
86
+ expect(@template.ie_5_conditional(:lte) {
87
87
  @template.stylesheet_link_tag(@stylesheet)
88
- }.should eq("<!--[if lte IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
88
+ }).to eq("<!--[if lte IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
89
89
 
90
- @template.ie_5_5_conditional(:lte) {
90
+ expect(@template.ie_5_5_conditional(:lte) {
91
91
  @template.stylesheet_link_tag(@stylesheet)
92
- }.should eq("<!--[if lte IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
92
+ }).to eq("<!--[if lte IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
93
93
  end
94
94
 
95
95
  it "renders defined IE conditional with equal to operator" do
96
- @template.ie_5_conditional(:eq) {
96
+ expect(@template.ie_5_conditional(:eq) {
97
97
  @template.stylesheet_link_tag(@stylesheet)
98
- }.should eq("<!--[if eq IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
98
+ }).to eq("<!--[if eq IE 5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
99
99
 
100
- @template.ie_5_5_conditional(:eq) {
100
+ expect(@template.ie_5_5_conditional(:eq) {
101
101
  @template.stylesheet_link_tag(@stylesheet)
102
- }.should eq("<!--[if eq IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
102
+ }).to eq("<!--[if eq IE 5.5]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
103
103
  end
104
104
 
105
105
  it "renders defined conditionals for other browsers" do
106
- @template.opera_conditional {
106
+ expect(@template.opera_conditional {
107
107
  @template.stylesheet_link_tag(@stylesheet)
108
- }.should eq("<!--[if Opera]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
108
+ }).to eq("<!--[if Opera]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
109
109
 
110
- @template.webkit_conditional {
110
+ expect(@template.webkit_conditional {
111
111
  @template.stylesheet_link_tag(@stylesheet)
112
- }.should eq("<!--[if Webkit]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
112
+ }).to eq("<!--[if Webkit]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
113
113
 
114
- @template.webkit_conditional(:eq) {
114
+ expect(@template.webkit_conditional(:eq) {
115
115
  @template.stylesheet_link_tag(@stylesheet)
116
- }.should eq("<!--[if eq Webkit]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
116
+ }).to eq("<!--[if eq Webkit]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
117
117
 
118
- @template.gecko_conditional {
118
+ expect(@template.gecko_conditional {
119
119
  @template.stylesheet_link_tag(@stylesheet)
120
- }.should eq("<!--[if Gecko]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
120
+ }).to eq("<!--[if Gecko]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
121
121
 
122
- @template.ie_mac_conditional {
122
+ expect(@template.ie_mac_conditional {
123
123
  @template.stylesheet_link_tag(@stylesheet)
124
- }.should eq("<!--[if IEMac]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
124
+ }).to eq("<!--[if IEMac]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
125
125
 
126
- @template.konqueror_conditional {
126
+ expect(@template.konqueror_conditional {
127
127
  @template.stylesheet_link_tag(@stylesheet)
128
- }.should eq("<!--[if Konq]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
128
+ }).to eq("<!--[if Konq]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
129
129
 
130
- @template.ie_mobile_conditional {
130
+ expect(@template.ie_mobile_conditional {
131
131
  @template.stylesheet_link_tag(@stylesheet)
132
- }.should eq("<!--[if IEmob]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
132
+ }).to eq("<!--[if IEmob]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
133
133
 
134
- @template.psp_conditional {
134
+ expect(@template.psp_conditional {
135
135
  @template.stylesheet_link_tag(@stylesheet)
136
- }.should eq("<!--[if PSP]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
136
+ }).to eq("<!--[if PSP]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
137
137
 
138
- @template.net_front_conditional {
138
+ expect(@template.net_front_conditional {
139
139
  @template.stylesheet_link_tag(@stylesheet)
140
- }.should eq("<!--[if NetF]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
140
+ }).to eq("<!--[if NetF]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
141
141
 
142
- @template.mobile_safari_conditional {
142
+ expect(@template.mobile_safari_conditional {
143
143
  @template.stylesheet_link_tag(@stylesheet)
144
- }.should eq("<!--[if SafMob]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
144
+ }).to eq("<!--[if SafMob]>\n<link href=\"/stylesheets/ie.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<![endif]-->")
145
145
 
146
146
  end
147
147
 
@@ -8,90 +8,90 @@ describe TopHat::TitleHelper do
8
8
 
9
9
  context "saving a title" do
10
10
  it "saves the title" do
11
- @template.title('Kind of Blue').should eq('Kind of Blue')
11
+ expect(@template.title('Kind of Blue')).to eq('Kind of Blue')
12
12
  end
13
13
  end
14
14
 
15
15
  context "displaying a title" do
16
16
  it "uses the website name if title is empty" do
17
- @template.title(:site => "Miles Davis").should eq("<title>Miles Davis</title>")
17
+ expect(@template.title(:site => "Miles Davis")).to eq("<title>Miles Davis</title>")
18
18
  end
19
19
 
20
20
  it "displays the title if no website was specified" do
21
21
  save_basic_title
22
- @template.title().should eq('<title>Kind of Blue</title>')
22
+ expect(@template.title()).to eq('<title>Kind of Blue</title>')
23
23
  end
24
24
 
25
25
  it "uses website before page by default" do
26
26
  save_basic_title
27
- @template.title(:site => "Miles Davis", :separator => '|').should eq("<title>Miles Davis | Kind of Blue</title>")
27
+ expect(@template.title(:site => "Miles Davis", :separator => '|')).to eq("<title>Miles Davis | Kind of Blue</title>")
28
28
  end
29
29
 
30
30
  it "only uses markup in titles in the view" do
31
- save_basic_title("<b>Kind of Blue</b>").should == "<b>Kind of Blue</b>"
32
- @template.title(:site => "Miles Davis", :separator => '|').should eq("<title>Miles Davis | Kind of Blue</title>")
31
+ expect(save_basic_title("<b>Kind of Blue</b>")).to eq("<b>Kind of Blue</b>")
32
+ expect(@template.title(:site => "Miles Davis", :separator => '|')).to eq("<title>Miles Davis | Kind of Blue</title>")
33
33
  end
34
34
 
35
35
  it "uses page before website if :reverse" do
36
36
  save_basic_title
37
- @template.title(:site => "Miles Davis", :reverse => true, :separator => '|').should eq("<title>Kind of Blue | Miles Davis</title>")
37
+ expect(@template.title(:site => "Miles Davis", :reverse => true, :separator => '|')).to eq("<title>Kind of Blue | Miles Davis</title>")
38
38
  end
39
39
 
40
40
  it "uses website before page if :reverse and :reverse_on_default" do
41
- @template.title(:site => "John Coltrane", :default => "My Favorite Things", :reverse => true, :reverse_on_default => false, :separator => '|').should eq("<title>John Coltrane | My Favorite Things</title>")
41
+ expect(@template.title(:site => "John Coltrane", :default => "My Favorite Things", :reverse => true, :reverse_on_default => false, :separator => '|')).to eq("<title>John Coltrane | My Favorite Things</title>")
42
42
  end
43
43
 
44
44
  it "lowercases the title if :lowercase" do
45
45
  save_basic_title
46
- @template.title(:site => "Miles Davis", :lowercase => true, :separator => '|').should eq("<title>miles davis | kind of blue</title>")
46
+ expect(@template.title(:site => "Miles Davis", :lowercase => true, :separator => '|')).to eq("<title>miles davis | kind of blue</title>")
47
47
  end
48
48
 
49
49
  it "uppercases the title if :uppercase" do
50
50
  save_basic_title
51
- @template.title(:site => "Miles Davis", :uppercase => true, :separator => '|').should eq("<title>MILES DAVIS | KIND OF BLUE</title>")
51
+ expect(@template.title(:site => "Miles Davis", :uppercase => true, :separator => '|')).to eq("<title>MILES DAVIS | KIND OF BLUE</title>")
52
52
  end
53
53
 
54
54
  it "uses a custom separator if :separator" do
55
55
  save_basic_title
56
- @template.title(:site => "Miles Davis", :separator => "-").should eq("<title>Miles Davis - Kind of Blue</title>")
57
- @template.title(:site => "Miles Davis", :separator => ":").should eq("<title>Miles Davis : Kind of Blue</title>")
58
- @template.title(:site => "Miles Davis", :separator => "&mdash;").should eq("<title>Miles Davis &amp;mdash; Kind of Blue</title>")
56
+ expect(@template.title(:site => "Miles Davis", :separator => "-")).to eq("<title>Miles Davis - Kind of Blue</title>")
57
+ expect(@template.title(:site => "Miles Davis", :separator => ":")).to eq("<title>Miles Davis : Kind of Blue</title>")
58
+ expect(@template.title(:site => "Miles Davis", :separator => "&mdash;")).to eq("<title>Miles Davis &amp;mdash; Kind of Blue</title>")
59
59
  end
60
60
 
61
61
  it "uses custom prefix and suffix if available" do
62
62
  save_basic_title
63
- @template.title(:site => "Miles Davis", :prefix => " |", :suffix => "| ", :separator => '|').should eq("<title>Miles Davis ||| Kind of Blue</title>")
63
+ expect(@template.title(:site => "Miles Davis", :prefix => " |", :suffix => "| ", :separator => '|')).to eq("<title>Miles Davis ||| Kind of Blue</title>")
64
64
  end
65
65
 
66
66
  it "collapses prefix if false" do
67
67
  save_basic_title
68
- @template.title(:site => "Miles Davis", :prefix => false, :separator => ":").should eq("<title>Miles Davis: Kind of Blue</title>")
68
+ expect(@template.title(:site => "Miles Davis", :prefix => false, :separator => ":")).to eq("<title>Miles Davis: Kind of Blue</title>")
69
69
  end
70
70
 
71
71
  it "collapses suffix if false" do
72
72
  save_basic_title
73
- @template.title(:site => "Miles Davis", :suffix => false, :separator => "~").should eq("<title>Miles Davis ~Kind of Blue</title>")
73
+ expect(@template.title(:site => "Miles Davis", :suffix => false, :separator => "~")).to eq("<title>Miles Davis ~Kind of Blue</title>")
74
74
  end
75
75
 
76
76
  it "uses all custom options if available" do
77
77
  save_basic_title
78
78
  custom_options = { :site => "Miles Davis", :prefix => " ", :suffix => " ", :separator => "-", :lowercase => true, :reverse => true }
79
- @template.title(custom_options).should eq("<title>kind of blue - miles davis</title>")
79
+ expect(@template.title(custom_options)).to eq("<title>kind of blue - miles davis</title>")
80
80
  end
81
81
 
82
82
  it "uses the default title if title is not present or blank" do
83
83
  save_basic_title("")
84
- @template.title(:site => "Miles Davis", :default => "Round About Midnight", :separator => '|').should eq("<title>Miles Davis | Round About Midnight</title>")
84
+ expect(@template.title(:site => "Miles Davis", :default => "Round About Midnight", :separator => '|')).to eq("<title>Miles Davis | Round About Midnight</title>")
85
85
  end
86
86
 
87
87
  it "allows custom options per title" do
88
88
  save_custom_title
89
- @template.title(:site => "Freddie Freeloader", :separator => '|').should eq("<title>Kind of Blue | Freddie Freeloader</title>")
89
+ expect(@template.title(:site => "Freddie Freeloader", :separator => '|')).to eq("<title>Kind of Blue | Freddie Freeloader</title>")
90
90
  end
91
91
 
92
92
  it "accepts an array of strings as the title" do
93
93
  @template.title(['My', 'Favorite', 'Things'])
94
- @template.title(:site => "Freddie Freeloader", :separator => '|').should eq("<title>Freddie Freeloader | My | Favorite | Things</title>")
94
+ expect(@template.title(:site => "Freddie Freeloader", :separator => '|')).to eq("<title>Freddie Freeloader | My | Favorite | Things</title>")
95
95
  end
96
96
  end
97
97
 
@@ -16,7 +16,7 @@ describe TopHat::TwitterCardHelper do
16
16
  @template.twitter_card('summary')
17
17
 
18
18
  output = @template.twitter_card
19
- output.should eq('<meta name="twitter:card" value="summary" />')
19
+ expect(output).to eq('<meta name="twitter:card" value="summary" />')
20
20
  end
21
21
 
22
22
  it 'generates twitter:card meta tags' do
@@ -28,8 +28,8 @@ describe TopHat::TwitterCardHelper do
28
28
  end
29
29
 
30
30
  output = @template.twitter_card
31
- output.should include('<meta name="twitter:title" value="Rain Man" />')
32
- output.should include('<meta name="twitter:image" value="http://someurl.com/animage.jpg" />')
31
+ expect(output).to include('<meta name="twitter:title" value="Rain Man" />')
32
+ expect(output).to include('<meta name="twitter:image" value="http://someurl.com/animage.jpg" />')
33
33
  end
34
34
 
35
35
  it 'generates nested twitter:card meta tags' do
@@ -41,9 +41,9 @@ describe TopHat::TwitterCardHelper do
41
41
  end
42
42
 
43
43
  output = @template.twitter_card
44
- output.should include('<meta name="twitter:image" value="http://someurl.com/animage.jpg" />')
45
- output.should include('<meta name="twitter:image:height" value="123" />')
46
- output.should include('<meta name="twitter:image:width" value="456" />')
44
+ expect(output).to include('<meta name="twitter:image" value="http://someurl.com/animage.jpg" />')
45
+ expect(output).to include('<meta name="twitter:image:height" value="123" />')
46
+ expect(output).to include('<meta name="twitter:image:width" value="456" />')
47
47
  end
48
48
 
49
49
 
@@ -57,8 +57,8 @@ describe TopHat::TwitterCardHelper do
57
57
  end
58
58
 
59
59
  output = @template.twitter_card
60
- output.should include('<meta name="twitter:player:stream" value="http://example.com/raw-stream/a.mp4" />')
61
- output.should include('<meta name="twitter:player:stream:content_type" value="123" />')
60
+ expect(output).to include('<meta name="twitter:player:stream" value="http://example.com/raw-stream/a.mp4" />')
61
+ expect(output).to include('<meta name="twitter:player:stream:content_type" value="123" />')
62
62
  end
63
63
 
64
64
  it 'supports default tags' do
@@ -73,9 +73,9 @@ describe TopHat::TwitterCardHelper do
73
73
  end
74
74
  end
75
75
 
76
- output.should include('<meta name="twitter:player:embed" value="https://example.com/embed/a" />')
77
- output.should include('<meta name="twitter:player:site" value="https://example.com" />')
78
- output.should_not include('<meta name="twitter:embed" value="https://example.com/embed/a" />')
76
+ expect(output).to include('<meta name="twitter:player:embed" value="https://example.com/embed/a" />')
77
+ expect(output).to include('<meta name="twitter:player:site" value="https://example.com" />')
78
+ expect(output).not_to include('<meta name="twitter:embed" value="https://example.com/embed/a" />')
79
79
  end
80
80
 
81
81
  end
@@ -7,84 +7,84 @@ describe TopHat do
7
7
  end
8
8
 
9
9
  it "is mixed into ActionView::Base" do
10
- ActionView::Base.included_modules.include?(TopHat::TitleHelper).should be_true
11
- ActionView::Base.included_modules.include?(TopHat::MetaHelper).should be_true
12
- ActionView::Base.included_modules.include?(TopHat::StylesheetHelper).should be_true
10
+ expect(ActionView::Base.included_modules.include?(TopHat::TitleHelper)).to be_truthy
11
+ expect(ActionView::Base.included_modules.include?(TopHat::MetaHelper)).to be_truthy
12
+ expect(ActionView::Base.included_modules.include?(TopHat::StylesheetHelper)).to be_truthy
13
13
  end
14
14
 
15
15
  it "responds to the 'title' helper" do
16
- @template.respond_to?(:title).should be_true
16
+ expect(@template.respond_to?(:title)).to be_truthy
17
17
  end
18
18
 
19
19
  it "responds to the 'title' helper alias" do
20
- @template.respond_to?(:t).should be_true
20
+ expect(@template.respond_to?(:t)).to be_truthy
21
21
  end
22
22
 
23
23
  it "responds to the 'description' helper" do
24
- @template.respond_to?(:description).should be_true
24
+ expect(@template.respond_to?(:description)).to be_truthy
25
25
  end
26
26
 
27
27
  it "responds to the 'keywords' helper" do
28
- @template.respond_to?(:keywords).should be_true
28
+ expect(@template.respond_to?(:keywords)).to be_truthy
29
29
  end
30
30
 
31
31
  it "responds to the 'ie_5_conditional' helper" do
32
- @template.respond_to?(:ie_5_conditional).should be_true
32
+ expect(@template.respond_to?(:ie_5_conditional)).to be_truthy
33
33
  end
34
34
 
35
35
  it "responds to the 'ie_5_5_conditional' helper" do
36
- @template.respond_to?(:ie_5_5_conditional).should be_true
36
+ expect(@template.respond_to?(:ie_5_5_conditional)).to be_truthy
37
37
  end
38
38
 
39
39
  it "responds to the 'ie_6_conditional' helper" do
40
- @template.respond_to?(:ie_6_conditional).should be_true
40
+ expect(@template.respond_to?(:ie_6_conditional)).to be_truthy
41
41
  end
42
42
 
43
43
  it "responds to the 'ie_7_conditional' helper" do
44
- @template.respond_to?(:ie_7_conditional).should be_true
44
+ expect(@template.respond_to?(:ie_7_conditional)).to be_truthy
45
45
  end
46
46
 
47
47
  it "responds to the 'ie_8_conditional' helper" do
48
- @template.respond_to?(:ie_8_conditional).should be_true
48
+ expect(@template.respond_to?(:ie_8_conditional)).to be_truthy
49
49
  end
50
50
 
51
51
  it "responds to the 'ie_9_conditional' helper" do
52
- @template.respond_to?(:ie_9_conditional).should be_true
52
+ expect(@template.respond_to?(:ie_9_conditional)).to be_truthy
53
53
  end
54
54
 
55
55
  it "responds to the 'opengraph' helper" do
56
- @template.respond_to?(:opengraph).should be_true
56
+ expect(@template.respond_to?(:opengraph)).to be_truthy
57
57
  end
58
58
 
59
59
  it "responds to the 'noindex' helper" do
60
- @template.respond_to?(:noindex).should be_true
60
+ expect(@template.respond_to?(:noindex)).to be_truthy
61
61
  end
62
62
 
63
63
  it "responds to the 'nofollow' helper" do
64
- @template.respond_to?(:nofollow).should be_true
64
+ expect(@template.respond_to?(:nofollow)).to be_truthy
65
65
  end
66
66
 
67
67
  it "responds to the 'canonical' helper" do
68
- @template.respond_to?(:canonical).should be_true
68
+ expect(@template.respond_to?(:canonical)).to be_truthy
69
69
  end
70
70
 
71
71
  it "responds to the 'twitter_card' helper" do
72
- @template.respond_to?(:twitter_card).should be_true
72
+ expect(@template.respond_to?(:twitter_card)).to be_truthy
73
73
  end
74
74
 
75
75
  it "responds to the 'html_tag' helper" do
76
- @template.respond_to?(:html_tag).should be_true
76
+ expect(@template.respond_to?(:html_tag)).to be_truthy
77
77
  end
78
78
 
79
79
  describe '.current' do
80
80
  it 'returns a hash' do
81
- TopHat.current.should be_kind_of(Hash)
81
+ expect(TopHat.current).to be_kind_of(Hash)
82
82
  end
83
83
 
84
84
  it 'allows the hash to be modified' do
85
85
  TopHat.current[:title] = 'foo'
86
86
 
87
- TopHat.current[:title].should eq('foo')
87
+ expect(TopHat.current[:title]).to eq('foo')
88
88
  end
89
89
  end
90
90
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Steve Agalloco"]
10
10
  s.email = ['steve.agalloco@gmail.com']
11
- s.homepage = "https://github.com/spagalloco/tophat"
11
+ s.homepage = "https://github.com/stve/tophat"
12
12
  s.description = %q{Simple view helpers for your layouts}
13
13
  s.summary = %q{Simple view helpers for your layouts}
14
14
 
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tophat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
5
- prerelease:
4
+ version: 2.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steve Agalloco
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-12 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: actionpack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
30
27
  description: Simple view helpers for your layouts
@@ -34,12 +31,11 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
37
- - .document
38
- - .gitignore
39
- - .rspec
40
- - .travis.yml
34
+ - ".document"
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - ".travis.yml"
41
38
  - Gemfile
42
- - Guardfile
43
39
  - LICENSE.md
44
40
  - README.md
45
41
  - Rakefile
@@ -64,35 +60,28 @@ files:
64
60
  - spec/tophat/twitter_card_helper_spec.rb
65
61
  - spec/tophat_spec.rb
66
62
  - tophat.gemspec
67
- homepage: https://github.com/spagalloco/tophat
63
+ homepage: https://github.com/stve/tophat
68
64
  licenses: []
65
+ metadata: {}
69
66
  post_install_message:
70
67
  rdoc_options: []
71
68
  require_paths:
72
69
  - lib
73
70
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
71
  requirements:
76
- - - ! '>='
72
+ - - ">="
77
73
  - !ruby/object:Gem::Version
78
74
  version: '0'
79
- segments:
80
- - 0
81
- hash: -2300101656837364012
82
75
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
76
  requirements:
85
- - - ! '>='
77
+ - - ">="
86
78
  - !ruby/object:Gem::Version
87
79
  version: '0'
88
- segments:
89
- - 0
90
- hash: -2300101656837364012
91
80
  requirements: []
92
81
  rubyforge_project:
93
- rubygems_version: 1.8.23
82
+ rubygems_version: 2.4.8
94
83
  signing_key:
95
- specification_version: 3
84
+ specification_version: 4
96
85
  summary: Simple view helpers for your layouts
97
86
  test_files:
98
87
  - spec/spec_helper.rb
data/Guardfile DELETED
@@ -1,6 +0,0 @@
1
- guard 'rspec', :cli => '--format documentation' do
2
- watch(%r{^spec/.+_spec\.rb})
3
- watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
- watch(%r{^lib/tophat/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_helper_spec.rb" }
5
- watch('spec/spec_helper.rb') { "spec" }
6
- end