Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Adicionando possibilidade de passar opções para o helper submit_tag #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
spec/support/tmp/**/*
spec/support/log/*.log
pkg
pkg
.ruby-version
4 changes: 2 additions & 2 deletions app/views/pagseguro/_pagseguro_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= hidden_field_tag "tipo", "CP" %>
<%= hidden_field_tag "moeda", "BRL" %>
<%= hidden_field_tag "ref_transacao", order.id %>
<%= hidden_field_tag "tipo_frete", order.shipping_type if order.shipping_type %>
<%= hidden_field_tag "frete", order.shipping_type if order.shipping_type %>

<% order.products.each_with_index do |product, i| %>
<% i += 1 %>
Expand All @@ -21,6 +21,6 @@
<%= hidden_field_tag PagSeguro::Order::BILLING_MAPPING[name.to_sym], value %>
<% end %>

<%= submit_tag options[:submit] %>
<%= submit_tag options[:submit], options.fetch(:submit_options, {}) %>
</div>
</form>
4 changes: 2 additions & 2 deletions spec/helpers/helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

subject {
Nokogiri::HTML(helper.pagseguro_form(@order)).css("form").first
Nokogiri::HTML(helper.pagseguro_form(@order, :submit_options => { :class => 'foo' })).css("form").first
}

context "with default attributes" do
Expand All @@ -20,7 +20,7 @@
it { should have_input(:name => "ref_transacao", :value => "I1001") }
it { should_not have_input(:name => "tipo_frete") }
it { should have_input(:name => "email_cobranca", :value => "[email protected]") }
it { should have_input(:type => "submit", :value => "Pagar com PagSeguro") }
it { should have_input(:type => "submit", :value => "Pagar com PagSeguro", :class => 'foo') }
end

it "should include shipping type" do
Expand Down