snippr 0.15.12 → 0.15.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTRlNGI2NWQwZGQwNTUyYTcxMjllY2VlYjUwYzVmYzVmN2EzMjUzZg==
4
+ ZjljYWNkZjRjNWEyZjAyZmU5MTExNDAwZjRkNTdmOTUzODA4NjA4NQ==
5
5
  data.tar.gz: !binary |-
6
- ZTk1YzZiYTU1NDE3NjBhOTc3OGI2NWMwNDQ2NDY5MmJjNzBkNWIwZg==
6
+ ZWFiYjcyYjI3NWQ3OTU1ZjllOWE5ODBmYjZlNTZiYjNhNTRjNjdhNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmNmODYzZDQ0NjI3Y2ZkYzgwZjg2YTVmNTBlYTlkYmYyOGFkYTc2YzUzMWI5
10
- ODcwNTNmNjU1YzkyMzc5ZGMzNmIyYWYyN2QxYWUzNjA1MzNkOTRiYmE4ZGZj
11
- NjRmYjBkMmJmODMyNGYyZTNhMjg5ZDk3MzkwMDQ2OWM4OWEwMDU=
9
+ ZTk1YTY3ODk4NjNkODEwNzZiODAyZDUwOWIzYmIxZmRmZjcyNzQ0YmNmNTll
10
+ OWZkYzEyOWU1MTc2MWU1YjJiMTkzODFiN2U0MWJkNGIwMzM3MDYwZDQxYjFm
11
+ YzI1N2FjMzYyNjI3M2Y0OGFkNWYyZmEyZmEwNjc2MDc4YTU5Zjk=
12
12
  data.tar.gz: !binary |-
13
- MGM2MzEyMmVlYzc3YzFkODk0YWExYjg5MTNjMjQwNjM5YWE3ODg2MDNmMDNh
14
- NmQxN2VlYzUzYzlmZWM0NWVhNDU4MGFiNDNlOWVjNTNhYTNlYzFlZjA1Y2U5
15
- ODkzOTlmNWU3M2ZkOGQ3ZDM4N2ZhZjAyMjFlMTVjM2Q0MzY4NmQ=
13
+ ZmVmMGM0ZmFlOGEyZmM0MmZjNTYzOTllYmM1ZWUyM2ZjN2ZhODM2N2I2MTZk
14
+ ODNkMmExNjIyYjU5ZGIzYWE5NzMyM2RiODcwMWQ0NjlmZDUyZGVmM2NiODg1
15
+ YWYyZjEyMDVkYjc5MGIyMTc5NmIyNTE4MWRjZThjZTY3MDYxMmE=
data/lib/snippr/snip.rb CHANGED
@@ -15,6 +15,7 @@ module Snippr
15
15
  @name = "#{Path.normalize_name(*names)}#{ I18n.locale(@opts[:i18n]) }"
16
16
  @path = Path.path_from_name @name, (@opts[:extension] || FILE_EXTENSION)
17
17
  @unprocessed_content, @meta = MetaData.extract(names, raw_content)
18
+ after_initialize
18
19
  end
19
20
 
20
21
  attr_reader :name, :path, :opts, :unprocessed_content, :meta
@@ -47,6 +48,8 @@ module Snippr
47
48
  unprocessed_content.blank?
48
49
  end
49
50
 
51
+ def after_initialize; end
52
+
50
53
  private
51
54
 
52
55
  def strip_empty_values(names)
data/snippr.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "snippr"
4
- s.version = "0.15.12"
4
+ s.version = "0.15.14"
5
5
  s.date = Time.now
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Daniel Harrington", "Thomas Jachmann", "Frank Schumacher"]
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_development_dependency "ci_reporter", "~> 1.6.5"
20
20
  s.add_development_dependency "rspec", "~> 2.14.0"
21
- s.add_development_dependency "mocha", "= 0.11.4"
22
21
  s.add_development_dependency "rake", "~> 10.0"
23
22
 
24
23
  unless ENV["CI"]
@@ -1,15 +1,16 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require "spec_helper"
2
3
 
3
4
  describe Snippr::Links do
4
5
 
5
6
  describe "adjust_urls_except" do
6
7
 
7
- it "should default to [/^#/, /^[a-z]+:/i]" do
8
+ it "defaults to [/^#/, /^[a-z]+:/i]" do
8
9
  subject.adjust_urls_except = nil
9
10
  subject.adjust_urls_except.should == [/^#/, /^[a-z]+:/i]
10
11
  end
11
12
 
12
- it "should store exceptions" do
13
+ it "stores exceptions" do
13
14
  subject.adjust_urls_except = [/^cms.*/]
14
15
  subject.adjust_urls_except.should == [/^cms.*/]
15
16
  end
@@ -18,22 +19,22 @@ describe Snippr::Links do
18
19
 
19
20
  describe ".adjust_link" do
20
21
 
21
- it "should return an a without href unchanged" do
22
+ it "returns an a without href unchanged" do
22
23
  subject.adjust_link('<a name="headline"/>').should == '<a name="headline"/>'
23
24
  end
24
25
 
25
- it "should adjust the href to the adjustd_url" do
26
- subject.expects(:adjust_url).with('url').returns('adjustd_url')
26
+ it "adjusts the href to the adjustd_url" do
27
+ subject.should_receive(:adjust_url).with('url').and_return('adjustd_url')
27
28
  subject.adjust_link('<a onclick="return true;" href="url" class="link">test</a>').should == '<a onclick="return true;" href="adjustd_url" class="link">test</a>'
28
29
  end
29
30
 
30
- it "should add an onclick when href starts with popup:" do
31
- subject.expects(:adjust_url).with('popup_url').returns('adjustd_url')
31
+ it "adds an onclick when href starts with popup:" do
32
+ subject.should_receive(:adjust_url).with('popup_url').and_return('adjustd_url')
32
33
  subject.adjust_link('<a href="popup:popup_url" class="link">test</a>').should == '<a href="adjustd_url" class="link" onclick="if (typeof popup == \'undefined\') { return true; } else { popup(this); return false; }">test</a>'
33
34
  end
34
35
 
35
- it "should replace an existing onclick when href starts with popup:" do
36
- subject.expects(:adjust_url).with('url').returns('adjustd_url')
36
+ it "replaces an existing onclick when href starts with popup:" do
37
+ subject.should_receive(:adjust_url).with('url').and_return('adjustd_url')
37
38
  subject.adjust_link('<a onclick="return true;" href="popup://url" class="link">test</a>').should == '<a onclick="if (typeof popup == \'undefined\') { return true; } else { popup(this); return false; }" href="adjustd_url" class="link">test</a>'
38
39
  end
39
40
 
@@ -42,42 +43,42 @@ describe Snippr::Links do
42
43
  describe ".adjust_url" do
43
44
 
44
45
  before do
45
- subject.stubs(:relative_url_root).returns('/root/')
46
+ allow(subject).to receive(:relative_url_root).and_return('/root/')
46
47
  end
47
48
 
48
- it "should leave absolute links (http) as is" do
49
+ it "leaves absolute links (http) as is" do
49
50
  subject.adjust_url('http://www.blaulabs.de').should == 'http://www.blaulabs.de'
50
51
  end
51
52
 
52
- it "should leave absolute links (https) as is" do
53
+ it "leaves absolute links (https) as is" do
53
54
  subject.adjust_url('https://www.blaulabs.de').should == 'https://www.blaulabs.de'
54
55
  end
55
56
 
56
- it "should leave special links (mailto) as is" do
57
+ it "leaves special links (mailto) as is" do
57
58
  subject.adjust_url('mailto:info@blau.de').should == 'mailto:info@blau.de'
58
59
  end
59
60
 
60
- it "should convert relative links to server absolute links" do
61
+ it "converts relative links to server absolute links" do
61
62
  subject.adjust_url('relative.html').should == '/root/relative.html'
62
63
  end
63
64
 
64
- it "should convert app absolute links to server absolute links" do
65
+ it "converts app absolute links to server absolute links" do
65
66
  subject.adjust_url('/absolute.html').should == '/root/absolute.html'
66
67
  end
67
68
 
68
- it "should leave internal links (#) as is" do
69
+ it "leaves internal links (#) as is" do
69
70
  subject.adjust_url('#aname').should == '#aname'
70
71
  end
71
72
 
72
- it "should convert links excepted in next test to server absolute links" do
73
+ it "converts links excepted in next test to server absolute links" do
73
74
  subject.adjust_url('/cms/excepted.html').should == '/root/cms/excepted.html'
74
75
  end
75
76
 
76
- it "should leave server absolute links as is" do
77
+ it "leaves server absolute links as is" do
77
78
  subject.adjust_url('/root/bla/absolute.html').should == '/root/bla/absolute.html'
78
79
  end
79
80
 
80
- it "should leave excepted links as is" do
81
+ it "leaves excepted links as is" do
81
82
  subject.adjust_urls_except << /^\/cms\//
82
83
  subject.adjust_url('/cms/excepted.html').should == '/cms/excepted.html'
83
84
  end
@@ -86,7 +87,7 @@ describe Snippr::Links do
86
87
 
87
88
  describe ".relative_url_root" do
88
89
 
89
- it "should return / without rails" do
90
+ it "returns / without rails" do
90
91
  subject.relative_url_root.should == '/'
91
92
  end
92
93
 
@@ -100,33 +101,33 @@ describe Snippr::Links do
100
101
  Object.send :remove_const, :ActionController
101
102
  end
102
103
 
103
- it "should return / with relative_url_root set to nil" do
104
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => nil)
104
+ it "returns / with relative_url_root set to nil" do
105
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => nil)
105
106
  subject.relative_url_root.should == '/'
