forked from solidusio/solidus_paypal_braintree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request solidusio#136 from tvdeyen/add-hash-preference-field
Add a partial for the hash preference field
- Loading branch information
Showing
4 changed files
with
36 additions
and
13 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
12 changes: 12 additions & 0 deletions
12
lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb
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,12 @@ | ||
<% label = local_assigns[:label].presence %> | ||
<% html_options = {class: 'input_hash fullwidth'}.update(local_assigns[:html_options] || {}) %> | ||
|
||
<div class="field"> | ||
<% if local_assigns[:form] %> | ||
<%= form.label attribute, label %> | ||
<%= form.text_area attribute, html_options %> | ||
<% else %> | ||
<%= label_tag name, label %> | ||
<%= text_area_tag name, value, html_options %> | ||
<% end %> | ||
</div> |
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,11 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe "viewing the configuration interface", js: true do | ||
RSpec.describe "viewing the configuration interface" do | ||
stub_authorization! | ||
|
||
# Regression to ensure this page still renders on old versions of solidus | ||
scenario "should not raise any errors due to unavailable route helpers" do | ||
visit "/solidus_paypal_braintree/configurations/list" | ||
expect(page).to have_content("Braintree Configurations") | ||
end | ||
|
||
# Regression to ensure this page renders on Solidus 2.4 | ||
scenario 'should not raise any errors due to unavailable preference field partial' do | ||
Rails.application.config.spree.payment_methods << SolidusPaypalBraintree::Gateway | ||
Spree::PaymentMethod.create!( | ||
type: 'SolidusPaypalBraintree::Gateway', | ||
name: 'Braintree Payments' | ||
) | ||
visit '/admin/payment_methods' | ||
page.find('a[title="Edit"]').click | ||
expect(page).to have_field 'Name', with: 'Braintree Payments' | ||
end | ||
end |