log_book 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,4 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- db/*sqlite
18
+ test/db/*sqlite
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p286
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in log_book.gemspec
1
+ source "https://rubygems.org"
4
2
  gemspec
data/README.md CHANGED
@@ -8,9 +8,16 @@ Add this line to your application's Gemfile:
8
8
 
9
9
  gem "log_book"
10
10
 
11
+ As the Model should be loaded after ActiveReccord has established the connection you have to add this:
12
+
13
+ # config/application.rb
14
+ config.after_initialize do
15
+ require "log_book/event"
16
+ end
17
+
11
18
  ### Create the table
12
19
 
13
- rails generate guinea_pig:migration
20
+ rails generate log_book:migration
14
21
  rake db:migrate
15
22
 
16
23
  ### ActsOnTaggableOn dependency
@@ -31,7 +38,7 @@ For example:
31
38
  ## ActiveRecord integration
32
39
 
33
40
  class MyModel < ActiveRecord::Base
34
- log_book_log_book
41
+ log_book
35
42
  end
36
43
 
37
44
  MyModel.create! # => LogBook created
@@ -43,6 +50,9 @@ If you want to include _who executes the action_ use the special attribute `log_
43
50
  my_model.log_book_historian = current_user
44
51
  my_model.save!
45
52
 
53
+ ## TODO
54
+
55
+
46
56
  ## Sate of the art
47
57
 
48
58
  Beta version but already used in production environments
@@ -1,9 +1,9 @@
1
1
  require "rails/generators"
2
2
 
3
- class GuineaPig::MigrationGenerator < Rails::Generators::Base
3
+ class LogBook::MigrationGenerator < Rails::Generators::Base
4
4
  include Rails::Generators::Migration
5
5
 
6
- desc "Generates migration for ABTest model"
6
+ desc "Generates migration for LogBook::Event model"
7
7
 
8
8
  def self.source_root
9
9
  File.join(File.dirname(__FILE__), "templates")
@@ -20,6 +20,6 @@ class GuineaPig::MigrationGenerator < Rails::Generators::Base
20
20
  end
21
21
 
22
22
  def copy_migration
23
- migration_template "create_log_books.rb", "db/migrate/create_log_books.rb"
23
+ migration_template "create_log_book_events.rb", "db/migrate/create_log_book_events.rb"
24
24
  end
25
25
  end
@@ -5,13 +5,13 @@ class CreateLogBookEvents < ActiveRecord::Migration
5
5
  t.string :historian_type
6
6
  t.integer :historizable_id
7
7
  t.string :historizable_type
8
- t.string :text, :null => false
8
+ t.text :text, :null => false
9
9
 
10
10
  t.timestamps
11
11
  end
12
12
  end
13
13
 
14
14
  def self.down
15
- drop_table :log_books
15
+ drop_table :log_book_events
16
16
  end
17
17
  end
@@ -9,4 +9,6 @@ class LogBook::Event < ::ActiveRecord::Base
9
9
  belongs_to :historizable, :polymorphic => true
10
10
 
11
11
  validates :text, :presence => true
12
+
13
+ scope :by_recent, order("id desc")
12
14
  end
@@ -5,10 +5,13 @@ module LogBook::Plugin
5
5
  end
6
6
 
7
7
  module ClassMethods
8
- def log_book
8
+
9
+ def log_book(opts = {})
9
10
  after_create :log_book_event_on_create
10
11
  after_update :log_book_event_on_update
11
- after_destroy :log_book_event_on_destroy
12
+ before_destroy :log_book_event_on_destroy
13
+
14
+ has_many :log_book_events, :class_name => "LogBook::Event", :as => :historizable, :dependent => (opts[:dependent] || :nullify)
12
15
 
13
16
  attr_accessor :log_book_historian
14
17
  end
@@ -20,26 +23,15 @@ module LogBook::Plugin
20
23
  end
21
24
 
22
25
  def log_book_event_on_update
23
- LogBook.updated(self.log_book_historian, self)
26
+ LogBook.updated(self.log_book_historian, self) unless changes.empty?
24
27
  end
25
28
 
26
29
  def log_book_event_on_destroy
27
30
  LogBook.destroyed(self.log_book_historian, self)
28
31
  end
29
-
30
- def pretty_changes
31
- result =
32
- self.previous_changes.reject { |k,v| k == "updated_at" || k =~ /password/ || k == "perishable_token" || k == "persistence_token" }.map do |k,v|
33
- old_value = v[0]
34
- new_value = v[1]
35
-
36
- old_value = old_value.to_s( :localdb ) if old_value.instance_of? ActiveSupport::TimeWithZone
37
- new_value = new_value.to_s( :localdb ) if new_value.instance_of? ActiveSupport::TimeWithZone
38
-
39
- "#{k}[#{old_value} -> #{new_value}]"
40
- end.join( ", " )
41
-
42
- result
43
- end
44
32
  end
33
+ end
34
+
35
+ ActiveSupport.on_load(:active_record) do
36
+ include LogBook::Plugin
45
37
  end
@@ -0,0 +1,16 @@
1
+ module LogBook::Utils
2
+ def self.pretty_changes(model)
3
+ result =
4
+ model.changes.reject { |k,v| k == "updated_at" || k =~ /password/ || k == "perishable_token" || k == "persistence_token" }.map do |k,v|
5
+ old_value = v[0]
6
+ new_value = v[1]
7
+
8
+ old_value = old_value.to_s( :localdb ) if old_value.instance_of? ActiveSupport::TimeWithZone
9
+ new_value = new_value.to_s( :localdb ) if new_value.instance_of? ActiveSupport::TimeWithZone
10
+
11
+ "#{k}[#{old_value} -> #{new_value}]"
12
+ end.join( ", " )
13
+
14
+ result
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module LogBook
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/log_book.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "active_record"
2
+ require "active_support/core_ext/module"
3
+ require "protected_attributes"
2
4
  require "acts-as-taggable-on"
3
5
  require_relative "log_book/version"
4
- require_relative "log_book/event"
5
6
  require_relative "log_book/plugin"
6
-
7
+ require_relative "log_book/utils"
7
8
 
8
9
  module LogBook
9
10
  OPERATIONS = {
@@ -26,20 +27,20 @@ module LogBook
26
27
  )
27
28
  end
28
29
 
30
+ private
31
+
29
32
  def self.created(historian, historizable)
30
33
  LogBook.event(historian, historizable, "#{historizable.class.name} created", LogBook::OPERATIONS[:create])
31
34
  end
32
35
 
33
36
  def self.updated(historian, historizable)
34
- LogBook.event(historian, historizable, "#{historizable.class.name} updated [#{historizable.pretty_changes}]", LogBook::OPERATIONS[:update])
37
+ LogBook.event(historian, historizable, "#{historizable.class.name} updated [#{LogBook::Utils.pretty_changes(historizable)}]", LogBook::OPERATIONS[:update])
35
38
  end
36
39
 
37
40
  def self.destroyed(historian, historizable)
38
41
  LogBook.event(historian, historizable, "#{historizable.class.name} destroyed", LogBook::OPERATIONS[:destroy])
39
42
  end
40
43
 
41
- private
42
-
43
44
  def self.scope_tag(historian)
44
45
  historian.class.name.underscore
45
46
  end
@@ -49,7 +50,3 @@ module LogBook
49
50
  end
50
51
  end
51
52
 
52
- ActiveSupport.on_load(:active_record) do
53
- include LogBook::Plugin
54
- end
55
-
data/log_book.gemspec CHANGED
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "rails", "~> 3.0"
22
- spec.add_runtime_dependency "acts-as-taggable-on"
21
+ spec.add_runtime_dependency "rails", "~> 4.0.2"
22
+ spec.add_runtime_dependency "protected_attributes"
23
+ spec.add_runtime_dependency "acts-as-taggable-on", "2.4.1"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "rake"
@@ -7,25 +7,86 @@ class LogBookTest < MiniTest::Unit::TestCase
7
7
  Item.destroy_all
8
8
 
9
9
  @user = User.create!(:name => "User Name")
10
- @item = Item.create!(:title => "Item Title")
10
+ @item = Item.create!(:title => "Item Title", :log_book_historian => @user)
11
11
  end
12
12
 
13
- def test_event_on_create
14
- item = Item.new(:log_book_historian => @user)
15
- LogBook.expects(:created).with(@user, item)
13
+ def test_event
14
+ assert_difference "LogBook::Event.count", 1 do
15
+ LogBook.event(@user, @item, "Item wadus", LogBook::OPERATIONS[:create])
16
+ end
17
+
18
+ log_book = LogBook::Event.last
19
+ assert_equal(@user, log_book.historian)
20
+ assert_equal(@item, log_book.historizable)
21
+ assert_equal("Item wadus", log_book.text)
22
+ assert_equal(["user", "item", "create"].sort, log_book.tag_list.sort)
23
+ end
24
+
25
+ def test_event_with_nils
26
+ assert_difference "LogBook::Event.count", 1 do
27
+ LogBook.event(nil, nil, "Item wadus", nil)
28
+ end
29
+
30
+ log_book = LogBook::Event.last
31
+ assert_equal(nil, log_book.historian)
32
+ assert_equal(nil, log_book.historizable)
33
+ assert_equal("Item wadus", log_book.text)
34
+ assert_equal([], log_book.tag_list)
35
+ end
36
+
37
+ def test_created
38
+ item = Item.new(:title => "Item Title")
39
+ item.log_book_historian = @user
40
+
41
+ LogBook.expects(:event).with(@user, item, "Item created", LogBook::OPERATIONS[:create])
42
+
16
43
  item.save!
17
44
  end
18
45
 
19
- def test_event_on_update
20
- @item.log_book_historian = @user
21
- LogBook.expects(:updated).with(@user, @item)
22
- @item.update_attributes(:title => "Other Title")
46
+ def test_updated
47
+ LogBook.expects(:event).with(@user, @item, "Item updated [title[Item Title -> Other Title]]", LogBook::OPERATIONS[:update])
48
+
49
+ @item.update_attributes!(:title => "Other Title")
50
+ end
51
+
52
+ def test_item_destroyed
53
+ LogBook.expects(:event).with(@user, @item, "Item destroyed", LogBook::OPERATIONS[:destroy])
54
+
55
+ @item.destroy
56
+ end
57
+
58
+ def test_has_many_log_book_events
59
+ LogBook::Event.destroy_all
60
+
61
+ log_book_event_1 = LogBook.event(@user, @item, "Item wadus", LogBook::OPERATIONS[:create])
62
+ log_book_event_2 = LogBook.event(@user, @item, "Item wadus", LogBook::OPERATIONS[:update])
63
+
64
+ @item.reload
65
+
66
+ assert_equal(2, @item.log_book_events.count)
67
+ assert_equal(log_book_event_1, @item.log_book_events.first)
68
+ assert_equal(log_book_event_2, @item.log_book_events.last)
23
69
  end
24
70
 
25
- def test_event_on_destroy
26
- @item.log_book_historian = @user
27
- LogBook.expects(:destroyed).with(@user, @item)
71
+ def test_log_book_events_nullify_on_historizable_destroy
72
+ log_book_event = LogBook.event(@user, @item, "Item wadus", LogBook::OPERATIONS[:create])
73
+
28
74
  @item.destroy
75
+
76
+ log_book_event.reload
77
+
78
+ assert_equal(true, log_book_event.historizable_id.nil?)
79
+ assert_equal(true, log_book_event.historizable.nil?)
80
+ assert_equal("Item", log_book_event.historizable_type)
81
+ end
82
+
83
+ def test_log_book_events_destroy_on_historizable_destroy
84
+ item_with_opts = ItemWithOpts.new
85
+ log_book_event = LogBook.event(@user, item_with_opts, "Item wadus", LogBook::OPERATIONS[:create])
86
+
87
+ item_with_opts.destroy
88
+
89
+ assert_equal(false, LogBook::Event.exists?(log_book_event.id))
29
90
  end
30
91
  end
31
92
 
data/test/models.rb CHANGED
@@ -3,4 +3,8 @@ end
3
3
 
4
4
  class Item < ActiveRecord::Base
5
5
  log_book
6
+ end
7
+
8
+ class ItemWithOpts < Item
9
+ log_book(:dependent => :destroy)
6
10
  end
@@ -0,0 +1,31 @@
1
+ require_relative "test_helper"
2
+
3
+ class PluginTest < MiniTest::Unit::TestCase
4
+ def setup
5
+ LogBook::Event.destroy_all
6
+ User.destroy_all
7
+ Item.destroy_all
8
+
9
+ @user = User.create!(:name => "User Name")
10
+ @item = Item.create!(:title => "Item Title")
11
+ end
12
+
13
+ def test_event_on_create
14
+ item = Item.new(:log_book_historian => @user)
15
+ LogBook.expects(:created).with(@user, item)
16
+ item.save!
17
+ end
18
+
19
+ def test_event_on_update
20
+ @item.log_book_historian = @user
21
+ LogBook.expects(:updated).with(@user, @item)
22
+ @item.update_attributes(:title => "Other Title")
23
+ end
24
+
25
+ def test_event_on_destroy
26
+ @item.log_book_historian = @user
27
+ LogBook.expects(:destroyed).with(@user, @item)
28
+ @item.destroy
29
+ end
30
+ end
31
+
data/test/test_helper.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require "minitest/unit"
2
2
  require "minitest/autorun"
3
3
  require "mocha/setup"
4
- require "assert_difference"
5
4
  require "active_record"
5
+ require "active_support/core_ext/module"
6
+ require "assert_difference"
6
7
  require "acts-as-taggable-on"
8
+ require_relative "../lib/log_book"
7
9
 
8
10
  FileUtils.rm("#{File.dirname(__FILE__)}/db/log_book.sqlite", :force => true)
9
11
 
@@ -12,11 +14,11 @@ ActiveRecord::Base.establish_connection(
12
14
  :database => "#{File.dirname(__FILE__)}/db/log_book.sqlite"
13
15
  )
14
16
 
17
+ require_relative "../lib/log_book/event"
18
+
15
19
  require_relative "../lib/generators/log_book/templates/create_log_book_events"
16
20
  CreateLogBookEvents.up
17
21
 
18
- require_relative "../lib/log_book"
19
-
20
22
  load("#{File.dirname(__FILE__)}/schema.rb")
21
23
  load("#{File.dirname(__FILE__)}/models.rb")
22
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-11 00:00:00.000000000 Z
12
+ date: 2013-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70266156350280 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '3.0'
21
+ version: 4.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70266156350280
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 4.0.2
25
30
  - !ruby/object:Gem::Dependency
26
- name: acts-as-taggable-on
27
- requirement: &70266156349820 !ruby/object:Gem::Requirement
31
+ name: protected_attributes
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,31 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70266156349820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: acts-as-taggable-on
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 2.4.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.4.1
36
62
  - !ruby/object:Gem::Dependency
37
63
  name: bundler
38
- requirement: &70266156349260 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
39
65
  none: false
40
66
  requirements:
41
67
  - - ~>
@@ -43,10 +69,15 @@ dependencies:
43
69
  version: '1.3'
44
70
  type: :development
45
71
  prerelease: false
46
- version_requirements: *70266156349260
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.3'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: rake
49
- requirement: &70266156348840 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,10 +85,15 @@ dependencies:
54
85
  version: '0'
55
86
  type: :development
56
87
  prerelease: false
57
- version_requirements: *70266156348840
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: mocha
60
- requirement: &70266156348380 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
99
  - - ! '>='
@@ -65,10 +101,15 @@ dependencies:
65
101
  version: '0'
66
102
  type: :development
67
103
  prerelease: false
68
- version_requirements: *70266156348380
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
69
110
  - !ruby/object:Gem::Dependency
70
111
  name: sqlite3
71
- requirement: &70266156347940 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
72
113
  none: false
73
114
  requirements:
74
115
  - - ! '>='
@@ -76,10 +117,15 @@ dependencies:
76
117
  version: '0'
77
118
  type: :development
78
119
  prerelease: false
79
- version_requirements: *70266156347940
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
80
126
  - !ruby/object:Gem::Dependency
81
127
  name: assert_difference
82
- requirement: &70266156347520 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
83
129
  none: false
84
130
  requirements:
85
131
  - - ! '>='
@@ -87,7 +133,12 @@ dependencies:
87
133
  version: '0'
88
134
  type: :development
89
135
  prerelease: false
90
- version_requirements: *70266156347520
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
91
142
  description: Storing an events log book
92
143
  email:
93
144
  - fguillen.mail@gmail.com
@@ -96,8 +147,7 @@ extensions: []
96
147
  extra_rdoc_files: []
97
148
  files:
98
149
  - .gitignore
99
- - .rvmrc
100
- - .rvmrc.example
150
+ - .ruby-version
101
151
  - Gemfile
102
152
  - LICENSE.txt
103
153
  - README.md
@@ -107,13 +157,13 @@ files:
107
157
  - lib/log_book.rb
108
158
  - lib/log_book/event.rb
109
159
  - lib/log_book/plugin.rb
160
+ - lib/log_book/utils.rb
110
161
  - lib/log_book/version.rb
111
162
  - log_book.gemspec
112
163
  - test/db/.keep
113
- - test/db/log_book.sqlite
114
- - test/history_event_test.rb
115
164
  - test/log_book_test.rb
116
165
  - test/models.rb
166
+ - test/plugin_test.rb
117
167
  - test/schema.rb
118
168
  - test/test_helper.rb
119
169
  homepage: https://github.com/fguillen/LogBook
@@ -137,15 +187,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
187
  version: '0'
138
188
  requirements: []
139
189
  rubyforge_project:
140
- rubygems_version: 1.8.15
190
+ rubygems_version: 1.8.23
141
191
  signing_key:
142
192
  specification_version: 3
143
193
  summary: Storing an events log book
144
194
  test_files:
145
195
  - test/db/.keep
146
- - test/db/log_book.sqlite
147
- - test/history_event_test.rb
148
196
  - test/log_book_test.rb
149
197
  - test/models.rb
198
+ - test/plugin_test.rb
150
199
  - test/schema.rb
151
200
  - test/test_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create 1.9.3-p286@log_book
data/.rvmrc.example DELETED
@@ -1 +0,0 @@
1
- rvm use --create 1.9.3-p286@log_book
Binary file
@@ -1,54 +0,0 @@
1
- require_relative "test_helper"
2
-
3
- class LogBookTest < MiniTest::Unit::TestCase
4
- def setup
5
- LogBook::Event.destroy_all
6
- User.destroy_all
7
- Item.destroy_all
8
-
9
- @user = User.create!(:name => "User Name")
10
- @item = Item.create!(:title => "Item Title")
11
- end
12
-
13
- def test_event
14
- assert_difference "LogBook::Event.count", 1 do
15
- LogBook.event(@user, @item, "Item wadus", LogBook::OPERATIONS[:create])
16
- end
17
-
18
- log_book = LogBook::Event.last
19
- assert_equal(@user, log_book.historian)
20
- assert_equal(@item, log_book.historizable)
21
- assert_equal("Item wadus", log_book.text)
22
- assert_equal(["user", "item", "create"].sort, log_book.tag_list.sort)
23
- end
24
-
25
- def test_event_with_nils
26
- assert_difference "LogBook::Event.count", 1 do
27
- LogBook.event(nil, nil, "Item wadus", nil)
28
- end
29
-
30
- log_book = LogBook::Event.last
31
- assert_equal(nil, log_book.historian)
32
- assert_equal(nil, log_book.historizable)
33
- assert_equal("Item wadus", log_book.text)
34
- assert_equal([], log_book.tag_list)
35
- end
36
-
37
- def test_created
38
- LogBook.expects(:event).with("historian", @item, "Item created", LogBook::OPERATIONS[:create])
39
- LogBook.created("historian", @item)
40
- end
41
-
42
- def test_updated
43
- @item.update_attributes!(:title => "Other Title")
44
-
45
- LogBook.expects(:event).with(@user, @item, "Item updated [title[Item Title -> Other Title]]", LogBook::OPERATIONS[:update])
46
- LogBook.updated(@user, @item)
47
- end
48
-
49
- def test_item_destroyed
50
- LogBook.expects(:event).with(@user, @item, "Item destroyed", LogBook::OPERATIONS[:destroy])
51
- LogBook.destroyed(@user, @item)
52
- end
53
- end
54
-