nay-record_with_operator 0.0.10 → 0.0.11
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.
- data/Rakefile +1 -1
- data/lib/association_with_operator.rb +1 -1
- data/test/record_with_operator_test.rb +32 -2
- metadata +1 -1
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ DESCRIPTION = "Rails plugin to set created_by, updated_by, deleted_by to ActiveR
|
|
12
12
|
GITHUB_PROJECT = "record_with_operator"
|
13
13
|
HOMEPAGE = "http://github.com/nay/#{GITHUB_PROJECT}/tree"
|
14
14
|
BIN_FILES = %w( )
|
15
|
-
VER = "0.0.
|
15
|
+
VER = "0.0.11"
|
16
16
|
CLEAN.include ['pkg']
|
17
17
|
|
18
18
|
desc 'Default: run unit tests.'
|
@@ -205,17 +205,47 @@ class RecordWithOperatorTest < ActiveSupport::TestCase
|
|
205
205
|
assert note.memos.find_all_by_body("memo").all?{|m| m.operator == @user2}
|
206
206
|
end
|
207
207
|
|
208
|
-
|
209
208
|
def test_found_memo_through_named_scope_should_have_operator
|
210
209
|
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
211
210
|
note.memos.create!(:body => "memo")
|
212
211
|
assert_equal @user2, note.memos.new_arrivals.first.operator
|
213
212
|
end
|
214
213
|
|
215
|
-
|
216
214
|
def test_dynamically_found_memo_through_named_scope_should_have_operator
|
217
215
|
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
218
216
|
note.memos.create!(:body => "memo")
|
219
217
|
assert_equal @user2, note.memos.new_arrivals.find_by_body("memo").operator
|
220
218
|
end
|
219
|
+
|
220
|
+
def test_auto_found_memo_first_should_be_nil_if_note_has_no_memo
|
221
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
222
|
+
assert_equal nil, note.memos.first
|
223
|
+
assert_equal nil, note.memos(true).first
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_auto_found_memo_last_should_be_nil_if_note_has_no_memo
|
227
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
228
|
+
assert_equal nil, note.memos.last
|
229
|
+
assert_equal nil, note.memos(true).last
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_manualy_found_memo_first_should_be_nil_if_note_has_no_memo
|
233
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
234
|
+
assert_equal nil, note.memos.find(:first)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_manualy_found_memo_last_should_be_nil_if_note_has_no_memo
|
238
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
239
|
+
assert_equal nil, note.memos.find(:last)
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_dynamically_found_memos_first_should_be_nil_if_note_has_no_memo
|
243
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
244
|
+
assert_equal nil, note.memos.find_all_by_body("memo").first
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_found_memo_through_named_scope_last_should_be_nil_if_note_has_no_memo
|
248
|
+
note = NoteWithUser.find(@note_created_by_user1.id, :for => @user2)
|
249
|
+
assert_equal nil, note.memos.new_arrivals.last
|
250
|
+
end
|
221
251
|
end
|