snippr 0.15.21 → 0.15.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,49 +4,49 @@ require "spec_helper"
4
4
  describe Snippr do
5
5
 
6
6
  it "delegates path to Snippr::Path.path" do
7
- Snippr::Path.should respond_to(:path)
8
- Snippr::Path.should_receive(:path).and_return('path')
9
- subject.path.should == 'path'
7
+ expect(Snippr::Path).to respond_to(:path)
8
+ expect(Snippr::Path).to receive(:path).and_return('path')
9
+ expect(subject.path).to eq('path')
10
10
  end
11
11
 
12
12
  it "delegates path= to Snippr::Path.path=" do
13
- Snippr::Path.should respond_to(:path=)
14
- Snippr::Path.should_receive(:path=).with('path')
13
+ expect(Snippr::Path).to respond_to(:path=)
14
+ expect(Snippr::Path).to receive(:path=).with('path')
15
15
  subject.path = 'path'
16
16
  end
17
17
 
18
18
  it "delegates tardis= to Snippr::Tardis.enabled=" do
19
- Snippr::Tardis.should_receive(:enabled=).with(true)
19
+ expect(Snippr::Tardis).to receive(:enabled=).with(true)
20
20
  subject.tardis_enabled = true
21
21
  end
22
22
 
23
23
  it "delegates tardis to Snippr::Tardis.enabled" do
24
- Snippr::Tardis.should respond_to(:enabled)
25
- Snippr::Tardis.should_receive(:enabled)
24
+ expect(Snippr::Tardis).to respond_to(:enabled)
25
+ expect(Snippr::Tardis).to receive(:enabled)
26
26
  subject.tardis_enabled
27
27
  end
28
28
 
29
29
  it "delegates i18n? to Snippr::I18n.enabled?" do
30
- Snippr::I18n.should respond_to(:enabled?)
31
- Snippr::I18n.should_receive(:enabled?).and_return(true)
32
- subject.i18n?.should == true
30
+ expect(Snippr::I18n).to respond_to(:enabled?)
31
+ expect(Snippr::I18n).to receive(:enabled?).and_return(true)
32
+ expect(subject.i18n?).to eq(true)
33
33
  end
34
34
 
35
35
  it "delegates i18n= to Snippr::I18n.enabled=" do
36
- Snippr::I18n.should respond_to(:enabled=)
37
- Snippr::I18n.should_receive(:enabled=).with(true)
36
+ expect(Snippr::I18n).to respond_to(:enabled=)
37
+ expect(Snippr::I18n).to receive(:enabled=).with(true)
38
38
  subject.i18n = true
39
39
  end
40
40
 
41
41
  it "delegates adjust_urls_except? to Snippr::Links.adjust_urls_except" do
42
- Snippr::Links.should respond_to(:adjust_urls_except)
43
- Snippr::Links.should_receive(:adjust_urls_except).and_return([1])
44
- subject.adjust_urls_except.should == [1]
42
+ expect(Snippr::Links).to respond_to(:adjust_urls_except)
43
+ expect(Snippr::Links).to receive(:adjust_urls_except).and_return([1])
44
+ expect(subject.adjust_urls_except).to eq([1])
45
45
  end
46
46
 
47
47
  it "delegates adjust_urls_except= to Snippr::Links.adjust_urls_except=" do
48
- Snippr::Links.should respond_to(:adjust_urls_except=)
49
- Snippr::Links.should_receive(:adjust_urls_except=).with([2])
48
+ expect(Snippr::Links).to respond_to(:adjust_urls_except=)
49
+ expect(Snippr::Links).to receive(:adjust_urls_except=).with([2])
50
50
  subject.adjust_urls_except = [2]
51
51
  end
52
52
 
@@ -58,11 +58,11 @@ describe Snippr do
58
58
 
59
59
  it "can be configured" do
60
60
  Snippr.logger = :logger
61
- Snippr.logger.should == :logger
61
+ expect(Snippr.logger).to eq(:logger)
62
62
  end
