Skip to content

Instantly share code, notes, and snippets.

source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
require 'date'
module Bonobos
COLORS = ["brown", "khaki", "olive", "almond", "arizona wash", "ayr", "biscuit", "black", "black ink", "blueberry", "bubble gum", "charcoal", "collage", "cosmic rocks wash", "cosmos", "dove wings", "fade", "geranium", "grey", "heather grey", "ice wash", "jac's jean", "jac's jean with destroy", "la brea tar pits", "little fishes", "look stripe", "marine", "melon", "navy", "nightshade", "poppy", "snow", "stripe", "teacup", "unicorn", "water ice", "wave wash", "white"]
WAISTS = ["24", "25", "26", "27", "28", "30", "31", "29", "32", "34", "36", "38", "40"]
LENGTHS = ["32", "34", "25", "27", "28", "29", "30"]
NUMBER_OF_VARIANTS = 131
Spree::Core::Engine.routes.draw do
namespace :api, defaults: { format: 'json' } do
resources :orders do
end
end
end
@HoyaBoya
HoyaBoya / gist:8184856
Created December 30, 2013 17:06
Spree Functional Test
require 'spec_helper'
describe Spree::Api::OrdersController do
render_views
let(:user) { create(:user) }
before(:each) do
warden = double(:warden, user: user, authenticate: user)
controller.stub(:env).and_return({'warden' => warden})
@HoyaBoya
HoyaBoya / gist:8184734
Last active January 1, 2016 18:38
Spree Commerce Route Test
require 'spec_helper'
describe Spree::Api::OrdersController do
routes { Spree::Core::Engine.routes }
describe "PUT /api/orders/:id/apply_coupon" do
it "should route" do
expect(:put => "/api/orders/123/apply_coupon_code?coupon_code=X").to route_to(
controller: 'spree/api/orders',
@HoyaBoya
HoyaBoya / gist:8149374
Created December 27, 2013 16:38
Working route test for Spree API....
require 'spec_helper'
describe Spree::Api::OrdersController do
# This is required for Rspec route_to to work!
routes { Spree::Core::Engine.routes }
describe "GET /api/orders/mine" do
it "should route" do
expect(:get => "/api/orders/mine").to route_to(
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
Spree::Admin::ReportsController.class_eval do
add_available_report! :some_report
def some_report
# do something
end
end
@HoyaBoya
HoyaBoya / migration_create_user.rb
Last active December 19, 2015 00:29
I'm trying to understand Active Record again....
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :email
t.string :first_name
t.string :last_name
t.timestamps
end
add_index :users, :email, unique: true
@HoyaBoya
HoyaBoya / index.html.erb
Created June 26, 2013 15:14
Remembering functional testing in Rails....
<h1>Welcome#index</h1>
<p>Find me in app/views/welcome/index.html.erb</p>
<p>Hello <%= @first_name %> <%= @last_name %></p>