credit_card_type_field 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -43,7 +43,7 @@ Specify the credit card number name and supported credit card types:
43
43
  ```ruby
44
44
  <%= form_for @credit_card do |f| %>
45
45
  <%= f.text_field :card_no %>
46
- <%= f.credit_card_type_field :card_type, card_number_field_name: 'card_no', accept_types: %(visa master) %>
46
+ <%= f.credit_card_type_field :card_type, card_number_field_name: 'card_no', accept_types: %w(visa master) %>
47
47
  <% end %>
48
48
  ```
49
49
 
@@ -1,3 +1,3 @@
1
1
  module CreditCardField
2
- VERSION = "1.2"
2
+ VERSION = "1.3"
3
3
  end
data/spec/form_spec.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'FormBuilder' do
4
+ include Capybara::DSL
5
+
6
+ describe '#credit_card_type_field' do
7
+ it 'default setting', :js => true do
8
+ visit '/credit_cards/new'
9
+ page.should_not have_css('#credit-card-form1 li.visa.active')
10
+ page.should have_css('#credit-card-form1 li.not_valid.active')
11
+ fill_in 'card-no-1', with: '4017954048470653'
12
+ page.should have_css('#credit-card-form1 li.visa.active')
13
+ page.should_not have_css('#credit-card-form1 li.master.active')
14
+ page.should_not have_css('#credit-card-form1 li.not_valid.active')
15
+
16
+ fill_in 'card-no-2', with: '4017954048470653'
17
+ page.should have_css('#credit-card-form2 li.visa.active')
18
+ page.should_not have_css('#credit-card-form2 li.master.active')
19
+ page.should_not have_css('#credit-card-form2 li.not_valid.active')
20
+ end
21
+
22
+ it 'should hightlight not valid card', :js => true do
23
+ visit '/credit_cards/new'
24
+ fill_in 'card-no-1', with: '123456789'
25
+ page.should have_css('#credit-card-form1 li.not_valid.active')
26
+ end
27
+ end
28
+
29
+ describe '#credit_card_type_field_tag' do
30
+ it 'should render tag', :js => true do
31
+ visit '/credit_cards/new'
32
+ fill_in 'card-no-3', with: '4017954048470653'
33
+ page.should have_css('#credit-card-form3 li.visa.active')
34
+ end
35
+ end
36
+ end
37
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_card_type_field
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -180,6 +180,7 @@ files:
180
180
  - spec/dummy/script/rails
181
181
  - spec/dummy/test/functional/projects_controller_test.rb
182
182
  - spec/dummy/test/unit/helpers/projects_helper_test.rb
183
+ - spec/form_spec.rb
183
184
  - spec/spec_helper.rb
184
185
  - vendor/assets/images/credit_cards/american_express_32.png
185
186
  - vendor/assets/images/credit_cards/credit_card_bg.png
@@ -187,8 +188,8 @@ files:
187
188
  - vendor/assets/images/credit_cards/mastercard_32.png
188
189
  - vendor/assets/images/credit_cards/not_valid_32.png
189
190
  - vendor/assets/images/credit_cards/visa_32.png
190
- - vendor/assets/javascripts/credit_card_field.js.coffee
191
- - vendor/assets/stylesheets/credit_card_field.css.scss
191
+ - vendor/assets/javascripts/credit_card_type_field.js.coffee
192
+ - vendor/assets/stylesheets/credit_card_type_field.css.scss
192
193
  homepage: https://github.com/BenZhang/credit_card_type_field
193
194
  licenses: []
194
195
  post_install_message:
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
210
  version: '0'
210
211
  requirements: []
211
212
  rubyforge_project:
212
- rubygems_version: 1.8.24
213
+ rubygems_version: 1.8.25
213
214
  signing_key:
214
215
  specification_version: 3
215
216
  summary: Credit Card type field
@@ -254,4 +255,5 @@ test_files:
254
255
  - spec/dummy/script/rails
255
256
  - spec/dummy/test/functional/projects_controller_test.rb
256
257
  - spec/dummy/test/unit/helpers/projects_helper_test.rb
258
+ - spec/form_spec.rb
257
259
  - spec/spec_helper.rb