-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes user update #12
base: master
Are you sure you want to change the base?
Conversation
user.reload | ||
expect(user.role).to eq("merchant_admin") | ||
expect(user.role).to eq("user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
within "#user-#{user.id}" do | ||
select "user", :from => "Role" | ||
select("Vintage Vampire", from: "Merchant").select_option | ||
click_on "Update" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
within "#user-#{user.id}" do | ||
select "user", :from => "Role" | ||
select("Vintage Vampire", from: "Merchant").select_option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
within "#user-#{user.id}" do | ||
select "user", :from => "Role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
|
||
visit admin_dash_users_path | ||
|
||
expect(user.role).to eq("merchant_employee") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
end | ||
|
||
user.reload | ||
expect(user.role).to eq("merchant_employee") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -15,12 +15,36 @@ | |||
|
|||
within "#user-#{user.id}" do | |||
expect(page).to have_content('Role') | |||
select "merchant_admin", :from => "Role" | |||
select "merchant_employee", :from => "Role" | |||
select("Vintage Vampire", from: "Merchant").select_option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -15,12 +15,36 @@ | |||
|
|||
within "#user-#{user.id}" do | |||
expect(page).to have_content('Role') | |||
select "merchant_admin", :from => "Role" | |||
select "merchant_employee", :from => "Role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
if params[:user][:role] == "merchant_employee" | ||
@user.merchant_id = @merchant.id | ||
@user.save | ||
elsif params[:user][:role] != "merchant_employee" && @user.merchant_id != nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Style/NonNilCheck: Prefer !expression.nil? over expression != nil.
Metrics/LineLength: Line is too long. [83/80]
@@ -1,6 +1,7 @@ | |||
class Admin::UsersController < Admin::BaseController | |||
def index | |||
@users = User.unscoped.all | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.
expect(user.role).to eq("user") | ||
expect(user.merchant_id).to eq(nil) | ||
save_and_open_page | ||
expect(page).to have_content("Please try again. You may need to choose a merchant.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Metrics/LineLength: Line is too long. [88/80]
user.reload | ||
expect(user.role).to eq("user") | ||
expect(user.merchant_id).to eq(nil) | ||
save_and_open_page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
Lint/Debugger: Remove debugger entry point save_and_open_page.
end | ||
|
||
user.reload | ||
expect(user.role).to eq("user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
within "#user-#{user.id}" do | ||
select "merchant_employee", :from => "Role" | ||
click_on "Update" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
expect(user.role).to eq("user") | ||
|
||
within "#user-#{user.id}" do | ||
select "merchant_employee", :from => "Role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
it "won't update if no merchant is given for a merchant employee" do | ||
admin = create(:admin_user) | ||
user = create(:random_user) | ||
merchant = create(:ray_merchant) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - merchant.
redirect_to admin_dash_users_path | ||
else | ||
flash[:error] = "Please try again. You may need to choose a merchant." | ||
redirect_to admin_dash_users_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/IdenticalConditionalBranches: Move redirect_to admin_dash_users_path out of the conditional.
flash[:success] = "The user role has been updated to #{@user.role}." | ||
redirect_to admin_dash_users_path | ||
else | ||
flash[:error] = "Please try again. You may need to choose a merchant." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
end | ||
if @user.update | ||
flash[:success] = "The user role has been updated to #{@user.role}." | ||
redirect_to admin_dash_users_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/IdenticalConditionalBranches: Move redirect_to admin_dash_users_path out of the conditional.
flash[:success] = "The user role has been updated to #{@user.role}." | ||
redirect_to admin_dash_users_path | ||
@merchant = Merchant.where(name: params[:user][:merchant]).first | ||
if params[:user][:role] == "merchant_employee" && @merchant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
What functionality does this accomplish?
closes #
Description:
What did you struggle on to complete?
Current Test Suite:
Test Coverage Percentage: x%
Checklist:
Helpful Resources:
Review Requests(optional):
Please include a gif of how you feel about this branch: