Commit fdc23a93e7368283f8f78b8e8627aef9ad73c617
1 parent
7a56075e
Exists in
master
and in
4 other branches
Style guide fixes (spacing)
Change-Id: I966bfd0ccc4b05925384ecab8c6cbe3c6ba3b667
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
spec/requests/api/api_helpers_spec.rb
| @@ -17,7 +17,6 @@ describe API do | @@ -17,7 +17,6 @@ describe API do | ||
| 17 | env[API::APIHelpers::SUDO_HEADER] = identifier | 17 | env[API::APIHelpers::SUDO_HEADER] = identifier |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | - | ||
| 21 | def set_param(token_usr, identifier) | 20 | def set_param(token_usr, identifier) |
| 22 | clear_env | 21 | clear_env |
| 23 | clear_param | 22 | clear_param |
| @@ -25,7 +24,6 @@ describe API do | @@ -25,7 +24,6 @@ describe API do | ||
| 25 | params[API::APIHelpers::SUDO_PARAM] = identifier | 24 | params[API::APIHelpers::SUDO_PARAM] = identifier |
| 26 | end | 25 | end |
| 27 | 26 | ||
| 28 | - | ||
| 29 | def clear_env | 27 | def clear_env |
| 30 | env.delete(API::APIHelpers::PRIVATE_TOKEN_HEADER) | 28 | env.delete(API::APIHelpers::PRIVATE_TOKEN_HEADER) |
| 31 | env.delete(API::APIHelpers::SUDO_HEADER) | 29 | env.delete(API::APIHelpers::SUDO_HEADER) |
| @@ -70,6 +68,7 @@ describe API do | @@ -70,6 +68,7 @@ describe API do | ||
| 70 | set_param(user, admin.username) | 68 | set_param(user, admin.username) |
| 71 | expect { current_user }.to raise_error | 69 | expect { current_user }.to raise_error |
| 72 | end | 70 | end |
| 71 | + | ||
| 73 | it "should throw an error when the user cannot be found for a given id" do | 72 | it "should throw an error when the user cannot be found for a given id" do |
| 74 | id = user.id + admin.id | 73 | id = user.id + admin.id |
| 75 | user.id.should_not == id | 74 | user.id.should_not == id |
| @@ -80,6 +79,7 @@ describe API do | @@ -80,6 +79,7 @@ describe API do | ||
| 80 | set_param(admin, id) | 79 | set_param(admin, id) |
| 81 | expect { current_user }.to raise_error | 80 | expect { current_user }.to raise_error |
| 82 | end | 81 | end |
| 82 | + | ||
| 83 | it "should throw an error when the user cannot be found for a given username" do | 83 | it "should throw an error when the user cannot be found for a given username" do |
| 84 | username = "#{user.username}#{admin.username}" | 84 | username = "#{user.username}#{admin.username}" |
| 85 | user.username.should_not == username | 85 | user.username.should_not == username |
| @@ -90,6 +90,7 @@ describe API do | @@ -90,6 +90,7 @@ describe API do | ||
| 90 | set_param(admin, username) | 90 | set_param(admin, username) |
| 91 | expect { current_user }.to raise_error | 91 | expect { current_user }.to raise_error |
| 92 | end | 92 | end |
| 93 | + | ||
| 93 | it "should handle sudo's to oneself" do | 94 | it "should handle sudo's to oneself" do |
| 94 | set_env(admin, admin.id) | 95 | set_env(admin, admin.id) |
| 95 | current_user.should == admin | 96 | current_user.should == admin |
| @@ -116,6 +117,7 @@ describe API do | @@ -116,6 +117,7 @@ describe API do | ||
| 116 | current_user.should == user | 117 | current_user.should == user |
| 117 | current_user.should == user | 118 | current_user.should == user |
| 118 | end | 119 | end |
| 120 | + | ||
| 119 | it "should handle multiple sudo's to oneself using string ids" do | 121 | it "should handle multiple sudo's to oneself using string ids" do |
| 120 | set_env(admin, user.id.to_s) | 122 | set_env(admin, user.id.to_s) |
| 121 | current_user.should == user | 123 | current_user.should == user |