pulitzer 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/interactions/pulitzer/update_post_type_content_elements.rb +12 -7
- data/lib/pulitzer/exceptions.rb +3 -2
- data/lib/pulitzer/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +1728 -0
- data/spec/interactions/update_post_type_content_elements_spec.rb +32 -0
- metadata +4 -2
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe Pulitzer::UpdatePostTypeContentElements do
|
4
|
+
let(:version) { create(:version, :with_content_elements) }
|
5
|
+
let(:post) { version.post }
|
6
|
+
let(:post_type) { post.post_type }
|
7
|
+
let(:content_element_type) {create :content_element_type, :text}
|
8
|
+
let(:ptcet) { post_type.post_type_content_element_types.create(content_element_type_id: content_element_type.id, label: 'A New Field for this Post Type')}
|
9
|
+
|
10
|
+
describe "#call" do
|
11
|
+
|
12
|
+
it "updates a content element in a preview version" do
|
13
|
+
ptcet
|
14
|
+
Pulitzer::CreatePostContentElements.new(post).call
|
15
|
+
preview = post.preview_version
|
16
|
+
expect(preview.content_elements.map(&:post_type_content_element_type_id)).to include(ptcet.id)
|
17
|
+
ptcet.update label: 'A changed label'
|
18
|
+
Pulitzer::UpdatePostTypeContentElements.new(ptcet, 'A New Field for this Post Type').call
|
19
|
+
content_element = preview.reload.content_elements.detect{|ce| ce.post_type_content_element_type_id == ptcet.id}
|
20
|
+
expect(content_element.label).to eq('A changed label')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "doesn't blow up if a post has no preview version" do
|
24
|
+
version.update_columns status: 'archived'
|
25
|
+
post.preview_version.destroy
|
26
|
+
expect(post.reload.preview_version).to be_nil
|
27
|
+
# There is no preview version for the post, but we don't blow up
|
28
|
+
Pulitzer::UpdatePostTypeContentElements.new(ptcet).call
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pulitzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Draut
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -995,6 +995,7 @@ files:
|
|
995
995
|
- spec/interactions/clone_version_spec.rb
|
996
996
|
- spec/interactions/create_partial_content_elements_spec.rb
|
997
997
|
- spec/interactions/create_post_content_elements_spec.rb
|
998
|
+
- spec/interactions/update_post_type_content_elements_spec.rb
|
998
999
|
- spec/interactions/update_version_status_spec.rb
|
999
1000
|
- spec/lib/pulitzer_spec.rb
|
1000
1001
|
- spec/models/content_element_spec.rb
|
@@ -1384,6 +1385,7 @@ test_files:
|
|
1384
1385
|
- spec/interactions/clone_version_spec.rb
|
1385
1386
|
- spec/interactions/create_partial_content_elements_spec.rb
|
1386
1387
|
- spec/interactions/create_post_content_elements_spec.rb
|
1388
|
+
- spec/interactions/update_post_type_content_elements_spec.rb
|
1387
1389
|
- spec/interactions/update_version_status_spec.rb
|
1388
1390
|
- spec/lib/pulitzer_spec.rb
|
1389
1391
|
- spec/models/content_element_spec.rb
|