Sumit Srivastava
2013-Jul-17 12:40 UTC
Duplicating an instance which is a duplicate of another
Hi, Following is the code, shared_context "of cloning" do>let(:cloned_record) {donor.dup}> let(:second_cloned_record) {donor.dup} > * let(:clone_of_cloned) {cloned_record.dup}* > > it "returns new record" do > cloned_record.should be_new_record > end > > it "saves returned record properly" do > cloned_record.should be_valid > end > > it "returns record that could be successfully saved" do > cloned_record.save.should be_true > end > end > >The line is bold/red is the one which is I have doubt about. When I try to use clone_of_cloned.name in any other function, it doesn''t responds. The code gets stuck there. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d10fa0d8-cafe-4e86-aebc-f7015fc78267%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Tamara Temple
2013-Jul-17 15:04 UTC
Re: Duplicating an instance which is a duplicate of another
On Jul 17, 2013, at 5:40 AM, Sumit Srivastava <sumit.theinvincible-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Following is the code, > > shared_context "of cloning" do > let(:cloned_record) {donor.dup} > let(:second_cloned_record) {donor.dup} > let(:clone_of_cloned) {cloned_record.dup} > > it "returns new record" do > cloned_record.should be_new_record > end > > it "saves returned record properly" do > cloned_record.should be_valid > end > > it "returns record that could be successfully saved" do > cloned_record.save.should be_true > end > end > > > The line is bold/red is the one which is I have doubt about. > When I try to use clone_of_cloned.name in any other function, it doesn''t responds. The code gets stuck there.What exactly is the behavior "gets stuck" ? And what do you mean by "It doesn''t responds" ?Please include output and error messages. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7B4AE662-B769-47BB-933E-C607E630B0E9%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.