billing 0.0.0 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/billing/accounts.js +2 -0
  3. data/app/assets/javascripts/billing/charges.js +2 -0
  4. data/app/assets/javascripts/billing/modifiers.js +2 -0
  5. data/app/assets/javascripts/billing/payments.js +2 -0
  6. data/app/assets/stylesheets/billing/accounts.css +4 -0
  7. data/app/assets/stylesheets/billing/charges.css +4 -0
  8. data/app/assets/stylesheets/billing/modifiers.css +4 -0
  9. data/app/assets/stylesheets/billing/payments.css +4 -0
  10. data/app/controllers/billing/accounts_controller.rb +29 -0
  11. data/app/controllers/billing/application_controller.rb +18 -0
  12. data/app/controllers/billing/charges_controller.rb +29 -0
  13. data/app/controllers/billing/modifiers_controller.rb +29 -0
  14. data/app/controllers/billing/payments_controller.rb +29 -0
  15. data/app/helpers/billing/accounts_helper.rb +4 -0
  16. data/app/helpers/billing/charges_helper.rb +4 -0
  17. data/app/helpers/billing/modifiers_helper.rb +4 -0
  18. data/app/helpers/billing/payments_helper.rb +4 -0
  19. data/app/models/billing/account.rb +66 -0
  20. data/app/models/billing/account_item.rb +15 -0
  21. data/app/models/billing/charge.rb +21 -0
  22. data/app/models/billing/modifier.rb +32 -0
  23. data/app/models/billing/modifier_items.rb +11 -0
  24. data/app/models/billing/origin.rb +4 -0
  25. data/app/models/billing/payment.rb +39 -0
  26. data/app/models/billing/payment_type.rb +6 -0
  27. data/app/models/billing/payment_with_type.rb +14 -0
  28. data/app/models/billing/plu.rb +4 -0
  29. data/app/models/billing/profile.rb +4 -0
  30. data/app/models/billing/tax_group.rb +4 -0
  31. data/app/views/billing/accounts/index.html.erb +7 -0
  32. data/app/views/billing/accounts/new.html.erb +8 -0
  33. data/app/views/billing/accounts/show.html.erb +29 -0
  34. data/app/views/billing/application/index.html.erb +3 -0
  35. data/app/views/billing/charges/new.html.erb +12 -0
  36. data/app/views/billing/modifiers/new.html.erb +18 -0
  37. data/app/views/billing/payments/new.html.erb +11 -0
  38. data/config/routes.rb +6 -0
  39. data/db/migrate/20140717180443_create_billing_accounts.rb +9 -0
  40. data/db/migrate/20140717181134_create_billing_charges.rb +11 -0
  41. data/db/migrate/20140717181406_create_billing_discounts.rb +11 -0
  42. data/db/migrate/20140717183129_create_billing_payments.rb +10 -0
  43. data/db/migrate/20140717202527_create_billing_origins.rb +9 -0
  44. data/db/migrate/20140718164841_add_sumaries_to_billing_account.rb +11 -0
  45. data/db/migrate/20140718210349_add_fixed_value_to_billing_discount.rb +7 -0
  46. data/db/migrate/20140718212116_create_billing_payment_types.rb +11 -0
  47. data/db/migrate/20140719094023_create_billing_tax_groups.rb +9 -0
  48. data/db/migrate/20140719094033_create_billing_plus.rb +9 -0
  49. data/db/migrate/20140719094418_create_billing_profiles.rb +9 -0
  50. data/db/migrate/20140719103621_rename_billing_discounts_to_modifiers.rb +5 -0
  51. data/db/migrate/20140719110412_add_surcharges_sum_to_billing_account.rb +7 -0
  52. data/db/migrate/20140720110811_add_type_to_billing_payment.rb +6 -0
  53. data/db/migrate/20140720132559_add_type_to_billing_payment_type.rb +5 -0
  54. data/lib/billing.rb +16 -0
  55. data/lib/billing/billable.rb +34 -0
  56. data/lib/billing/engine.rb +1 -0
  57. data/lib/billing/mapping.rb +32 -0
  58. data/lib/billing/routes.rb +16 -0
  59. data/lib/billing/version.rb +1 -1
  60. data/lib/tasks/billing.rake +7 -0
  61. data/test/controllers/billing/accounts_controller_test.rb +19 -0
  62. data/test/controllers/billing/charges_controller_test.rb +16 -0
  63. data/test/controllers/billing/modifiers_controller_test.rb +16 -0
  64. data/test/controllers/billing/payments_controller_test.rb +16 -0
  65. data/test/dummy/app/models/profile.rb +3 -0
  66. data/test/dummy/config/routes.rb +3 -2
  67. data/test/dummy/db/development.sqlite3 +0 -0
  68. data/test/dummy/db/migrate/20140718104656_create_profiles.rb +8 -0
  69. data/test/dummy/db/schema.rb +112 -0
  70. data/test/dummy/db/test.sqlite3 +0 -0
  71. data/test/dummy/log/development.log +1602 -0
  72. data/test/dummy/log/test.log +52069 -0
  73. data/test/dummy/test/fixtures/profiles.yml +11 -0
  74. data/test/dummy/test/models/profile_test.rb +7 -0
  75. data/test/dummy/tmp/cache/assets/test/sprockets/02adf8ace512aefc4ef19b35aebc07f7 +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sprockets/0cab887466527f5353fd43adab72769b +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/25b7c6efcbd128f109577104af58d084 +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/2f52090f9e08ac02cd453b04af0df887 +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/35a523ac3c33d6409a69faead4b2a882 +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/3f4fc67be1dd91962f5a0026848dca77 +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/43b3cc0ac6f63c0e1a3ab61fec84519d +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/59435066fc40e1ef5b45b0fd2c0eacf9 +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/69cb965e6031d8099c185256f6fa8f90 +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/6d34e4addaf3495d1d96306d164feb97 +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/79316f9f3f5ebcec9b368d92d2e97e23 +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/7ffc7e805e3fc08bae6a93e027a3e911 +0 -0
  87. data/test/dummy/tmp/cache/assets/test/sprockets/82ae0f4fbceb673c729b9bcb54a1161c +0 -0
  88. data/test/dummy/tmp/cache/assets/test/sprockets/9509747efe602f6a81d50d9744f385f2 +0 -0
  89. data/test/dummy/tmp/cache/assets/test/sprockets/971b6b8d6c7a57e72d235e55537a2c44 +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/b68d1e1a967e74abe3e10f643756ae67 +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/cab3eca4515d1263ea8db2ff58df151d +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/cac68bb014ecc482b8f85312e49baa6f +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/d3ab844c61f1c211ed5fad5407cd18ef +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/d6d844128e4910cf773d1c48dd147e3b +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/e62907e54633a2adb53c33c1f59b79bf +0 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/e96b4e8fe0ebcceb51d202c8af7826ea +0 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/eb95e26896c1c6788657c4ef68a7e9e1 +0 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/efaa0abeb4ad44b0ef8df996631f3997 +0 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/f393277b28dd79320611f18a379dbea7 +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/fbf1489a0c3d66a329f070c10cd77a03 +0 -0
  101. data/test/fixtures/billing/accounts.yml +11 -0
  102. data/test/fixtures/billing/charges.yml +15 -0
  103. data/test/fixtures/billing/modifiers.yml +14 -0
  104. data/test/fixtures/billing/origins.yml +7 -0
  105. data/test/fixtures/billing/payment_types.yml +11 -0
  106. data/test/fixtures/billing/payments.yml +15 -0
  107. data/test/fixtures/billing/plus.yml +7 -0
  108. data/test/fixtures/billing/profiles.yml +7 -0
  109. data/test/fixtures/billing/tax_groups.yml +7 -0
  110. data/test/fixtures/profiles.yml +1 -0
  111. data/test/helpers/billing/accounts_helper_test.rb +6 -0
  112. data/test/helpers/billing/charges_helper_test.rb +6 -0
  113. data/test/helpers/billing/modifiers_helper_test.rb +6 -0
  114. data/test/helpers/billing/payments_helper_test.rb +6 -0
  115. data/test/models/billing/account_test.rb +43 -0
  116. data/test/models/billing/charge_test.rb +17 -0
  117. data/test/models/billing/modifier_test.rb +19 -0
  118. data/test/models/billing/origin_test.rb +9 -0
  119. data/test/models/billing/payment_test.rb +17 -0
  120. data/test/models/billing/payment_type_test.rb +9 -0
  121. data/test/models/billing/plu_test.rb +9 -0
  122. data/test/models/billing/profile_test.rb +9 -0
  123. data/test/models/billing/tax_group_test.rb +9 -0
  124. data/test/test_helper.rb +28 -2
  125. metadata +199 -7
