-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
fill_in 'Email', with: user.email | ||
fill_in 'Password', with: 'secret' | ||
click_button 'Log in' | ||
within '.user-menu' do | ||
within '.navbar .dropdown-menu' do | ||
expect(page).to have_text '[email protected]' | ||
end | ||
expect(current_path).to eq '/admin/orders' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,17 +35,17 @@ | |
fill_in 'Password', with: user.password | ||
click_button 'Log in' | ||
|
||
within '.user-menu' do | ||
within '.navbar .dropdown-menu' do | ||
expect(page).to have_text '[email protected]' | ||
end | ||
expect(current_path).to eq '/admin/orders' | ||
end | ||
|
||
xit "should store the user previous location" do | ||
it 'should store the user previous location' do | ||
visit spree.account_path | ||
fill_in "Email", with: @user.email | ||
fill_in "Password", with: @user.password | ||
click_button "Login" | ||
expect(current_path).to eq "/account" | ||
fill_in 'Email', with: @user.email | ||
fill_in 'Password', with: @user.password | ||
click_button 'Log in' | ||
expect(current_path).to eq '/account' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
require 'spec_helper' | ||
|
||
def try_spree_current_user | ||
if respond_to?(:spree_current_user) | ||
spree_current_user | ||
elsif respond_to?(:current_spree_user) | ||
current_spree_user | ||
end | ||
end | ||
|
||
describe 'Storefront API v2 Account spec', type: :request do | ||
describe 'account#create' do | ||
before { post '/api/v2/storefront/account', params: params } | ||
|
@@ -8,9 +16,9 @@ | |
let(:params) do | ||
{ | ||
"user": { | ||
"email": "[email protected]", | ||
"password": "password123", | ||
"password_confirmation": "password123" | ||
"email": '[email protected]', | ||
"password": 'password123', | ||
"password_confirmation": 'password123' | ||
} | ||
} | ||
end | ||
|
@@ -26,9 +34,9 @@ | |
let(:params) do | ||
{ | ||
"user": { | ||
"email": "[email protected]", | ||
"password": "password123", | ||
"password_confirmation": "" | ||
"email": '[email protected]', | ||
"password": 'password123', | ||
"password_confirmation": '' | ||
} | ||
} | ||
end | ||
|
@@ -37,13 +45,12 @@ | |
expect(JSON.parse(response.body)['error']).to eq("Password Confirmation doesn't match Password") | ||
end | ||
end | ||
|
||
end | ||
|
||
describe 'account#update' do | ||
include_context 'API v2 tokens' | ||
|
||
let!(:user) { create(:user_with_addresses) } | ||
let!(:user) { create(:user_with_addresses) } | ||
let(:headers) { headers_bearer } | ||
|
||
before { patch '/api/v2/storefront/account', params: params, headers: headers } | ||
|
@@ -52,9 +59,9 @@ | |
let(:params) do | ||
{ | ||
"user": { | ||
"email": "[email protected]", | ||
"password": "password123", | ||
"password_confirmation": "password123" | ||
"email": '[email protected]', | ||
"password": 'password123', | ||
"password_confirmation": 'password123' | ||
} | ||
} | ||
end | ||
|
@@ -70,7 +77,7 @@ | |
let(:params) do | ||
{ | ||
"user": { | ||
"email": "[email protected]" | ||
"email": '[email protected]' | ||
} | ||
} | ||
end | ||
|
@@ -86,9 +93,9 @@ | |
let(:params) do | ||
{ | ||
"user": { | ||
"email": "[email protected]", | ||
"password": "password123", | ||
"password_confirmation": "" | ||
"email": '[email protected]', | ||
"password": 'password123', | ||
"password_confirmation": '' | ||
} | ||
} | ||
end | ||
|