106
107
  end
107
108
 
108
- it "should return / with relative_url_root set to empty string" do
109
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => '')
109
+ it "returns / with relative_url_root set to empty string" do
110
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => '')
110
111
  subject.relative_url_root.should == '/'
111
112
  end
112
113
 
113
- it "should return / with relative_url_root set to /" do
114
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => '/')
114
+ it "returns / with relative_url_root set to /" do
115
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => '/')
115
116
  subject.relative_url_root.should == '/'
116
117
  end
117
118
 
118
- it "should return /root/ with relative_url_root set to root" do
119
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => 'root')
119
+ it "returns /root/ with relative_url_root set to root" do
120
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => 'root')
120
121
  subject.relative_url_root.should == '/root/'
121
122
  end
122
123
 
123
- it "should return /root/ with relative_url_root set to /root" do
124
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => '/root')
124
+ it "returns /root/ with relative_url_root set to /root" do
125
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => '/root')
125
126
  subject.relative_url_root.should == '/root/'
126
127
  end
127
128
 
128
- it "should return /root/ with relative_url_root set to /root/" do
129
- ActionController::Base.stubs(:config).returns(stub :relative_url_root => '/root/')
129
+ it "returns /root/ with relative_url_root set to /root/" do
130
+ allow(ActionController::Base).to receive(:config).and_return(double :relative_url_root => '/root/')
130
131
  subject.relative_url_root.should == '/root/'
131
132
  end
132
133
 
@@ -5,11 +5,11 @@ describe Snippr::Normalizer do
5
5
 
6
6
  describe ".normalizers" do
7
7
 
8
- it "should be an array" do
8
+ it "is an array" do
9
9
  subject.normalizers.should be_an(Array)
10
10
  end
11
11
 
12
- it "should have a set of default normalizers" do
12
+ it "has a set of default normalizers" do
13
13
  normalizers = subject.normalizers
14
14
  normalizers.size.should == 1
15
15
  normalizers[0].should be_a(Snippr::Normalizer::Camelizer)
@@ -27,11 +27,10 @@ describe Snippr::Normalizer do
27
27
  subject.normalizers.pop # remove second normalizer
28
28
  end
29
29
 
30
- it "should call normalize on all normalizers, passing the path element between them and returning the last result" do
31
- seq = sequence "normalizers"
30
+ it "calls normalize on all normalizers, passing the path element between them and returning the last result" do
32
31
  subject.normalizers.each_with_index do |normalizer, i|
33
32
  normalizer.should respond_to(:normalize)
34
- normalizer.expects(:normalize).with(i.to_s).returns((i + 1).to_s).in_sequence(seq)
33
+ expect(normalizer).to receive(:normalize).with(i.to_s).and_return((i + 1).to_s)
35
34
  end
36
35
  subject.normalize('0').should == subject.normalizers.size.to_s
37
36
  end
@@ -25,9 +25,8 @@ describe Snippr::Path do
25
25
  describe ".normalize_name" do
26
26
 
27
27
  it "calls Snippr::Normalizer.normalize with all names and return normalized result" do
28
- seq = sequence "normalizers"
29
- Snippr::Normalizer.expects(:normalize).with("a").in_sequence(seq).returns("AA")
30
- Snippr::Normalizer.expects(:normalize).with(:b).in_sequence(seq).returns("BB")
28
+ expect(Snippr::Normalizer).to receive(:normalize).with("a").and_return("AA")
29
+ expect(Snippr::Normalizer).to receive(:normalize).with(:b).and_return("BB")
31
30
  subject.normalize_name("a", :b).should == "AA/BB"
