has_moderated 1.0.rc6 → 1.0.rc7

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.
@@ -702,6 +702,42 @@ describe Task do
702
702
  preview.title_change.should eq([nil, "Task 1"])
703
703
  end
704
704
 
705
+ it "supports updating moderation attributes for the saved preview if :saveable => true" do
706
+ reload_models.task {
707
+ has_moderated :title
708
+ }
709
+
710
+ task = Task.create! :title => "Task 1"
711
+ Task.last.title.should be_blank
712
+
713
+ preview = Moderation.last.preview(:saveable => true)
714
+ preview.title = "Task 2"
715
+ preview.update_moderation
716
+
717
+ moderation = Moderation.last
718
+ moderation.parsed_data.should eq({:attributes=>{"title"=>"Task 2"}})
719
+ moderation.accept
720
+ Task.last.title.should eq("Task 2")
721
+ end
722
+
723
+ it "doesn't support updating moderation attributes for the saved preview by default" do
724
+ reload_models.task {
725
+ has_moderated :title
726
+ }
727
+
728
+ task = Task.create! :title => "Task 1"
729
+ Task.last.title.should be_blank
730
+
731
+ moderation = Moderation.last
732
+ preview = Moderation.last.preview
733
+ expect { preview.title = "Task 2" }.should raise_error
734
+ expect { preview.update_moderation }.should raise_error
735
+
736
+ moderation = Moderation.last
737
+ moderation.accept
738
+ Task.last.title.should eq("Task 1")
739
+ end
740
+
705
741
  it "shows a saved preview of has_many association" do
706
742
  reload_models.task {
707
743
  has_many :renamed_subtasks, :class_name => subtask_class_name, :foreign_key => task_fk
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_moderated
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.rc6
4
+ version: 1.0.rc7
5
5
  prerelease: 4
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: 2012-06-08 00:00:00.000000000 Z
12
+ date: 2012-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -246,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  segments:
248
248
  - 0
249
- hash: 4469767930279487632
249
+ hash: -4264554985869593078
250
250
  required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  none: false
252
252
  requirements: