2013-02-13 15:15:44 +08:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe "users/omniauth_callbacks/complete.html.erb" do
|
|
|
|
it "renders facebook data " do
|
2013-03-23 23:02:59 +08:00
|
|
|
assign(:data, {username: "username", :auth_provider=> "Facebook", :awaiting_activation=>true})
|
2013-02-13 15:15:44 +08:00
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
rendered_data = JSON.parse(rendered.match(/window.opener.Discourse.authenticationComplete\((.*)\)/)[1])
|
|
|
|
|
|
|
|
rendered_data["username"].should eq("username")
|
|
|
|
rendered_data["auth_provider"].should eq("Facebook")
|
|
|
|
rendered_data["awaiting_activation"].should eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "renders twitter data " do
|
2013-03-23 23:02:59 +08:00
|
|
|
assign(:data, {username: "username", :auth_provider=>"Twitter", :awaiting_activation=>true})
|
2013-02-13 15:15:44 +08:00
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
rendered_data = JSON.parse(rendered.match(/window.opener.Discourse.authenticationComplete\((.*)\)/)[1])
|
|
|
|
|
|
|
|
rendered_data["username"].should eq("username")
|
|
|
|
rendered_data["auth_provider"].should eq("Twitter")
|
|
|
|
rendered_data["awaiting_activation"].should eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it "renders openid data " do
|
2013-03-23 23:02:59 +08:00
|
|
|
assign(:data, {username: "username", :auth_provider=>"OpenId", :awaiting_activation=>true})
|
2013-02-13 15:15:44 +08:00
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
rendered_data = JSON.parse(rendered.match(/window.opener.Discourse.authenticationComplete\((.*)\)/)[1])
|
|
|
|
|
|
|
|
rendered_data["username"].should eq("username")
|
|
|
|
rendered_data["auth_provider"].should eq("OpenId")
|
|
|
|
rendered_data["awaiting_activation"].should eq(true)
|
|
|
|
end
|
2013-02-26 00:42:20 +08:00
|
|
|
|
2013-02-26 12:28:32 +08:00
|
|
|
it "renders github data " do
|
2013-03-23 23:02:59 +08:00
|
|
|
assign(:data, {username: "username", :auth_provider=>"Github", :awaiting_activation=>true})
|
2013-02-26 12:28:32 +08:00
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
rendered_data = JSON.parse(rendered.match(/window.opener.Discourse.authenticationComplete\((.*)\)/)[1])
|
|
|
|
|
|
|
|
rendered_data["username"].should eq("username")
|
|
|
|
rendered_data["auth_provider"].should eq("Github")
|
|
|
|
rendered_data["awaiting_activation"].should eq(true)
|
|
|
|
end
|
2013-02-28 01:09:22 +08:00
|
|
|
|
2013-02-13 15:15:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|