mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Update rspec syntax to v3
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
This commit is contained in:
@@ -25,13 +25,13 @@ describe DiscourseSingleSignOn do
|
||||
end
|
||||
|
||||
def test_parsed(parsed, sso)
|
||||
parsed.nonce.should == sso.nonce
|
||||
parsed.email.should == sso.email
|
||||
parsed.username.should == sso.username
|
||||
parsed.name.should == sso.name
|
||||
parsed.external_id.should == sso.external_id
|
||||
parsed.custom_fields["a"].should == "Aa"
|
||||
parsed.custom_fields["b.b"].should == "B.b"
|
||||
expect(parsed.nonce).to eq sso.nonce
|
||||
expect(parsed.email).to eq sso.email
|
||||
expect(parsed.username).to eq sso.username
|
||||
expect(parsed.name).to eq sso.name
|
||||
expect(parsed.external_id).to eq sso.external_id
|
||||
expect(parsed.custom_fields["a"]).to eq "Aa"
|
||||
expect(parsed.custom_fields["b.b"]).to eq "B.b"
|
||||
end
|
||||
|
||||
it "can do round trip parsing correctly" do
|
||||
@@ -43,9 +43,9 @@ describe DiscourseSingleSignOn do
|
||||
|
||||
sso = SingleSignOn.parse(sso.payload, "test")
|
||||
|
||||
sso.name.should == "sam saffron"
|
||||
sso.username.should == "sam"
|
||||
sso.email.should == "sam@sam.com"
|
||||
expect(sso.name).to eq "sam saffron"
|
||||
expect(sso.username).to eq "sam"
|
||||
expect(sso.email).to eq "sam@sam.com"
|
||||
end
|
||||
|
||||
it "can lookup or create user when name is blank" do
|
||||
@@ -57,14 +57,14 @@ describe DiscourseSingleSignOn do
|
||||
sso.email = "test@test.com"
|
||||
sso.external_id = "A"
|
||||
user = sso.lookup_or_create_user
|
||||
user.should_not == nil
|
||||
expect(user).to_not be_nil
|
||||
end
|
||||
|
||||
it "can fill in data on way back" do
|
||||
sso = make_sso
|
||||
|
||||
url, payload = sso.to_url.split("?")
|
||||
url.should == sso.sso_url
|
||||
expect(url).to eq sso.sso_url
|
||||
parsed = SingleSignOn.parse(payload, "supersecret")
|
||||
|
||||
test_parsed(parsed, sso)
|
||||
@@ -74,10 +74,10 @@ describe DiscourseSingleSignOn do
|
||||
sso = make_sso
|
||||
sso.sso_url = "http://tcdev7.wpengine.com/?action=showlogin"
|
||||
|
||||
sso.to_url.split('?').size.should == 2
|
||||
expect(sso.to_url.split('?').size).to eq 2
|
||||
|
||||
url, payload = sso.to_url.split("?")
|
||||
url.should == "http://tcdev7.wpengine.com/"
|
||||
expect(url).to eq "http://tcdev7.wpengine.com/"
|
||||
parsed = SingleSignOn.parse(payload, "supersecret")
|
||||
|
||||
test_parsed(parsed, sso)
|
||||
@@ -87,20 +87,20 @@ describe DiscourseSingleSignOn do
|
||||
_ , payload = DiscourseSingleSignOn.generate_url.split("?")
|
||||
|
||||
sso = DiscourseSingleSignOn.parse(payload)
|
||||
sso.nonce_valid?.should == true
|
||||
expect(sso.nonce_valid?).to eq true
|
||||
|
||||
sso.expire_nonce!
|
||||
|
||||
sso.nonce_valid?.should == false
|
||||
expect(sso.nonce_valid?).to eq false
|
||||
|
||||
end
|
||||
|
||||
it "generates a correct sso url" do
|
||||
|
||||
url, payload = DiscourseSingleSignOn.generate_url.split("?")
|
||||
url.should == @sso_url
|
||||
expect(url).to eq @sso_url
|
||||
|
||||
sso = DiscourseSingleSignOn.parse(payload)
|
||||
sso.nonce.should_not == nil
|
||||
expect(sso.nonce).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user