32
31
  end
33
32
 
@@ -1,11 +1,11 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require "spec_helper"
2
3
 
3
4
  describe Snippr::Processor::Links do
4
5
 
5
6
  it "should call Snippr::Links.adjust_link with the links found and return the results" do
6
- seq = sequence 'links'
7
- Snippr::Links.expects(:adjust_link).with('<a href="http://www.blaulabs.de" onclick="return true;">here</a>').in_sequence(seq).returns('--here--')
8
- Snippr::Links.expects(:adjust_link).with('<A class=\'link\' href="internal.html">or here</A>').in_sequence(seq).returns('--or here--')
7
+ expect(Snippr::Links).to receive(:adjust_link).with('<a href="http://www.blaulabs.de" onclick="return true;">here</a>').and_return('--here--')
8
+ expect(Snippr::Links).to receive(:adjust_link).with('<A class=\'link\' href="internal.html">or here</A>').and_return('--or here--')
9
9
  subject.process('click <a href="http://www.blaulabs.de" onclick="return true;">here</a> <A class=\'link\' href="internal.html">or here</A>').should == 'click --here-- --or here--'
10
10
  end
11
11
 
@@ -1,11 +1,11 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require "spec_helper"
2
3
 
3
4
  describe Snippr::Processor::Wikilinks do
4
5
 
5
6
  it "should call Snippr::Links.adjust_link with the links found and return the results" do
6
- seq = sequence 'wikilinks'
7
- Snippr::Links.expects(:adjust_link).with('<a href="http://www.blaulabs.de">here</a>').in_sequence(seq).returns('--here--')
8
- Snippr::Links.expects(:adjust_link).with('<a href="internal.html">or here</a>').in_sequence(seq).returns('--or here--')
7
+ expect(Snippr::Links).to receive(:adjust_link).with('<a href="http://www.blaulabs.de">here</a>').and_return('--here--')
8
+ expect(Snippr::Links).to receive(:adjust_link).with('<a href="internal.html">or here</a>').and_return('--or here--')
9
9
  subject.process('click [[http://www.blaulabs.de|here]] [[internal.html|or here]]').should == 'click --here-- --or here--'
10
10
  end
11
11
 
@@ -24,10 +24,9 @@ describe Snippr::Processor do
24
24
  describe ".process" do
25
25
 
26
26
  it "calls process on all processors, passing the content between them and returning the last result" do
27
- seq = sequence 'processors'
28
27
  subject.processors.each_with_index do |processor, i|
29
28
  processor.should respond_to(:process)
30
- processor.expects(:process).with(i.to_s, {'1' => '2'}).returns((i + 1).to_s).in_sequence(seq)
29
+ expect(processor).to receive(:process).with(i.to_s, {'1' => '2'}).and_return((i + 1).to_s)
31
30
  end
32
31
  subject.process('0', {'1' => '2'}).should == subject.processors.size.to_s
33
32
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
 
4
4
  describe "Snippr::SegmentFilter::OnHoAst" do
5
5
  before do
6
- Socket.expects(:gethostname).returns("thishost")
6
+ allow(Socket).to receive(:gethostname).and_return("thishost")
7
7
  end
8
8
 
9
9
  it "is active on the given host" do
@@ -12,7 +12,7 @@ describe "Snippr::SegmentFilter::OnRailsEnv" do
12
12
  end
13
13
 
14
14
  it "is active in the defined environment" do
15
- Rails.expects(:env).returns("test")
15
+ expect(Rails).to receive(:env).and_return("test")
16
16
  Snippr::SegmentFilter::OnRailsEnv.new("test").should be_active
17
17
  end
18
18
 
@@ -15,6 +15,11 @@ describe Snippr::Snip do
15
15
  Snippr::I18n.enabled = false
16
16
  end
17
17
 
18
+ it "calls #after_initialize" do
19
+ Snippr::Snip.any_instance.should_receive(:after_initialize).once
20
+ Snippr::Snip.new(:path_to_snips, :file)
21
+ end
22
+
18
23
  it "initializes name, path and opts without opts" do
19
24
  snip = Snippr::Snip.new(:path_to_snips, :file)
20
25
  snip.name.should == 'pathToSnips/file'
@@ -102,14 +107,14 @@ describe Snippr::Snip do
102
107
  end
103
108
 
104
109
  it "stores the read data instead of reading it again" do
