Created
August 3, 2012 21:19
-
-
Save superacidjax/3251655 to your computer and use it in GitHub Desktop.
admin user_controller test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17: test "resend invitation" do | |
18: @invitation = FactoryGirl.create(:invitation) | |
19: @user = FactoryGirl.create(:user) | |
20: #@department = FactoryGirl.create(:department) | |
21: @user.make_admin_of(@invitation.company) | |
22: sign_in(@user) | |
=> 23: binding.pry | |
24: assert Invitation.find_by_id(@invitation.id), "Invitation should be present" | |
25: | |
26: assert_difference 'ActionMailer::Base.deliveries.size', +1 do | |
27: post :resend_invitation, :id => @invitation | |
28: assert_response :success | |
29: end | |
30: | |
31: email = ActionMailer::Base.deliveries.last | |
32: assert_equal 'Invitation to join Take the Interview', email.subject | |
33: assert_equal [invitation.email], email.to | |
34: assert_match %r{Hello. You have been invited to join #{invitation.company.name} on Take the Interview.}, email.body.to_s | |
35: end | |
[1] pry(#<CompanyAdmin::UsersControllerTest>)> @company | |
=> nil | |
[2] pry(#<CompanyAdmin::UsersControllerTest>)> @user | |
=> #<User id: 1, state: nil, first_name: "Derp", last_name: "Herpson", email: "[email protected]", role: "Employer", crypted_password: "$2a$10$x44ry9qFfrs7jGkUVpQ1Ouhzp/7hIMI16M1iKYl1MaQv...", password_salt: "AG4SczQMUteEyvs1D5A", persistence_token: "2a02fc892d88cddbddd2b2a40ed4bc66416a420c4fd843de28c...", login_count: 2, last_request_at: "2012-08-03 21:16:14", last_login_at: "2012-08-03 21:16:14", current_login_at: "2012-08-03 21:16:14", last_login_ip: "0.0.0.0", current_login_ip: "0.0.0.0", created_at: "2012-08-03 21:16:14", updated_at: "2012-08-03 21:16:14", summary: nil, location: nil, avatar: nil, linkedin_id: nil, temp_password: true, suspended: false, interview_notification_interval: nil, receive_newsletter: true, linkedin_token: nil, linkedin_token_secret: nil, headline: nil, company_website: nil, personal_website: nil, educations: [{}, {}, {}], positions: [{}, {}, {}, {}, {}], perishable_token: nil, profile_video_id: nil, active: true, tour_viewed: false, company_id: nil> | |
[3] pry(#<CompanyAdmin::UsersControllerTest>)> @invitation | |
=> #<Invitation id: 1, created_at: "2012-08-03 21:16:14", updated_at: "2012-08-03 21:16:14", company_id: 1, user_id: nil, email: "[email protected]", code: "Z3VQZSEJVGA", state: "invited"> | |
[4] pry(#<CompanyAdmin::UsersControllerTest>)> @invitation.company | |
=> #<Company id: 1, name: "Derpco", state: "active", plan_id: 1, created_at: "2012-08-03 21:16:14", updated_at: "2012-08-03 21:16:14", plan_handle: "per-screen", contact_number: "4085551212", access_code_id: nil> | |
[5] pry(#<CompanyAdmin::UsersControllerTest>)> @invitation.id | |
=> 1 | |
[6] pry(#<CompanyAdmin::UsersControllerTest>)> step | |
From: /Users/brian/Development/take_the_interview/take_the_interview/test/functional/company_admin/users_controller_test.rb @ line 17 CompanyAdmin::UsersControllerTest#test_resend_invitation: | |
17: test "resend invitation" do | |
18: @invitation = FactoryGirl.create(:invitation) | |
19: @user = FactoryGirl.create(:user) | |
20: #@department = FactoryGirl.create(:department) | |
21: @user.make_admin_of(@invitation.company) | |
22: sign_in(@user) | |
23: binding.pry | |
=> 24: assert Invitation.find_by_id(@invitation.id), "Invitation should be present" | |
25: | |
26: assert_difference 'ActionMailer::Base.deliveries.size', +1 do | |
27: post :resend_invitation, :id => @invitation | |
28: assert_response :success | |
29: end | |
30: | |
31: email = ActionMailer::Base.deliveries.last | |
32: assert_equal 'Invitation to join Take the Interview', email.subject | |
33: assert_equal [invitation.email], email.to | |
34: assert_match %r{Hello. You have been invited to join #{invitation.company.name} on Take the Interview.}, email.body.to_s | |
35: end | |
[1] pry(#<CompanyAdmin::UsersControllerTest>)> step | |
From: /Users/brian/.rvm/gems/ruby-1.9.3-p194@interview/gems/activerecord-3.0.14/lib/active_record/attribute_methods/read.rb @ line 86 #<Module:0x007fd479a16580>#_id: | |
81: #{access_code} | |
82: end | |
83: | |
84: alias #{method_name} _#{method_name} | |
85: STR | |
=> 86: else | |
87: generated_attribute_methods.module_eval do | |
88: define_method("_#{method_name}") { eval(access_code) } | |
89: alias_method(method_name, "_#{method_name}") | |
90: end | |
91: end | |
[1] pry(#<Invitation>)> @invitation | |
=> nil | |
[2] pry(#<Invitation>)> @invitation.id | |
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id | |
from (pry):7:in `_id' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment