Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

almost-complete upgrade to spree 1.0. Preparing to merge w/ the pull …

…request just merged from danmorin
  • Loading branch information...
commit 043f13fb6c3ea1b97aa404c601293566c5fc8e98 1 parent 5b1b5a4
@jsqu99 jsqu99 authored
View
13 Gemfile
@@ -0,0 +1,13 @@
+source 'http://rubygems.org'
+
+group :test do
+ gem 'ffaker'
+end
+
+if RUBY_VERSION < "1.9"
+ gem "ruby-debug"
+else
+ gem "ruby-debug19"
+end
+
+gemspec
View
6 Rakefile
@@ -3,13 +3,11 @@ require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'
require 'rspec/core/rake_task'
-require 'cucumber/rake/task'
-require 'spree_core/testing_support/common_rake'
+require 'spree/core/testing_support/common_rake'
RSpec::Core::RakeTask.new
-Cucumber::Rake::Task.new
-task :default => [:spec, :cucumber ]
+task :default => [:spec]
spec = eval(File.read('spree_reuse_credit_card.gemspec'))
View
2  app/assets/javascripts/store/spree_reuse_credit_card.js
@@ -5,7 +5,7 @@
function displayCreditCardDeleteStatus(notice) {
notice_div = $('.flash.notice');
- if notice {
+ if (notice) {
if (notice_div.length > 0) {
notice_div.html(notice);
notice_div.show();
View
0  ...trollers/checkout_controller_decorator.rb → ...rs/spree/checkout_controller_decorator.rb
File renamed without changes
View
7 app/controllers/creditcards_controller.rb → ...ntrollers/spree/creditcards_controller.rb
@@ -1,11 +1,12 @@
-class CreditcardsController < Spree::BaseController
+module Spree
+ class CreditcardsController < Spree::BaseController
- respond_to :json
+ respond_to :json
def destroy
@creditcard = Spree::Creditcard.find(params["id"])
authorize! :destroy, @creditcard
-
+
# TODO: think about the necessity of deleting payment profiles here.
# I'm thinking we want to always leave them alone
View
2  ...controllers/users_controller_decorator.rb → ...llers/spree/users_controller_decorator.rb
@@ -1,8 +1,8 @@
require 'card_reuse'
+
module Spree
UsersController.class_eval do
include CardReuse
- helper 'spree/admin/navigation'
before_filter :load_existing_cards, :only => :show
View
10 app/helpers/creditcards_helper.rb → app/helpers/spree/creditcards_helper.rb
@@ -1,12 +1,14 @@
-module CreditcardsHelper
- def link_to_delete_credit_card(card)
- # <%# passing in an explicit 'url' here let's us make use of this 'admin' helper and bypass the object_url %>
- # <%# (from resourcec_ontroller) that is embedded in the helper %>
+module Spree
+ module CreditcardsHelper
+ def link_to_delete_credit_card(card)
+ # <%# passing in an explicit 'url' here let's us make use of this 'admin' helper and bypass the object_url %>
+ # <%# (from resourcec_ontroller) that is embedded in the helper %>
%(link_to_delete card, {
:url => main_app.creditcard_url(card),
:dataType => 'json',
:success => "function(r){ jQuery('##{dom_id card}').fadeOut('hide'); displayCreditCardDeleteStatus(#{t(:creditcard_successfully_removed)}); }",
:failure => "function(r){ displayCreditCardDeleteStatus(#{t(:creditcard_not_removed)}); }"} )
+ end
end
end
View
0  app/models/creditcard_decorator.rb → app/models/spree/creditcard_decorator.rb
File renamed without changes
View
2  app/overrides/add_credit_card_list_to_payment_form.rb
@@ -2,5 +2,5 @@
:name => 'add_credit_card_list_to_payment_form',
:virtual_path => 'spree/checkout/payment/_gateway',
:insert_before => '[data-hook=card_number]',
- :partial =>'checkout/payment/existing_cards'
+ :partial =>'spree/checkout/payment/existing_cards'
)
View
2  app/overrides/add_credit_card_list_to_user_account_form.html.rb
@@ -2,5 +2,5 @@
:name => 'add_credit_card_list_to_user_account_form',
:virtual_path => 'spree/users/show',
:insert_after => '[data-hook=account_my_orders]',
- :partial =>'users/card_admin'
+ :partial =>'spree/users/card_admin'
)
View
0  ...checkout/payment/_existing_cards.html.erb → ...checkout/payment/_existing_cards.html.erb
File renamed without changes
View
0  app/views/shared/_card_destroy.js.erb → app/views/spree/shared/_card_destroy.js.erb
File renamed without changes
View
0  app/views/users/_card_admin.html.erb → app/views/spree/users/_card_admin.html.erb
File renamed without changes
View
2  config/routes.rb
@@ -1,3 +1,3 @@
-Rails.application.routes.draw do
+Spree::Core::Engine.routes.draw do
resources :creditcards
end
View
1  lib/credit_card_ability.rb
@@ -3,7 +3,6 @@ class CreditCardAbility
include CanCan::Ability
def initialize(user)
-# binding.pry
can :manage, Spree::Creditcard do |cc|
cc.payments.joins(:order).
where("spree_orders.user_id" => user.id).
View
2  lib/generators/spree_reuse_credit_card/install/install_generator.rb
@@ -21,7 +21,7 @@ def run_migrations
if res == "" || res.downcase == "y"
run 'bundle exec rake db:migrate'
else
- puts "Skiping rake db:migrate, don't forget to run it!"
+ puts "Skipping rake db:migrate, don't forget to run it!"
end
end
end
View
4 lib/spree_reuse_credit_card/engine.rb
@@ -14,10 +14,6 @@ def self.activate
Rails.application.config.cache_classes ? require(c) : load(c)
end
- Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
- Rails.application.config.cache_classes ? require(c) : load(c)
- end
-
# Yeah, I know. Probably wrong place for this
# There are problems putting it in other places as well
# (re-educate me if I'm thoroughly confused (which I am))
View
9 spec/spec_helper.rb
@@ -1,15 +1,16 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
-
-require File.expand_path("../../../config/environment.rb", __FILE__)
-
+require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
+
+# Requires factories defined in spree_core
+require 'spree/core/testing_support/factories'
RSpec.configure do |config|
# == Mock Framework
View
15 spree_reuse_credit_card.gemspec
@@ -2,9 +2,9 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_reuse_credit_card'
- s.version = '1.0.0.beta'
- s.summary = 'Add gem summary here'
- s.description = 'Add (optional) gem description here'
+ s.version = '1.0.0'
+ s.summary = 'Enables view enhancements for managing multiple previously-used credit cards for Spree'
+ s.description = 'Enables view enhancements for managing multiple previously-used credit cards for Spree'
s.required_ruby_version = '>= 1.8.7'
s.author = 'Jeff Squires'
@@ -17,7 +17,12 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'
- s.add_dependency 'spree_core', '>= 1.0.0'
- s.add_development_dependency 'rspec-rails'
+ s.add_dependency 'spree_core', '~> 1.0.0'
+
+ s.add_development_dependency 'capybara', '1.0.1'
+ s.add_development_dependency 'factory_girl'
+ s.add_development_dependency 'ffaker'
+ s.add_development_dependency 'rspec-rails', '~> 2.7'
+ s.add_development_dependency 'sqlite3'
end
Please sign in to comment.
Something went wrong with that request. Please try again.