105
- File.expects(:read).once.returns('data')
110
+ File.should_receive(:read).once.and_return('data')
106
111
  snip = Snippr::Snip.new(:home)
107
112
  snip.unprocessed_content.should == 'data'
108
113
  snip.unprocessed_content.should == 'data'
109
114
  end
110
115
 
111
116
  it "returns an empty string on missing snips" do
112
- File.expects(:read).never
117
+ File.should_receive(:read).never
113
118
  Snippr::Snip.new(:doesnotexist).unprocessed_content.should == ''
114
119
  end
115
120
 
@@ -122,19 +127,19 @@ describe Snippr::Snip do
122
127
  describe "content" do
123
128
 
124
129
  it "calls Snippr::Processor.process with opts and return decorated result" do
125
- Snippr::Processor.expects(:process).with('<p>Home</p>', {:a => :b}).returns('processed')
130
+ Snippr::Processor.should_receive(:process).with('<p>Home</p>', {:a => :b}).and_return('processed')
126
131
  Snippr::Snip.new(:home, :a => :b).content.should == "<!-- starting snippr: home -->\nprocessed\n<!-- closing snippr: home -->"
127
132
  end
128
133
 
129
134
  it "stores the processed data instead of processing it again" do
130
- Snippr::Processor.expects(:process).with('<p>Home</p>', {:a => :b}).once.returns('processed')
135
+ Snippr::Processor.should_receive(:process).with('<p>Home</p>', {:a => :b}).once.and_return('processed')
131
136
  snip = Snippr::Snip.new(:home, :a => :b)
132
137
  snip.content.should == "<!-- starting snippr: home -->\nprocessed\n<!-- closing snippr: home -->"
133
138
  snip.content.should == "<!-- starting snippr: home -->\nprocessed\n<!-- closing snippr: home -->"
134
139
  end
135
140
 
136
141
  it "doesn't call Snippr::Processor.process and return missing string" do
137
- Snippr::Processor.expects(:process).never
142
+ Snippr::Processor.should_receive(:process).never
138
143
  Snippr::Snip.new(:doesnotexist, :a => :b).content.should == '<!-- missing snippr: doesnotexist -->'
139
144
  end
140
145
  end
@@ -5,48 +5,48 @@ describe Snippr do
5
5
 
6
6
  it "delegates path to Snippr::Path.path" do
7
7
  Snippr::Path.should respond_to(:path)
8
- Snippr::Path.expects(:path).returns('path')
8
+ Snippr::Path.should_receive(:path).and_return('path')
9
9
  subject.path.should == 'path'
10
10
  end
11
11
 
12
12
  it "delegates path= to Snippr::Path.path=" do
13
13
  Snippr::Path.should respond_to(:path=)
14
- Snippr::Path.expects(:path=).with('path')
14
+ Snippr::Path.should_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.expects(:enabled=).with(true)
19
+ Snippr::Tardis.should_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
24
  Snippr::Tardis.should respond_to(:enabled)
25
- Snippr::Tardis.expects(:enabled)
25
+ Snippr::Tardis.should_receive(:enabled)
26
26
  subject.tardis_enabled
27
27
  end
28
28
 
29
29
  it "delegates i18n? to Snippr::I18n.enabled?" do
30
30
  Snippr::I18n.should respond_to(:enabled?)
31
- Snippr::I18n.expects(:enabled?).returns(true)
31
+ Snippr::I18n.should_receive(:enabled?).and_return(true)
32
32
  subject.i18n?.should == true
33
33
  end
34
34
 
35
35
  it "delegates i18n= to Snippr::I18n.enabled=" do
36
36
  Snippr::I18n.should respond_to(:enabled=)
37
- Snippr::I18n.expects(:enabled=).with(true)
37
+ Snippr::I18n.should_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
42
  Snippr::Links.should respond_to(:adjust_urls_except)
43
- Snippr::Links.expects(:adjust_urls_except).returns([1])
43
+ Snippr::Links.should_receive(:adjust_urls_except).and_return([1])
44
44
  subject.adjust_urls_except.should == [1]
45
45
  end
46
46
 
47
47
  it "delegates adjust_urls_except= to Snippr::Links.adjust_urls_except=" do
48
48
  Snippr::Links.should respond_to(:adjust_urls_except=)
49
- Snippr::Links.expects(:adjust_urls_except=).with([2])
49
+ Snippr::Links.should_receive(:adjust_urls_except=).with([2])
50
50
  subject.adjust_urls_except = [2]
