Permalink
Browse files

Porting to Spree 1.0.0 (part 1)

  • Loading branch information...
1 parent 9770155 commit c57f7f1728015c43ce21dd730818288c235ce80f @biow0lf committed Feb 19, 2012
View
@@ -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
@@ -0,0 +1 @@
+--colour
@@ -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
@@ -1,4 +1,4 @@
-User.class_eval do
+Spree::User.class_eval do
has_one :supplier
def has_supplier?
@@ -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
@@ -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
@@ -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
@@ -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__)
@@ -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
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+describe Spree::User do
+ it { should have_one :supplier }
+
+ it { should respond_to :has_supplier? }
+end
View
@@ -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
@@ -1,8 +0,0 @@
-require_relative '../test_helper'
-
-class ProductTest < ActiveSupport::TestCase
-
- should have_one(:supplier_product)
- should have_one(:supplier)
-
-end
@@ -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

0 comments on commit c57f7f1

Please sign in to comment.