mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
b3d769ff4f
update rspec syntax to v3 change syntax to rspec v3 oops. fix typo mailers classes with rspec3 syntax helpers with rspec3 syntax jobs with rspec3 syntax serializers with rspec3 syntax views with rspec3 syntax support to rspec3 syntax category spec with rspec3 syntax
43 lines
971 B
Ruby
43 lines
971 B
Ruby
require "spec_helper"
|
|
|
|
require "auth/authenticator"
|
|
require_dependency "auth/result"
|
|
|
|
describe "users/omniauth_callbacks/complete.html.erb" do
|
|
|
|
let :rendered_data do
|
|
returned = JSON.parse(rendered.match(/window.opener.Discourse.authenticationComplete\((.*)\)/)[1])
|
|
end
|
|
|
|
it "renders auth info" do
|
|
result = Auth::Result.new
|
|
result.user = User.new
|
|
|
|
assign(:data, result)
|
|
|
|
render
|
|
|
|
expect(rendered_data["authenticated"]).to eq(false)
|
|
expect(rendered_data["awaiting_activation"]).to eq(false)
|
|
expect(rendered_data["awaiting_approval"]).to eq(false)
|
|
end
|
|
|
|
it "renders cas data " do
|
|
result = Auth::Result.new
|
|
|
|
result.email = "xxx@xxx.com"
|
|
result.authenticator_name = "CAS"
|
|
|
|
assign(:data, result)
|
|
|
|
render
|
|
|
|
expect(rendered_data["email"]).to eq(result.email)
|
|
# TODO this is a bit weird, the upcasing is confusing,
|
|
# clean it up throughout
|
|
expect(rendered_data["auth_provider"]).to eq("Cas")
|
|
end
|
|
|
|
end
|
|
|
|
|