diff --git a/spec/views/facebook/complete.html.erb_spec.rb b/spec/views/facebook/complete.html.erb_spec.rb new file mode 100644 index 00000000000..7740521352f --- /dev/null +++ b/spec/views/facebook/complete.html.erb_spec.rb @@ -0,0 +1,15 @@ +require "spec_helper" + +describe "facebook/complete.html.erb" do + it "renders data " do + assign(:data, {:username =>"username", :auth_provider=>"Facebook", :awaiting_activation=>true}) + + 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 +end diff --git a/spec/views/twitter/complete.html.erb_spec.rb b/spec/views/twitter/complete.html.erb_spec.rb new file mode 100644 index 00000000000..5ed8b47c163 --- /dev/null +++ b/spec/views/twitter/complete.html.erb_spec.rb @@ -0,0 +1,15 @@ +require "spec_helper" + +describe "twitter/complete.html.erb" do + it "renders data " do + assign(:data, {:username =>"username", :auth_provider=>"Twitter", :awaiting_activation=>true}) + + 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 +end diff --git a/spec/views/user_open_ids/complete.html.erb_spec.rb b/spec/views/user_open_ids/complete.html.erb_spec.rb new file mode 100644 index 00000000000..0698b944c33 --- /dev/null +++ b/spec/views/user_open_ids/complete.html.erb_spec.rb @@ -0,0 +1,15 @@ +require "spec_helper" + +describe "user_open_ids/complete.html.erb" do + it "renders data " do + assign(:data, {:username =>"username", :auth_provider=>"OpenId", :awaiting_activation=>true}) + + 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 +end