@@ -0,0 +1,4 @@
1
+ module Billing
2
+ class Plu < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Billing
2
+ class Profile < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Billing
2
+ class TaxGroup < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ <h1>Accounts#index</h1>
2
+ <p>Find me in app/views/billing/accounts/index.html.erb</p>
3
+ <%= link_to :new, new_account_path %>
4
+ <hr />
5
+ <% @accounts.each do |account| %>
6
+ <%= link_to account.inspect, account %>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <h1>
2
+ New account
3
+ <small><%= billable %></small>
4
+ </h1>
5
+ <%= form_for @account do |f| %>
6
+ <%= @account.inspect %>
7
+ <%= f.submit %>
8
+ <% end %>
@@ -0,0 +1,29 @@
1
+ <%= @account.inspect %>
2
+ <h2>
3
+ total: <%= @account.total %>
4
+ <br />
5
+ balance: <%= @account.balance %>
6
+ </h2>
7
+ <hr />
8
+ Charges:<br />
9
+ <% @account.charges.each do |charge| %>
10
+ <%= charge.inspect %>
11
+ <% end %>
12
+ <%= link_to :charge, [:new, @account, :charge] %>
13
+ <hr />
14
+ Modifiers:<br />
15
+ <% @account.modifiers.each do |modifier| %>
16
+ <%= modifier.inspect %>
17
+ <% end %>
18
+ <%= link_to :modifier, [:new, @account, :modifier] %>
19
+ <div>
20
+ <% @account.modifier_items.each do |mi| %>
21
+ <%= mi.inspect %><br />
22
+ <% end %>
23
+ </div>
24
+ <hr />
25
+ Payments:<br />
26
+ <% @account.payments.each do |payment| %>
27
+ <%= payment.inspect %>
28
+ <% end %>
29
+ <%= link_to :pay, [:new, @account, :payment] %>
@@ -0,0 +1,3 @@
1
+ <%= link_to :accounts, accounts_path %>
2
+ <br />
3
+ <%= link_to :new_account, new_account_path %>
@@ -0,0 +1,12 @@
1
+ <h1>
2
+ New charge
3
+ <small><%= @account %></small>
4
+ </h1>
5
+ <%= form_for [@account, @charge] do |f| %>
6
+ <%= @charge.inspect %>
7
+ <br />
8
+ <%= f.number_field :price, step: 0.01 %>
9
+ <br />
10
+ <%= f.submit %>
11
+ <% end %>
12
+
@@ -0,0 +1,18 @@
1
+ <h1>
2
+ New Modifier
3
+ <small><%= @account %></small>
4
+ </h1>
5
+ <div>
6
+ <%= @modifier.errors.full_messages.join(', ') %>
7
+ </div>
8
+ <%= form_for [@account, @modifier] do |f| %>
9
+ <%= @modifier.inspect %>
10
+ <br />
11
+ percent ratio <%= f.number_field :percent_ratio, step: 0.001 %>
12
+ <br />
13
+ fixed value <%= f.number_field :fixed_value, step: 0.01 %>
14
+ <br />
15
+ <%= f.select :charge_id, @account.charges.collect(&:id), { include_blank: true } %>
16
+ <br />
17
+ <%= f.submit %>
18
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <h1>
2
+ New payment
3
+ <small><%= @account %></small>
4
+ </h1>
5
+ <%= form_for [@account, @payment] do |f| %>
6
+ <%= @payment.inspect %>
7
+ <br />
8
+ <%= f.number_field :value, step: 0.01 %>
9
+ <br />
10
+ <%= f.submit %>
11
+ <% end %>
data/config/routes.rb CHANGED
@@ -1,2 +1,8 @@
1
1
  Billing::Engine.routes.draw do
