has_moderated 1.0.beta2 → 1.0.rc1

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.
@@ -482,7 +482,7 @@ describe Task do
482
482
  #
483
483
 
484
484
  context "common features:" do
485
- before do
485
+ it "get_moderation_attributes can be overriden in model" do
486
486
  Object.send(:remove_const, 'Task')
487
487
  load 'task.rb'
488
488
  Object.send(:remove_const, 'Subtask')
@@ -493,8 +493,6 @@ describe Task do
493
493
  { :test => "ok" }
494
494
  end
495
495
  end
496
- end
497
- it "get_moderation_attributes can be overriden in model" do
498
496
  Task.create! :title => "Task 1"
499
497
  data = YAML::load(Moderation.last.data)[:create][:attributes]
500
498
  data.should_not be_blank
@@ -502,6 +500,35 @@ describe Task do
502
500
  data[:test].should eq("ok")
503
501
  data.keys.count.should eq(1)
504
502
  end
503
+
504
+ it "knows if it's a create moderation" do
505
+ Object.send(:remove_const, 'Task')
506
+ load 'task.rb'
507
+ Object.send(:remove_const, 'Subtask')
508
+ load 'subtask.rb'
509
+ Task.has_moderated_create
510
+
511
+ Task.create! :title => "Task 1"
512
+
513
+ Moderation.last.create?.should be_true
514
+ Moderation.last.destroy?.should be_false
515
+ Moderation.last.update?.should be_false
516
+ end
517
+
518
+ it "knows if it's a destroy moderation" do
519
+ Object.send(:remove_const, 'Task')
520
+ load 'task.rb'
521
+ Object.send(:remove_const, 'Subtask')
522
+ load 'subtask.rb'
523
+ Task.has_moderated_destroy
524
+
525
+ Task.create! :title => "Task 1"
526
+ Task.last.destroy
527
+
528
+ Moderation.last.destroy?.should be_true
529
+ Moderation.last.create?.should be_false
530
+ Moderation.last.update?.should be_false
531
+ end
505
532
  end
506
533
 
507
534
  context "hooks:" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_moderated
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196295
4
+ hash: 15424247
5
5
  prerelease: 4
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - beta
10
- - 2
11
- version: 1.0.beta2
9
+ - rc
10
+ - 1
11
+ version: 1.0.rc1
12
12
  platform: ruby
13
13
  authors:
14
14
  - Jan Berdajs