@@ -117,10 +117,10 @@ end
117117
118118describe " Avram::SaveOperation" do
119119 it " calls the default validations after the before_save" do
120- UserWithDefaultValidations .create(name: " TestName" , nickname: " TestNickname" , joined_at: Time .utc, age: 400 ) do |op , u |
121- op .starts_nil.should eq(" not nil!" )
122- u .should_not be_nil
123- u .as(User ).nickname.should eq(" TestNickname" )
120+ UserWithDefaultValidations .create(name: " TestName" , nickname: " TestNickname" , joined_at: Time .utc, age: 400 ) do |operation , user |
121+ operation .starts_nil.should eq(" not nil!" )
122+ user .should_not be_nil
123+ user .as(User ).nickname.should eq(" TestNickname" )
124124 end
125125 end
126126
@@ -241,8 +241,8 @@ describe "Avram::SaveOperation" do
241241 it " updates the record using the same default value" do
242242 TokenFactory .create(& .name(" special" ).scopes([" name" ]).next_id(4 ))
243243
244- UpsertToken .upsert(next_id: 4 , name: " Secret" , scopes: [" red" , " blue" ]) do |op , token |
245- op .valid?.should eq(true )
244+ UpsertToken .upsert(next_id: 4 , name: " Secret" , scopes: [" red" , " blue" ]) do |operation , token |
245+ operation .valid?.should eq(true )
246246 token.should_not eq(nil )
247247 token.as(Token ).name.should eq(" Secret" )
248248 token.as(Token ).scopes.should eq([" red" , " blue" ])
@@ -542,9 +542,9 @@ describe "Avram::SaveOperation" do
542542 it " has inherited attributes" do
543543 user = UserFactory .create & .nickname(" taco shop" )
544544
545- RenameUser .update(user, should_not_override_permitted_columns: " yo" ) do |op , u |
546- u .nickname.should eq(" The 'taco shop'" )
547- op .should_not_override_permitted_columns.value.should eq(" yo" )
545+ RenameUser .update(user, should_not_override_permitted_columns: " yo" ) do |operation , updated_user |
546+ updated_user .nickname.should eq(" The 'taco shop'" )
547+ operation .should_not_override_permitted_columns.value.should eq(" yo" )
548548 end
549549 end
550550 end
@@ -684,8 +684,8 @@ describe "Avram::SaveOperation" do
684684
685685 context " with bytes" do
686686 it " saves the byte column" do
687- Beat ::SaveOperation .create(hash: " boots and pants" .to_slice) do |op , beat |
688- op .saved?.should eq(true )
687+ Beat ::SaveOperation .create(hash: " boots and pants" .to_slice) do |operation , beat |
688+ operation .saved?.should eq(true )
689689 beat.should_not be_nil
690690 beat.as(Beat ).hash.blank?.should eq(false )
691691 beat.as(Beat ).hash.should eq(Bytes [98 , 111 , 111 , 116 , 115 , 32 , 97 , 110 , 100 , 32 , 112 , 97 , 110 , 116 , 115 ])
@@ -698,8 +698,8 @@ describe "Avram::SaveOperation" do
698698 it " creates the JSON value from params" do
699699 params = build_params(%( {"blob": {"doc": {"sort": "desc"}, "metadata": {"name": "filter", "code": 4}}}) , content_type: " application/json" )
700700
701- ReturnOfTheBlob .create(params) do |op , blob |
702- op .valid?.should eq(true )
701+ ReturnOfTheBlob .create(params) do |operation , blob |
702+ operation .valid?.should eq(true )
703703 blob.should_not eq(nil )
704704 blob.as(Blob ).doc.as(JSON ::Any )[" sort" ].as_s.should eq(" desc" )
705705 blob.as(Blob ).metadata.name.should eq(" filter" )
@@ -853,8 +853,8 @@ describe "Avram::SaveOperation" do
853853 slime = BlobFactory .new.doc(JSON ::Any .new({" sort" => JSON ::Any .new(" desc" )})).create
854854 params = build_params(%( {"blob": {"doc": {"sort": "asc"}}}) , content_type: " application/json" )
855855
856- ReturnOfTheBlob .update(slime, params) do |op , blob |
857- op .valid?.should eq(true )
856+ ReturnOfTheBlob .update(slime, params) do |operation , blob |
857+ operation .valid?.should eq(true )
858858 blob.should_not eq(nil )
859859 blob.as(Blob ).doc.as(JSON ::Any )[" sort" ].as_s.should eq(" asc" )
860860 end
@@ -984,25 +984,25 @@ describe "Avram::SaveOperation" do
984984 describe " skip_default_validations" do
985985 it " allows blank strings to be saved" do
986986 post = PostFactory .create
987- AllowBlankComment .create(post_id: post.id, body: " " ) do |op , new_comment |
988- op .valid?.should be_true
987+ AllowBlankComment .create(post_id: post.id, body: " " ) do |operation , new_comment |
988+ operation .valid?.should be_true
989989 comment = new_comment.as(Comment )
990990 comment.body.should eq(" " )
991991 end
992992 end
993993 it " allows blank strings from params" do
994994 post = PostFactory .create
995995 params = build_params({comment: {post_id: post.id, body: " " }}.to_json, content_type: " application/json" )
996- AllowBlankComment .create(params) do |op , new_comment |
997- op .valid?.should be_true
996+ AllowBlankComment .create(params) do |operation , new_comment |
997+ operation .valid?.should be_true
998998 comment = new_comment.as(Comment )
999999 comment.body.should eq(" " )
10001000 end
10011001 end
10021002 it " still allows normal data to be saved" do
10031003 post = PostFactory .create
1004- AllowBlankComment .create(post_id: post.id, body: " not blank" ) do |op , new_comment |
1005- op .valid?.should be_true
1004+ AllowBlankComment .create(post_id: post.id, body: " not blank" ) do |operation , new_comment |
1005+ operation .valid?.should be_true
10061006 comment = new_comment.as(Comment )
10071007 comment.body.should eq(" not blank" )
10081008 end
@@ -1027,9 +1027,9 @@ describe "Avram::SaveOperation" do
10271027 describe " #database" do
10281028 it " has access to the database via a helper method" do
10291029 post = PostFactory .create
1030- AllowBlankComment .create(post_id: post.id, body: " " ) do |op , _new_comment |
1030+ AllowBlankComment .create(post_id: post.id, body: " " ) do |operation , _new_comment |
10311031 expect_raises(Avram ::Rollback ) do
1032- op .database.rollback
1032+ operation .database.rollback
10331033 end
10341034 end
10351035 end
0 commit comments