Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Porting to Spree 1.0.0 (part 1)

  • Loading branch information...
commit c57f7f1728015c43ce21dd730818288c235ce80f 1 parent 9770155
@biow0lf authored
View
17 .gitignore
@@ -1,9 +1,10 @@
-*.gem
-.bundle
-.rvmrc
+\#*
+*~
+.#*
.DS_Store
-Gemfile.lock
-pkg/*
-test/dummy
-test/dummy_hooks/after_migrate.rb
-rerun.txt
+.idea
+.project
+tmp
+nbproject
+*.swp
+spec/dummy
View
1  .rspec
@@ -0,0 +1 @@
+--colour
View
2  app/models/product_decorator.rb
@@ -1,4 +1,4 @@
-Product.class_eval do
+Spree::Product.class_eval do
has_one :supplier_product, :dependent => :destroy
has_one :supplier, :through => :supplier_product
View
2  app/models/user_decorator.rb
@@ -1,4 +1,4 @@
-User.class_eval do
+Spree::User.class_eval do
has_one :supplier
def has_supplier?
View
0  ...nerators/templates/db/migrate/create_suppliers.rb → db/migrate/20110507000000_create_suppliers.rb
File renamed without changes
View
0  .../templates/db/migrate/create_supplier_products.rb → ...igrate/20110507000001_create_supplier_products.rb
File renamed without changes
View
0  ...s/templates/db/migrate/create_drop_ship_orders.rb → db/migrate/20110510000000_create_drop_ship_orders.rb
File renamed without changes
View
0  ...mplates/db/migrate/create_drop_ship_line_items.rb → ...ate/20110510000001_create_drop_ship_line_items.rb
File renamed without changes
View
9 db/migrate/20110823000000_add_supplier_to_line_items.rb
@@ -0,0 +1,9 @@
+class AddSupplierToLineItems < ActiveRecord::Migration
+ def self.up
+ add_column :spree_line_items, :supplier_id, :integer
+ end
+
+ def self.down
+ remove_column :spree_line_items, :supplier_id
+ end
+end
View
8 db/migrate/20120219165955_prefix_table_names.rb
@@ -0,0 +1,8 @@
+class PrefixTableNames < ActiveRecord::Migration
+ def change
+ rename_table :suppliers, :spree_suppliers
+ rename_table :supplier_products, :spree_supplier_products
+ rename_table :drop_ship_orders, :spree_drop_ship_orders
+ rename_table :drop_ship_line_items, :spree_drop_ship_line_items
+ end
+end
View
9 lib/generators/templates/db/migrate/add_supplier_to_line_items.rb
@@ -1,9 +0,0 @@
-class AddSupplierToLineItems < ActiveRecord::Migration
- def self.up
- add_column :line_items, :supplier_id, :integer
- end
-
- def self.down
- remove_column :line_items, :supplier_id
- end
-end
View
5 script/rails
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+ENGINE_PATH = File.expand_path('../..', __FILE__)
+load File.expand_path('../../spec/dummy/script/rails', __FILE__)
View
8 spec/models/spree/product_spec.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe Spree::Product do
+ it { should have_one(:supplier_product).dependent(:destroy) }
+ it { should have_one(:supplier).through(:supplier_product) }
+
+ it { should respond_to :has_supplier? }
+end
View
7 spec/models/spree/user_spec.rb
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+describe Spree::User do
+ it { should have_one :supplier }
+
+ it { should respond_to :has_supplier? }
+end
View
32 spec/spec_helper.rb
@@ -0,0 +1,32 @@
+# Configure Rails Environment
+ENV["RAILS_ENV"] = "test"
+
+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[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
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+end
View
8 test/unit/product_test.rb
@@ -1,8 +0,0 @@
-require_relative '../test_helper'
-
-class ProductTest < ActiveSupport::TestCase
-
- should have_one(:supplier_product)
- should have_one(:supplier)
-
-end
View
9 test/unit/user_test.rb
@@ -1,9 +0,0 @@
-require_relative '../test_helper'
-
-class UserTest < ActiveSupport::TestCase
- should have_one(:supplier)
-
- should "respond to has_supplier?" do
- assert subject.respond_to?(:has_supplier?)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.