ruby on rails - rspec controller test fails with argument error in model -
I have this problem, I am testing my controller POST method and I get this error:
logic error: I have a form that has been sent and called after the callback in another way which is called another method where there is constant passage goes. But the method called validity which fails on continuous.
Here is the snippet of code: after_save: maintain_sender_attr def maintain_sender_attr self.affiliate_receivers.each do | Count | Until count.email == "" send_email (count.email) end end end def send_email (to) @resource_invite = invite: NewInvite.new (auto, from, CONTENT_TYPE_INVITE) @ source_invite.body_html = ready (@ resource_invate. Insight Body_html) @ source_invite.send End Def Ready body_html context_objects.each {| Key, value | Body_html.gsub! "[# {Key}}", value} body_html and here is static: NOTIFICATION_CONTENT_TYPES = [CONTENT_TYPE_INVITE = 'referral_inweight'] And here's where the error is:
Invite class Array :: Base attr_accessor: missing_fields ,: body_html, Invite, Owner, # Start For new sender example # @ notifications [notification, string] notification or type of notification content, to file proprietary, invite @owner = owner @to = if invite.is_a? Invite Invite @invite = Invite @invate = Invite.Find_ (content_type: invite) Finally end load_body_html_template Increase confirmation of def defame ArgumentError, "missing owner relationship" if @home.nil? Trouble logic error, "missing invitation link" if @ invite.nil? Trouble logic Err, "relation to missing" if @to.nil? RaiseImplementedError increased, "Not the answer to the #locale method," unless that answer? : Local end The test itself is ultimately:
Describe "with valid attributes" "This creates a new sender and there is an associated receiver" {Post}: Make, node_id: @ node.id, locale: @ node.locale, affiliate_senderer: FactoryGreat forDates (: affiliate_sender ,: affiliate_receivers_attributes => {"0" => {" Email "= & gt;" test @ test com "}}), format :: json}. Change (affiliate, count). (1) Post it after "Jason returns this success" post: Create, node_id: @ node.id, locale: @ node locale, affiliate_sender: factoryGirl.attributes_for (: affiliate_seender ,: affiliate_receivers_attributes => "0" = & gt; {"email" = & gt; "test@test.com"}}), format :: json response.status.should Eq {200} end of end I can not be accurate and what is absolutely wrong has been defined on continuous config / environment.rb , but it seems that it is continuously empty because this error occurs when continuous Ho goes! Do I have to be stub or mok?
You are actually defining NOTIFICATION_CONTENT_TYPES as an array of 'Constants' Is evaluated for 'it means that
NOTIFICATION_CONTENT_TYPES # = & gt; ["Referral_InVet"] So to correct, you have to do this consistently:
NOTIFICATION_CONTENT_TYPES [0] It's better to define it briefly:
NOTIFICATION_CONTENT_TYPES = {content_type_invite: 'referral_invite'} and then you can reach the right Value
NOTIFICATION_CONTENT_TYPES [: content_type_invite]
Comments
Post a Comment