From f232c646a7ed15e89a64826959c76e983e8dca82 Mon Sep 17 00:00:00 2001 From: xdite Date: Wed, 13 Feb 2013 15:15:44 +0800 Subject: [PATCH] move 3 test to 1 --- spec/views/facebook/complete.html.erb_spec.rb | 15 ------- .../complete.html.erb_spec.rb | 43 +++++++++++++++++++ spec/views/twitter/complete.html.erb_spec.rb | 15 ------- .../user_open_ids/complete.html.erb_spec.rb | 15 ------- 4 files changed, 43 insertions(+), 45 deletions(-) delete mode 100644 spec/views/facebook/complete.html.erb_spec.rb create mode 100644 spec/views/omniauth_callbacks/complete.html.erb_spec.rb delete mode 100644 spec/views/twitter/complete.html.erb_spec.rb delete mode 100644 spec/views/user_open_ids/complete.html.erb_spec.rb diff --git a/spec/views/facebook/complete.html.erb_spec.rb b/spec/views/facebook/complete.html.erb_spec.rb deleted file mode 100644 index 7740521352f..00000000000 --- a/spec/views/facebook/complete.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -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/omniauth_callbacks/complete.html.erb_spec.rb b/spec/views/omniauth_callbacks/complete.html.erb_spec.rb new file mode 100644 index 00000000000..5b54f8d9c4e --- /dev/null +++ b/spec/views/omniauth_callbacks/complete.html.erb_spec.rb @@ -0,0 +1,43 @@ +require "spec_helper" + +describe "users/omniauth_callbacks/complete.html.erb" do + it "renders facebook 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 + + it "renders twitter 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 + + + it "renders openid 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 + + diff --git a/spec/views/twitter/complete.html.erb_spec.rb b/spec/views/twitter/complete.html.erb_spec.rb deleted file mode 100644 index 5ed8b47c163..00000000000 --- a/spec/views/twitter/complete.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 0698b944c33..00000000000 --- a/spec/views/user_open_ids/complete.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -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