63
63
 
64
64
  it "defaults to a custom logger" do
65
- Snippr.logger.should be_a(Logger)
65
+ expect(Snippr.logger).to be_a(Logger)
66
66
  end
67
67
 
68
68
  context "in a Rails app" do
@@ -76,7 +76,7 @@ describe Snippr do
76
76
  end
77
77
 
78
78
  it "uses the Rails logger" do
79
- Snippr.logger.should == :rails_logger
79
+ expect(Snippr.logger).to eq(:rails_logger)
80
80
  end
81
81
 
82
82
  end
@@ -84,13 +84,13 @@ describe Snippr do
84
84
  end
85
85
 
86
86
  it "delegates load to Snippr::Snip.new" do
87
- Snippr::Snip.should_receive(:new).with(:a, :b).and_return('snip')
88
- subject.load(:a, :b).should == 'snip'
87
+ expect(Snippr::Snip).to receive(:new).with(:a, :b).and_return('snip')
88
+ expect(subject.load(:a, :b)).to eq('snip')
89
89
  end
90
90
 
91
91
  it "delegates list to Snippr::Path.list" do
92
- Snippr::Path.should_receive(:list).with(:c, :d).and_return([:snip])
93
- subject.list(:c, :d).should == [:snip]
92
+ expect(Snippr::Path).to receive(:list).with(:c, :d).and_return([:snip])
93
+ expect(subject.list(:c, :d)).to eq([:snip])
94
94
  end
95
95
 
96
96
  end
@@ -5,12 +5,12 @@ describe Snippr::Tardis do
5
5
  describe ".enabled=" do
6
6
  it "accepts a block" do
7
7
  Snippr::Tardis.enabled = -> { "truthy" }
8
- Snippr::Tardis.enabled.should eq "truthy"
8
+ expect(Snippr::Tardis.enabled).to eq "truthy"
9
9
  end
10
10
 
11
11
  it "accepts simple values" do
12
12
  Snippr::Tardis.enabled = "truthy"
13
- Snippr::Tardis.enabled.should be_true
13
+ expect(Snippr::Tardis.enabled).to be_true
14
14
  end
15
15
  end
16
16
  end
@@ -15,12 +15,12 @@ describe Snippr::ViewHelper do
15
15
  end
16
16
 
17
17
  it "allows calling of methods on a Rails view" do
18
- snippr(:with_view_helper_method).should == "<!-- starting snippr: withViewHelperMethod -->\nwith helper *wrapppppp TEST ppppppparw*\n<!-- closing snippr: withViewHelperMethod -->"
18
+ expect(snippr(:with_view_helper_method)).to eq("<!-- starting snippr: withViewHelperMethod -->\nwith helper *wrapppppp TEST ppppppparw*\n<!-- closing snippr: withViewHelperMethod -->")
19
19
  end
20
20
 
21
21
  context "block given in snippet" do
22
22
  it "returns a correct snippet" do
23
- snippr(:with_block).should == "<!-- starting snippr: withBlock -->\nblock result: IN BLOCK-LINE \"TWO\"\n<!-- closing snippr: withBlock -->"
23
+ expect(snippr(:with_block)).to eq("<!-- starting snippr: withBlock -->\nblock result: IN BLOCK-LINE \"TWO\"\n<!-- closing snippr: withBlock -->")
24
24
  end
25
25
  end
26
26
 
@@ -29,22 +29,22 @@ describe Snippr::ViewHelper do
29
29
  context "existing snippet" do
30
30
 
31
31
  it "returns true when calling .exists?" do
32
- snippr(:home).exists?.should be_true
32
+ expect(snippr(:home).exists?).to be_true
33
33
  end
34
34
 
35
35
  it "returns false when calling .missing?" do
36
- snippr(:home).missing?.should be_false
36
+ expect(snippr(:home).missing?).to be_false
37
37
  end
38
38
 