2
+ resources :accounts do
3
+ resources :charges
4
+ resources :modifiers
5
+ resources :payments
6
+ end
7
+ root "application#index"
2
8
  end
@@ -0,0 +1,9 @@
1
+ class CreateBillingAccounts < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_accounts do |t|
4
+ t.references :billable, polymorphic: true, index: true
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreateBillingCharges < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_charges do |t|
4
+ t.belongs_to :account, index: true
5
+ t.references :chargable, polymorphic: true, index: true
6
+ t.money :price
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateBillingDiscounts < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_discounts do |t|
4
+ t.belongs_to :account, index: true
5
+ t.belongs_to :charge
6
+ t.decimal :percent_ratio, precision: 6, scale: 3
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class CreateBillingPayments < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_payments do |t|
4
+ t.belongs_to :account, index: true
5
+ t.money :value
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBillingOrigins < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_origins do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class AddSumariesToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_accounts do |t|
4
+ t.money :charges_sum
5
+ t.money :discounts_sum
6
+ t.money :payments_sum
7
+ t.money :total
8
+ t.money :balance
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class AddFixedValueToBillingDiscount < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_discounts do |t|
4
+ t.money :fixed_value
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ class CreateBillingPaymentTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_payment_types do |t|
4
+ t.string :name
5
+ t.boolean :cash
6
+ t.boolean :fiscal
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBillingTaxGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_tax_groups do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBillingPlus < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_plus do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBillingProfiles < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_profiles do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class RenameBillingDiscountsToModifiers < ActiveRecord::Migration
2
+ def change
3
+ rename_table :billing_discounts, :billing_modifiers
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddSurchargesSumToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_accounts do |t|
4
+ t.money :surcharges_sum
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class AddTypeToBillingPayment < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_payments, :type, :string
4
+ add_column :billing_payments, :payment_type_id, :integer
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddTypeToBillingPaymentType < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_payment_types, :type, :string
4
+ end
5
+ end
data/lib/billing.rb CHANGED
@@ -1,4 +1,20 @@
1
1
  require "billing/engine"
