remote_partial 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,6 +92,20 @@ module RemotePartial
92
92
  assert_equal(expected, Partial.find(@partial.name).stale_at)
93
93
  end
94
94
 
95
+ def test_builder_with_output_modifier
96
+ output_modifier = '{|t| "Hello"}'
97
+ name = 'partial_with_mod'
98
+ assert_difference 'RemotePartial::Partial.count' do
99
+ Builder.build(
100
+ url: @partial.url,
101
+ name: 'partial_with_mod',
102
+ output_modifier: output_modifier
103
+ )
104
+ end
105
+ partial = Partial.find(name)
106
+ assert_equal(output_modifier, partial.output_modifier)
107
+ end
108
+
95
109
  def assert_expected_file_created(&test)
96
110
  remove_file expected_output_file_name
97
111
  test.call
@@ -28,7 +28,14 @@ module RemotePartial
28
28
  assert_output_file_updated(@first_p) do
29
29
  @partial.update_file
30
30
  end
31
+ end
31
32
 
33
+ def test_update_file_with_output_modifier
34
+ @partial.output_modifier = '{|text| text.gsub(/One/, "Two")}'
35
+ expected = '<p>Two</p>'
36
+ assert_output_file_updated(expected) do
37
+ @partial.update_file
38
+ end
32
39
  end
33
40
 
34
41
  def test_update_stale_at
@@ -42,6 +42,12 @@ module RemotePartial
42
42
  assert_equal_ignoring_cr expected, resource_manager.html
43
43
  end
44
44
 
45
+ def test_html_with_proc_mod
46
+ expected = '<p>One</p><p>Two</p>'
47
+ resource_manager = ResourceManager.new(@url, 'p') {|text| text.gsub(/Bar/, 'Two')}
48
+ assert_equal_ignoring_cr expected, resource_manager.html
49
+ end
50
+
45
51
  def test_output_to
46
52
  test_html_with_limit
47
53
  @resource_manager.output_to(@path)
@@ -93,6 +93,16 @@ module RemotePartial
93
93
  assert_equal @content, yaml_store.content
94
94
  end
95
95
 
96
+ def test_all
97
+ yaml_store = YamlStore.create(name: 'Foo', colour:'Red')
98
+ yaml_store_2 = YamlStore.create(name: 'Bar', colour:'Red')
99
+ assert_equal([yaml_store, yaml_store_2], YamlStore.all)
100
+ end
101
+
102
+ def test_all_with_no_items
103
+ assert_equal([], YamlStore.all)
104
+ end
105
+
96
106
  def test_count
97
107
  assert_equal 0, YamlStore.count
98
108
  test_create
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.3.2
4
+ version: 0.4.0
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-15 00:00:00.000000000 Z
12
+ date: 2013-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -93,6 +93,7 @@ files:
93
93
  - test/dummy/app/views/demos/_ruby.html.erb
94
94
  - test/dummy/app/views/layouts/application.html.erb
95
95
  - test/dummy/app/views/remote_partials/_clock.html.erb
96
+ - test/dummy/app/views/remote_partials/_partial_with_mod.html.erb
96
97
  - test/dummy/app/views/remote_partials/_fixed.html.erb
97
98
  - test/dummy/app/views/remote_partials/_ruby.html.erb
98
99
  - test/dummy/app/controllers/application_controller.rb
@@ -182,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  version: '0'
183
184
  requirements: []
184
185
  rubyforge_project:
185
- rubygems_version: 1.8.24
186
+ rubygems_version: 1.8.25
186
187
  signing_key:
187
188
  specification_version: 3
188
189
  summary: RemotePartial adds the facility to grab content from remote sites and add
@@ -198,6 +199,7 @@ test_files:
198
199
  - test/dummy/app/views/demos/_ruby.html.erb
199
200
  - test/dummy/app/views/layouts/application.html.erb
200
201
  - test/dummy/app/views/remote_partials/_clock.html.erb
202
+ - test/dummy/app/views/remote_partials/_partial_with_mod.html.erb
201
203
  - test/dummy/app/views/remote_partials/_fixed.html.erb
202
204
  - test/dummy/app/views/remote_partials/_ruby.html.erb
203
205
  - test/dummy/app/controllers/application_controller.rb