remote_partial 0.2.0 → 0.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.
@@ -5,9 +5,16 @@ class DemosHelperTest < ActionView::TestCase
5
5
  include RemotePartial::HostAppHelper
6
6
 
7
7
  def test_render_remote_partial_with_no_partial
8
- assert_raise ActionView::MissingTemplate do
9
- render_remote_partial 'non-existent-partial'
8
+ if Rails.version.to_i == 4
9
+ assert_raise ArgumentError do
10
+ render_remote_partial 'non-existent-partial'
11
+ end
12
+ else
13
+ assert_raise ActionView::MissingTemplate do
14
+ render_remote_partial 'non-existent-partial'
15
+ end
10
16
  end
17
+
11
18
  end
12
19
 
13
20
  end
data/test/test_helper.rb CHANGED
@@ -3,6 +3,8 @@ ENV["RAILS_ENV"] = "test"
3
3
 
4
4
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
5
  require "rails/test_help"
6
+ require 'webmock'
7
+ require 'webmock/minitest'
6
8
  require 'webmock/test_unit'
7
9
 
8
10
  Rails.backtrace_cleaner.remove_silencers!
@@ -19,28 +21,21 @@ class ActiveSupport::TestCase
19
21
  fixtures :all
20
22
 
21
23
  def enable_mock(url, body = '<body><h1>Something</h1><p>Else</p></body>')
22
- WebMock.enable!
23
24
  stub_request(:get, url).
24
25
  with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
25
26
  to_return(:status => 200, :body => body, :headers => {})
26
27
  end
27
28
 
28
29
  def enable_mock_connection_failure(url, status = 400)
29
- WebMock.enable!
30
30
  stub_request(:get, url).
31
31
  with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
32
32
  to_return(:status => status, :body => 'Whoops!', :headers => {})
33
33
  end
34
34
 
35
35
  def enable_mock_connection_error(url)
36
- WebMock.enable!
37
36
  stub_request(:get, url).to_raise(SocketError.new("Some connection error"))
38
37
  end
39
38
 
40
- def disable_mock
41
- WebMock.disable!
42
- end
43
-
44
39
  def assert_equal_ignoring_cr(expected, testing, comment = nil)
45
40
  cr = "\n"
46
41
  assert_equal(expected, testing.gsub(cr, ""), comment)
@@ -11,10 +11,6 @@ module RemotePartial
11
11
  new_builder
12
12
  end
13
13
 
14
- def teardown
15
- disable_mock
16
- end
17
-
18
14
  def test_create_or_update_partial
19
15
  assert_difference 'RemotePartial::Partial.count' do
20
16
  @builder.create_or_update_partial
@@ -10,10 +10,6 @@ module RemotePartial
10
10
  enable_mock(@partial.url, @body)
11
11
  end
12
12
 
13
- def teardown
14
- disable_mock
15
- end
16
-
17
13
  def test_output_file_name
18
14
  expected = "#{RemotePartial.partial_location}/_#{@partial.name}.html.erb"
19
15
  assert_equal expected, @partial.output_file_name
@@ -13,10 +13,6 @@ module RemotePartial
13
13
  File.delete(@path) if File.exists?(@path)
14
14
  end
15
15
 
16
- def teardown
17
- disable_mock
18
- end
19
-
20
16
  def test_stub
21
17
  assert_equal_ignoring_cr(@body, content.search('body').to_s)
22
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_partial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-05 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,22 +59,6 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: webmock
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
62
  description: ! "RemotePartial comprises:\n a system to grab content from a remote
79
63
  page and copy that content into partials;\n a process to allow content to be regularly
80
64
  updated;\n a helper method to ease inclusion of the partial with a view\"\n"
@@ -110,7 +94,6 @@ files:
110
94
  - test/dummy/app/views/demos/_ruby.html.erb
111
95
  - test/dummy/app/views/layouts/application.html.erb
112
96
  - test/dummy/app/views/remote_partials/_clock.html.erb
113
- - test/dummy/app/views/remote_partials/_wcc.html.erb
114
97
  - test/dummy/app/views/remote_partials/_fixed.html.erb
115
98
  - test/dummy/app/views/remote_partials/_ruby.html.erb
116
99
  - test/dummy/app/controllers/application_controller.rb
@@ -217,7 +200,6 @@ test_files:
217
200
  - test/dummy/app/views/demos/_ruby.html.erb
218
201
  - test/dummy/app/views/layouts/application.html.erb
219
202
  - test/dummy/app/views/remote_partials/_clock.html.erb
220
- - test/dummy/app/views/remote_partials/_wcc.html.erb
221
203
  - test/dummy/app/views/remote_partials/_fixed.html.erb
222
204
  - test/dummy/app/views/remote_partials/_ruby.html.erb
223
205
  - test/dummy/app/controllers/application_controller.rb