|
|
|
@ -26,7 +26,7 @@ |
|
|
|
|
# See COPYRIGHT and LICENSE files for more details. |
|
|
|
|
#++ |
|
|
|
|
|
|
|
|
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') |
|
|
|
|
require_relative '../spec_helper' |
|
|
|
|
|
|
|
|
|
describe 'hourly rates on user edit', type: :feature, js: true do |
|
|
|
|
let(:user) { create :admin } |
|
|
|
@ -36,7 +36,7 @@ describe 'hourly rates on user edit', type: :feature, js: true do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(User).to receive(:current).and_return user |
|
|
|
|
login_as user |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'with no rates' do |
|
|
|
@ -62,10 +62,10 @@ describe 'hourly rates on user edit', type: :feature, js: true do |
|
|
|
|
|
|
|
|
|
describe 'deleting all rates' do |
|
|
|
|
before do |
|
|
|
|
click_link 'Update' # go to update view for rates |
|
|
|
|
click_link 'Update' # go to update view for rates |
|
|
|
|
SeleniumHubWaiter.wait |
|
|
|
|
find('.icon-delete').click # delete last existing rate |
|
|
|
|
click_on 'Save' # save change |
|
|
|
|
find('.icon-delete').click # delete last existing rate |
|
|
|
|
click_on 'Save' # save change |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# regression test: clicking save used to result in a error |
|
|
|
@ -77,4 +77,28 @@ describe 'hourly rates on user edit', type: :feature, js: true do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'updating rates as German user', driver: :firefox_de do |
|
|
|
|
let(:user) { create :admin, language: 'de' } |
|
|
|
|
let!(:rate) { create(:default_hourly_rate, user: user, rate: 1.0) } |
|
|
|
|
|
|
|
|
|
it 'allows editing without reinterpreting the number (Regression #42219)' do |
|
|
|
|
visit edit_hourly_rate_path(user) |
|
|
|
|
|
|
|
|
|
# Expect the german locale output |
|
|
|
|
expect(page).to have_field("user[existing_rate_attributes][#{rate.id}][rate]", with: '1,00') |
|
|
|
|
|
|
|
|
|
click_link 'Satz hinzufügen' |
|
|
|
|
|
|
|
|
|
fill_in "user_new_rate_attributes_1_valid_from", with: (Time.zone.today + 1.day).iso8601 |
|
|
|
|
fill_in "user_new_rate_attributes_1_rate", with: '5,12' |
|
|
|
|
|
|
|
|
|
click_button 'Speichern' |
|
|
|
|
|
|
|
|
|
view_rates |
|
|
|
|
|
|
|
|
|
expect(page).to have_selector('.currency', text: '1,00') |
|
|
|
|
expect(page).to have_selector('.currency', text: '5,12') |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|