39
39
  end
40
40
 
41
41
  context "missing snippet" do
42
42
  it "returns false when calling .exists?" do
43
- snippr(:missing).exists?.should be_false
43
+ expect(snippr(:missing).exists?).to be_false
44
44
  end
45
45
 
46
46
  it "returns true when calling .missing?" do
47
- snippr(:missing).missing?.should be_true
47
+ expect(snippr(:missing).missing?).to be_true
48
48
  end
49
49
  end
50
50
 
@@ -53,34 +53,34 @@ describe Snippr::ViewHelper do
53
53
  context "snippr with meta data" do
54
54
  context "and content" do
55
55
  it "returns a Hash of meta information" do
56
- snippr(:meta, :with_content).meta.should == {
56
+ expect(snippr(:meta, :with_content).meta).to eq({
57
57
  "description" => "Die mit dem Fluegli",
58
58
  "keywords" => "blau Mobilfunk GmbH, blau.de, blauworld, handy, sim"
59
- }
59
+ })
60
60
  end
61
61
 
62
62
  it "returns a hash ofmeta information even if the YAML Fron Matter BLock ends without newline" do
63
- snippr(:meta, :with_content_no_newline).meta.should == {
63
+ expect(snippr(:meta, :with_content_no_newline).meta).to eq({
64
64
  "description" => "Die mit dem Fluegli",
65
65
  "keywords" => "blau Mobilfunk GmbH, blau.de, blauworld, handy, sim"
66
- }
66
+ })
67
67
  end
68
68
 
69
69
  it "accepts a key to search for" do
70
- snippr(:meta, :with_content).meta("description").should == "Die mit dem Fluegli"
70
+ expect(snippr(:meta, :with_content).meta("description")).to eq("Die mit dem Fluegli")
71
71
  end
72
72
 
73
73
  it "returns the content without meta information" do
74
- snippr(:meta, :with_content).to_s.should == "<!-- starting snippr: meta/withContent -->\n<p>So meta!</p>\n<!-- closing snippr: meta/withContent -->"
74
+ expect(snippr(:meta, :with_content).to_s).to eq("<!-- starting snippr: meta/withContent -->\n<p>So meta!</p>\n<!-- closing snippr: meta/withContent -->")
75
75
  end
76
76
  end
77
77
 
78
78
  context "and no content" do
79
79
  it "still returns a Hash of meta information" do
80
- snippr(:meta, :with_no_content).meta.should == {
80
+ expect(snippr(:meta, :with_no_content).meta).to eq({
81
81
  "description" => "Die mit dem Fluegli",
82
82
  "keywords" => "blau Mobilfunk GmbH, blau.de, blauworld, handy, sim"
83
- }
83
+ })
84
84
  end
85
85
  end
86
86
 