51
51
  end
52
52
 
@@ -84,12 +84,12 @@ describe Snippr do
84
84
  end
85
85
 
86
86
  it "delegates load to Snippr::Snip.new" do
87
- Snippr::Snip.expects(:new).with(:a, :b).returns('snip')
87
+ Snippr::Snip.should_receive(:new).with(:a, :b).and_return('snip')
88
88
  subject.load(:a, :b).should == 'snip'
89
89
  end
90
90
 
91
91
  it "delegates list to Snippr::Path.list" do
92
- Snippr::Path.expects(:list).with(:c, :d).returns([:snip])
92
+ Snippr::Path.should_receive(:list).with(:c, :d).and_return([:snip])
93
93
  subject.list(:c, :d).should == [:snip]
94
94
  end
95
95
 
@@ -95,9 +95,7 @@ describe Snippr::ViewHelper do
95
95
  context "snippr with broken meta data" do
96
96
 
97
97
  it "logs a warning and acts as if no meta information exist" do
98
- Snippr.logger.expects(:warn).with do |msg|
99
- msg =~ /Unable to extract meta data from Snip \[:meta, :broken\]/
100
- end
98
+ expect(Snippr.logger).to receive(:warn).with(/Unable to extract meta data from Snip \[:meta, :broken\]/)
101
99
 
102
100
  snip = snippr(:meta, :broken)
103
101
  snip.meta.should == {}
@@ -138,7 +136,7 @@ describe Snippr::ViewHelper do
138
136
  end
139
137
 
140
138
  it "doesn't pass snippr to block but concat snippr and return 0" do
141
- expects(:concat).with("<!-- starting snippr: empty -->\n\n<!-- closing snippr: empty -->")
139
+ expect(self).to receive(:concat).with("<!-- starting snippr: empty -->\n\n<!-- closing snippr: empty -->")
142
140
  lambda {
143
141
  snippr(:empty) do
144
142
  raise StandardError.new('block should not be called')
@@ -157,7 +155,7 @@ describe Snippr::ViewHelper do
157
155
  end
158
156
 
159
157
  it "doesn't pass snippr to block but concat snippr and return 0" do
160
- expects(:concat).with('<!-- missing snippr: doesnotexist -->')
158
+ expect(self).to receive(:concat).with('<!-- missing snippr: doesnotexist -->')
161
159
  lambda {
162
160
  snippr(:doesnotexist) do
163
161
  raise StandardError.new('block should not be called')
@@ -174,8 +172,8 @@ describe Snippr::ViewHelper do
174
172
  context "on pages controller (special case)" do
175
173
 
176
174
  before do
177
- stubs(:controller_name).returns("pages")
178
- stubs(:params).returns(:id => "a/path", :action => :view)
175
+ allow(self).to receive(:controller_name).and_return("pages")
176
+ allow(self).to receive(:params).and_return(:id => "a/path", :action => :view)
179
177
  end
180
178
 
181
179
  it "uses the path given in 'id' param" do
@@ -200,8 +198,8 @@ describe Snippr::ViewHelper do
200
198
  context "on standard controllers" do
201
199
 
202
200
  before do
203
- stubs(:controller_name).returns("with_underscore")
204
- stubs(:params).returns(:action => :and_underscore)
201
+ allow(self).to receive(:controller_name).and_return("with_underscore")
202
+ allow(self).to receive(:params).and_return(:action => :and_underscore)
205
203
  end
206
204
 
207
205
  it "camelizes controller and action names" do
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@ require 'snippr'
6
6
  Bundler.require(:default, :development)
7
7
 
8
8
  RSpec.configure do |config|
9
- config.mock_with :mocha
10
9
  config.before do
11
10
  Snippr::I18n.enabled = nil
12
11
  Snippr::Links.adjust_urls_except = nil
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.12
4
+ version: 0.15.14
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: 2013-09-18 00:00:00.000000000 Z
13
+ date: 2013-09-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -68,20 +68,6 @@ dependencies:
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  version: 2.14.0
71
- - !ruby/object:Gem::Dependency
72
- name: mocha
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - '='
76
- - !ruby/object:Gem::Version
77
- version: 0.11.4
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - '='
83
- - !ruby/object:Gem::Version
84
- version: 0.11.4
85
71
  - !ruby/object:Gem::Dependency
86
72
  name: rake
87
73
  requirement: !ruby/object:Gem::Requirement