2
+ require "billing/billable"
3
+ require "billing/mapping"
4
+ require "billing/routes"
2
5
 
3
6
  module Billing
7
+ mattr_reader :mappings
8
+ @@mappings = ActiveSupport::OrderedHash.new
9
+
10
+ class << self
11
+ def setup
12
+ yield self
13
+ end
14
+
15
+ def add_mapping(resource, options)
16
+ mapping = Billing::Mapping.new(resource, options)
17
+ @@mappings[mapping.name] = mapping
18
+ end
19
+ end
4
20
  end
@@ -0,0 +1,34 @@
1
+ module Billing
2
+ module Billable
3
+ extend ActiveSupport::Concern
4
+
5
+ def composite_id
6
+ "#{(self.class.try(:base_class) || self.class).send(:name)}##{self.id}"
7
+ end
8
+
9
+ module ClassMethods
10
+ def has_billing(options={})
11
+ payment_types_scope = options.delete(:payment_types)
12
+ has_many :billing_accounts, options.merge(as: :billable).reverse_merge(class_name: 'Billing::Account')
13
+ provide_billing_items(:billing_accounts)
14
+ if options[:as]
15
+ has_many options[:as], options.merge(as: :billable).reverse_merge(class_name: 'Billing::Account')
16
+ provide_billing_items(options[:as])
17
+ end
18
+ if payment_types_scope.present?
19
+ define_method :billing_payment_types do
20
+ payment_types_scope
21
+ end
22
+ end
23
+ end
24
+
25
+ private
26
+ def provide_billing_items(association_name)
27
+ has_many "#{association_name}_charges".intern, class_name: 'Billing::Charge', through: association_name, source: :charges
28
+ has_many "#{association_name}_payments".intern, class_name: 'Billing::Payment', through: association_name, source: :payments
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ ActiveRecord::Base.send :include, Billing::Billable
@@ -1,3 +1,4 @@
1
+ require 'money-rails'
1
2
  module Billing