@@ -98,31 +98,31 @@ describe Snippr::ViewHelper do
98
98
  expect(Snippr.logger).to receive(:warn).with(/Unable to extract meta data from Snip \"meta\/broken\"/)
99
99
 
100
100
  snip = snippr(:meta, :broken)
101
- snip.meta.should == {}
102
- snip.to_s.should == "<!-- starting snippr: meta/broken -->\n<p>Broken!</p>\n<!-- closing snippr: meta/broken -->"
101
+ expect(snip.meta).to eq({})
102
+ expect(snip.to_s).to eq("<!-- starting snippr: meta/broken -->\n<p>Broken!</p>\n<!-- closing snippr: meta/broken -->")
103
103
  end
104
104
  end
105
105
 
106
106
  context "existing snippr" do
107
107
  it "calls html_safe and return html safe value" do
108
108
  content = snippr(:home)
109
- content.should == "<!-- starting snippr: home -->\n<p>Home</p>\n<!-- closing snippr: home -->"
110
- content.should be_html_safe
109
+ expect(content).to eq("<!-- starting snippr: home -->\n<p>Home</p>\n<!-- closing snippr: home -->")
110
+ expect(content).to be_html_safe
111
111
  end
112
112
 
113
113
  it "passes html_safe snippr to block" do
114
- lambda {
114
+ expect {
115
115
  snippr(:home) do |snippr|
116
- snippr.should be_html_safe
116
+ expect(snippr).to be_html_safe
117
117
  raise StandardError.new('block should be called')
118
118
  end
119
- }.should raise_error StandardError, 'block should be called'
119
+ }.to raise_error StandardError, 'block should be called'
120
120
  end
121
121
 
122
122
  it "returns 0 with block" do
123
- snippr(:home) do
123
+ expect(snippr(:home) do
124
124
  ;
125
- end.should == 0
125
+ end).to eq(0)
126
126
  end
127
127
 
128
128
  end
@@ -131,17 +131,17 @@ describe Snippr::ViewHelper do
131
131
 
132
132
  it "calls html_safe return html save value" do
133
133
  content = snippr(:empty)
134
- content.should == "<!-- starting snippr: empty -->\n\n<!-- closing snippr: empty -->"
135
- content.should be_html_safe
134
+ expect(content).to eq("<!-- starting snippr: empty -->\n\n<!-- closing snippr: empty -->")
135
+ expect(content).to be_html_safe
136
136
  end
137
137
 
138
138
  it "doesn't pass snippr to block but concat snippr and return 0" do
139
139
  expect(self).to receive(:concat).with("<!-- starting snippr: empty -->\n\n<!-- closing snippr: empty -->")
140
- lambda {
141
- snippr(:empty) do
140
+ expect {
141
+ expect(snippr(:empty) do
142
142
  raise StandardError.new('block should not be called')
143
- end.should == 0
144
- }.should_not raise_error
143
+ end).to eq(0)
144
+ }.not_to raise_error
145
145
  end
146
146
 
147
147
  end
@@ -150,17 +150,17 @@ describe Snippr::ViewHelper do
150
150
 
151
151
  it "calls html_safe return html save value" do
152
152
  content = snippr(:doesnotexist)
153
- content.should == '<!-- missing snippr: doesnotexist -->'
154
- content.should be_html_safe
153
+ expect(content).to eq('<!-- missing snippr: doesnotexist -->')
154
+ expect(content).to be_html_safe
155
155
  end
156
156
 
157
157
  it "doesn't pass snippr to block but concat snippr and return 0" do
158
158
  expect(self).to receive(:concat).with('<!-- missing snippr: doesnotexist -->')
159
- lambda {
160
- snippr(:doesnotexist) do
159
+ expect {
160
+ expect(snippr(:doesnotexist) do
161
161
  raise StandardError.new('block should not be called')
162
- end.should == 0
163
- }.should_not raise_error
162
+ end).to eq(0)
163
+ }.not_to raise_error
164
164
  end
165
165
 
166
166
  end
@@ -177,20 +177,20 @@ describe Snippr::ViewHelper do
177
177
  end
178
178
 
179
179
  it "uses the path given in 'id' param" do
180
- snippr_with_path(:a_snippet).should == "<!-- starting snippr: a/path/aSnippet -->\na snippet\n<!-- closing snippr: a/path/aSnippet -->"
180
+ expect(snippr_with_path(:a_snippet)).to eq("<!-- starting snippr: a/path/aSnippet -->\na snippet\n<!-- closing snippr: a/path/aSnippet -->")
181
181
  end
182
182
 
183
183
  it "works with a given block" do
184
- lambda {
184
+ expect {
185
185
  snippr_with_path(:a_snippet) do |snippr|
186
- snippr.should be_html_safe
186
+ expect(snippr).to be_html_safe
187
187
  raise StandardError.new('block should be called')
188
188
  end
189
- }.should raise_error StandardError, 'block should be called'
189
+ }.to raise_error StandardError, 'block should be called'
190
190
  end
191
191
 
192
192
  it "works with parameters hash" do
193
- snippr_with_path(:a_snippet_with_param, :param => "value").should == "<!-- starting snippr: a/path/aSnippetWithParam -->\na snippet with param value\n<!-- closing snippr: a/path/aSnippetWithParam -->"
193
+ expect(snippr_with_path(:a_snippet_with_param, :param => "value")).to eq("<!-- starting snippr: a/path/aSnippetWithParam -->\na snippet with param value\n<!-- closing snippr: a/path/aSnippetWithParam -->")
194
194
  end
195
195
 
196
196
  end
@@ -203,24 +203,24 @@ describe Snippr::ViewHelper do
203
203
  end
204
204
 
205
205
  it "camelizes controller and action names" do
206
- snippr_with_path(:a_snippet).should == "<!-- starting snippr: withUnderscore/andUnderscore/aSnippet -->\nan underscored snippet with param \n<!-- closing snippr: withUnderscore/andUnderscore/aSnippet -->"
206
+ expect(snippr_with_path(:a_snippet)).to eq("<!-- starting snippr: withUnderscore/andUnderscore/aSnippet -->\nan underscored snippet with param {param}\n<!-- closing snippr: withUnderscore/andUnderscore/aSnippet -->")
207
207
  end
208
208
 
209
209
  it "works with a given block" do
210
- lambda {
210
+ expect {
211
211
  snippr_with_path(:a_snippet) do |snippr|
212
- snippr.should be_html_safe
212
+ expect(snippr).to be_html_safe
213
213
  raise StandardError.new('block should be called')
214
214
  end
215
- }.should raise_error StandardError, 'block should be called'
215
+ }.to raise_error StandardError, 'block should be called'
216
216
  end
217
217
 
218
218
  it "works with parameters hash" do
219
- snippr_with_path(:a_snippet, :param => "value").should == "<!-- starting snippr: withUnderscore/andUnderscore/aSnippet -->\nan underscored snippet with param value\n<!-- closing snippr: withUnderscore/andUnderscore/aSnippet -->"
219
+ expect(snippr_with_path(:a_snippet, :param => "value")).to eq("<!-- starting snippr: withUnderscore/andUnderscore/aSnippet -->\nan underscored snippet with param value\n<!-- closing snippr: withUnderscore/andUnderscore/aSnippet -->")
220
220
  end
221
221
 
222
222
  it "allows multiple arguments" do
223
- snippr_with_path(:deeper, :nested, :snippet).should == "<!-- missing snippr: withUnderscore/andUnderscore/deeper/nested/snippet -->"
223
+ expect(snippr_with_path(:deeper, :nested, :snippet)).to eq("<!-- missing snippr: withUnderscore/andUnderscore/deeper/nested/snippet -->")
224
224
  end
225
225
  end
226
226
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snippr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.21
4
+ version: 0.15.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-02 00:00:00.000000000 Z
13
+ date: 2014-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -169,6 +169,7 @@ files:
169
169
  - spec/fixtures/snip/subdir/subdir2/snippet.snip
170
170
  - spec/fixtures/topup/someError.snip
171
171
  - spec/fixtures/topup/success.snip
172
+ - spec/fixtures/using_brackets_for_inline_styles/snippet.snip
172
173
  - spec/fixtures/withBlock.snip
173
174
  - spec/fixtures/withUnderscore/andUnderscore/aSnippet.snip
174
175
  - spec/fixtures/withViewHelperMethod.snip
@@ -244,6 +245,7 @@ test_files:
244
245
  - spec/fixtures/snip/subdir/subdir2/snippet.snip
245
246
  - spec/fixtures/topup/someError.snip
246
247
  - spec/fixtures/topup/success.snip
248
+ - spec/fixtures/using_brackets_for_inline_styles/snippet.snip
247
249
  - spec/fixtures/withBlock.snip
248
250
  - spec/fixtures/withUnderscore/andUnderscore/aSnippet.snip
249
251
  - spec/fixtures/withViewHelperMethod.snip