Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: viehlieb <pf@pragma-shift.net> co-authored-by: Tobias Kneuker <tk@pragma-shift.net>
- Loading branch information
1 parent
427561e
commit 893021c
Showing
7 changed files
with
167 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'factory_bot' | ||
|
||
FactoryBot.define do | ||
factory :delivery do | ||
supplier { create :supplier } | ||
date { Time.now } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require_relative '../spec_helper' | ||
|
||
describe HomeController do | ||
let(:user) { create :user } | ||
|
||
before { login user } | ||
|
||
describe 'my profile' do | ||
before { visit my_profile_path } | ||
|
||
it 'is accessible' do | ||
expect(page).to have_field 'input[id=user_first_name]' | ||
expect(find_field('user_first_name').value).to eq user.first_name | ||
end | ||
|
||
it 'updates first name' do | ||
fill_in 'user_first_name', with: 'foo' | ||
click_button I18n.t('ui.save') | ||
expect(User.find(user.id).first_name).to eq 'foo' | ||
expect(page).to have_selector '.alert-success' | ||
end | ||
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require_relative '../spec_helper' | ||
|
||
describe Delivery do | ||
let(:delivery) { create :delivery } | ||
let(:stock_article) { create :stock_article, price: 3 } | ||
|
||
it 'creates new stock_changes' do | ||
delivery.new_stock_changes = ([ | ||
{ | ||
quantity: 1, | ||
stock_article: stock_article | ||
}, | ||
{ | ||
quantity: 2, | ||
stock_article: stock_article | ||
} | ||
]) | ||
|
||
expect(delivery.stock_changes.last[:stock_article_id]).to be stock_article.id | ||
expect(delivery.includes_article?(stock_article)).to be true | ||
expect(delivery.sum(:net)).to eq 9 | ||
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