2
3
  class Engine < ::Rails::Engine
3
4
  isolate_namespace Billing
@@ -0,0 +1,32 @@
1
+ module Billing
2
+ class Mapping
3
+ attr_reader :name, :i_klass, :i_param, :i_find_key, :i_extra_module
4
+ def initialize(resource, options)
5
+ @name = (options[:as] || resource).to_s
6
+
7
+ @i_klass = (options[:billable_type] || name.to_s.classify).to_s.constantize
8
+
9
+ @i_param = options[:billable_param] || "#{name.singularize}_id" #default #{resource}_id
10
+
11
+ # key to find interfaceable in controller, when
12
+ # :uuid then find_by! :uuid => params[:uuid]
13
+ # :shop_uuid then find_by! :uuid => params[:shop_uuid]
14
+ # :shop_id then find_by! :id => params[:shop_id]
15
+ @i_find_key = @i_param[/^(#{resource}_|)(\w+)/,2]
16
+ # FIXME not before schema load
17
+ #raise "#{@i_klass.name} has no method #{@i_find_key}" unless @i_klass.new.respond_to? @i_find_key
18
+ #raise "Did you forget to add 'has_extface_devices' in #{@i_klass.name} ?" unless @i_klass.new.respond_to? :extface_devices
19
+ @i_extra_module = options[:controller_include].to_s.constantize if options[:controller_include].present?
20
+ end
21
+
22
+ def mount_point
23
+ "#{name}_billing"
24
+ end
25
+
26
+ class << self
27
+ def find(fullpath)
28
+ Billing.mappings[fullpath[%r{/(\w+)_billing\/}, 1]]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,16 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+ def billing_for(resource, options = {})
4
+ mapping = Billing.add_mapping(resource, options)
5
+ mount Billing::Engine, at: mapping.mount_point, as: [options[:as],:billing].compact.join('_')
6
+ get "#{mapping.mount_point}/accounts", to: "billing/accounts#index", as: options[:as] ? options[:as].to_s.pluralize.intern : :billing_accounts
7
+ get "#{mapping.mount_point}/accounts/:account_id", to: "billing/accounts#show", as: options[:as] ? options[:as].to_s.singularize.intern : :billing_account
8
+ get "#{mapping.mount_point}/accounts/:account_id/charges", to: "billing/charges#index", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_charges" : :billing_account_charges
9
+ get "#{mapping.mount_point}/accounts/:account_id/charges/new", to: "billing/charges#new", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_new_charge" : :billing_account_new_charge
10
+ get "#{mapping.mount_point}/accounts/:account_id/charges/:charge_id", to: "billing/charges#show", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_charge" : :billing_account_charge
11
+ get "#{mapping.mount_point}/accounts/:account_id/payments", to: "billing/payments#index", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_payments" : :billing_account_payments
12
+ get "#{mapping.mount_point}/accounts/:account_id/payments/new", to: "billing/payments#new", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_new_payment" : :billing_account_new_payment
13
+ get "#{mapping.mount_point}/accounts/:account_id/payments/:payment_id", to: "billing/payments#show", as: options[:as] ? "#{options[:as].to_s.singularize.intern}_payment" : :billing_account_payment
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Billing
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,7 @@
1
+ namespace :billing do
2
+ desc "Billing Install"
3
+ task install: :environment do
4
+ Rake::Task['billing:install:migrations'].invoke
5
+ end
6
+
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ module Billing
4
+ class AccountsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @account = billing_accounts(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ end
13
+
14
+ test "new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+ end
19
+ end