source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104212008_add_account_to_customers.rb | Ruby | mit | 191 | main | 200 | # frozen_string_literal: true
class AddAccountToCustomers < ActiveRecord::Migration[6.0]
def change
add_column :customers, :account_id, :integer
add_index :customers, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20220501163825_add_service_name_to_active_storage_blobs.active_storage.rb | Ruby | mit | 191 | main | 623 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return if column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20230815234807_create_bling_order_items.rb | Ruby | mit | 191 | main | 449 | class CreateBlingOrderItems < ActiveRecord::Migration[7.0]
def change
create_table :bling_order_items do |t|
t.string :bling_order_id
t.string :codigo
t.string :unidade
t.integer :quantidade
t.decimal :desconto
t.decimal :valor
t.decimal :aliquotaIPI
t.text :descric... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20210104205220_add_account_to_categories.rb | Ruby | mit | 191 | main | 203 | # frozen_string_literal: true
class AddAccountToCategories < ActiveRecord::Migration[6.0]
def change
add_column :categories, :account_id, :integer
add_index :categories, :account_id
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012214054_create_suppliers.rb | Ruby | mit | 191 | main | 395 | # frozen_string_literal: true
class CreateSuppliers < ActiveRecord::Migration[6.0]
def change
create_table :suppliers do |t|
t.string :name
t.string :cnpj
t.string :email
t.string :cellphone
t.string :phone
t.string :address
t.string :city
t.string :state
t.s... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20190916161728_devise_create_users.rb | Ruby | mit | 191 | main | 1,400 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
t.stri... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240619153849_create_index_good_job_jobs_for_candidate_lookup.rb | Ruby | mit | 191 | main | 657 | # frozen_string_literal: true
class CreateIndexGoodJobJobsForCandidateLookup < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if co... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191012185506_create_customers.rb | Ruby | mit | 191 | main | 281 | # frozen_string_literal: true
class CreateCustomers < ActiveRecord::Migration[6.0]
def change
create_table :customers do |t|
t.string :name
t.string :email
t.string :cellphone
t.string :phone
t.string :cpf
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20240619153850_create_good_job_execution_error_backtrace.rb | Ruby | mit | 191 | main | 455 | # frozen_string_literal: true
class CreateGoodJobExecutionErrorBacktrace < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jo... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20231216192836_create_productions.rb | Ruby | mit | 191 | main | 201 | class CreateProductions < ActiveRecord::Migration[7.0]
def change
create_table :productions do |t|
t.datetime :cut_date
t.datetime :deliver_date
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | db/migrate/20191121004416_create_group_products.rb | Ruby | mit | 191 | main | 270 | # frozen_string_literal: true
class CreateGroupProducts < ActiveRecord::Migration[6.0]
def change
create_table :group_products do |t|
t.references :group, foreign_key: true
t.references :product, foreign_key: true
t.timestamps
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | test/test_helper.rb | Ruby | mit | 191 | main | 511 | # frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
require 'support/test_capybara_helper'
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | test/channels/application_cable/connection_test.rb | Ruby | mit | 191 | main | 307 | # frozen_string_literal: true
require 'test_helper'
module ApplicationCable
class ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | test/support/test_capybara_helper.rb | Ruby | mit | 191 | main | 567 | # frozen_string_literal: true
module TestCapybaraHelper
def select2(value = nil, from: nil)
find(:label, text: from).click
find('.select2-container--focus').click
find('.select2-results__option', text: value, match: :first).click
end
def check_label(locator = nil)
checkbox = find(:checkbox, loca... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | test/models/user_test.rb | Ruby | mit | 191 | main | 918 | # frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# company_name :string
# cpf_cnpj :string
# email :string default(""), not null
# encrypted_password :string ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | test/models/account_test.rb | Ruby | mit | 191 | main | 526 | # frozen_string_literal: true
# == Schema Information
#
# Table name: accounts
#
# id :bigint not null, primary key
# company_name :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint not null
#
# Indexes
#
# index_accoun... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/tasks/remove_bling_order_item_duplication.rake | Ruby | mit | 191 | main | 556 | # frozen_string_literal: true
desc 'Removing BlingOrderItems duplications.'
task remove_bling_order_item_duplication: :environment do
duplicated_ids = []
BlingOrderItem.group(:bling_order_id).count.each do |order_id_counter_array|
duplicated_ids << order_id_counter_array[0] if order_id_counter_array[1] > 1
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/tasks/auto_annotate_models.rake | Ruby | mit | 191 | main | 2,107 | # frozen_string_literal: true
# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
require 'annotate'
task set_annotation_op... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/tasks/update_value_situation_bling_order_items.rake | Ruby | mit | 191 | main | 497 | # frozen_string_literal: true
desc 'Updating values from nil to its real value.'
task update_value_situation_bling_order_items: :environment do
collection_whose_value_is_nil = BlingOrderItem.where(value: nil)
puts "There are #{collection_whose_value_is_nil.length} whose values are nil"
BlingOrderItem.update_y... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/tasks/create_products.rake | Ruby | mit | 191 | main | 440 | # frozen_string_literal: true
desc 'Creating Products...'
task create_products: :environment do
products = []
bling_ids = [1, nil]
100.times do
products << Product.create(FactoryBot.attributes_for(:product, account_id: 1, bling_id: bling_ids.sample)
.merge({ stock_attributes: F... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/forecasts/basic_stock.rb | Ruby | mit | 191 | main | 1,401 | module Forecasts
# This class is simple as it is.
# Born to answer this question:
# "Given I sold 2 items according to their sku in a range of 30 days before today,
# How many products I need to add to my actual stock? Assuming I expect the same demand
# for the next 30 days"
class BasicStock
attr_reade... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/templates/rails/scaffold_controller/controller.rb | Ruby | mit | 191 | main | 1,995 | <% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
before_action :set_<%= singular_table_name %>, only: %i[ show edit update destroy ]
def index
@search = <%= clas... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/templates/test_unit/scaffold/system_test.rb | Ruby | mit | 191 | main | 1,640 | require "application_system_test_case"
<% module_namespacing do -%>
class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
setup do
@<%= singular_table_name %> = <%= fixture_name %>(:one)
end
test "visiting the index" do
visit <%= plural_table_name %>_url
assert_selector "h1", text: "<%= ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | lib/customer/import_customer_csv.rb | Ruby | mit | 191 | main | 251 | class ImportCustomerCSV
include CSVImporter
model Customer
# Maps the csv columns to attributes
column :cellphone
column :cpf
column :email, required: true
column :name
column :phone
column :account_id
identifier :email
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/puma.rb | Ruby | mit | 191 | main | 1,599 | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/application.rb | Ruby | mit | 191 | main | 1,278 | # frozen_string_literal: true
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module AwesomeRails
class Application < Rails::Application
# Initialize configuration defau... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/routes.rb | Ruby | mit | 191 | main | 6,387 | # frozen_string_literal: true
Rails.application.routes.draw do
# mount Sidekiq::Web => '/sidekiq'
mount GoodJob::Engine => 'good_job'
resources :productions do
collection do
get 'missing_pieces'
get 'products_in_production_report'
get 'unpaid_confirmed' # Add this line
get 'price_pe... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/environments/development.rb | Ruby | mit | 191 | main | 9,722 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
Bullet.add_footer... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/environments/production.rb | Ruby | mit | 191 | main | 11,066 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads mos... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/environments/staging.rb | Ruby | mit | 191 | main | 11,085 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads mos... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/environments/test.rb | Ruby | mit | 191 | main | 3,638 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test r... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/cors.rb | Ruby | mit | 191 | main | 495 | # frozen_string_literal: true
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
Rails.applicat... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/sidekiq.rb | Ruby | mit | 191 | main | 476 | # frozen_string_literal: true
# Sidekiq.configure_server do |config|
# config.options = config.options.merge(queues: %w( default active_storage_analysis ), concurrency: ENV.fetch("WORKER_MAX_THREADS") { 5 })
# config.default_worker_options = config.default_worker_options.merge(retry: false)
# end if defined?(Sideki... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/ransack.rb | Ruby | mit | 191 | main | 209 | # frozen_string_literal: true
Ransack.configure do |c|
c.custom_arrows = { up_arrow: '<i class="fa fa-arrow-up fa-xs"></i>',
down_arrow: '<i class="fa fa-arrow-down fa-xs"></i>' }
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/devise.rb | Ruby | mit | 191 | main | 15,275 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/assets.rb | Ruby | mit | 191 | main | 722 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.image... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/content_security_policy.rb | Ruby | mit | 191 | main | 1,170 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.configure do
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/sentry.rb | Ruby | mit | 191 | main | 383 | Sentry.init do |config|
config.dsn = ENV['SENTRY_KEY']
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
config.traces_sample_rate = 1.0
# or
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/new_framework_defaults_7_0.rb | Ruby | mit | 191 | main | 6,136 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file an... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | config/initializers/pagy.rb | Ruby | mit | 191 | main | 10,964 | # frozen_string_literal: true
# Pagy initializer file (5.10.1)
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras
# Pagy DEFAULT Variables
# See https://ddne... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/rails_helper.rb | Ruby | mit | 191 | main | 3,609 | # frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
require 'faker'
require 'factory_bot'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abor... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/spec_helper.rb | Ruby | mit | 191 | main | 5,922 | # frozen_string_literal: true
require 'simplecov'
require 'vcr'
SimpleCov.start
VCR.configure do |c|
c.cassette_library_dir = 'spec/vcr'
c.hook_into :webmock
c.before_record do |interaction|
# https://github.com/vcr/vcr/discussions/887 ways to hide sensitive data.
interaction.request.headers['Authoriza... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/stores.rb | Ruby | mit | 191 | main | 607 | # == Schema Information
#
# Table name: stores
#
# id :bigint not null, primary key
# address :string
# email :string
# name :string
# phone :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_s... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/features.rb | Ruby | mit | 191 | main | 448 | # == Schema Information
#
# Table name: features
#
# id :bigint not null, primary key
# feature_key :integer default(0), not null
# is_enabled :boolean default(FALSE), not null
# name :string not null
# created_at :datetime not null
# updated_at :da... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/tailors.rb | Ruby | mit | 191 | main | 399 | # == Schema Information
#
# Table name: tailors
#
# id :bigint not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_tailors_on_account_id (account_id)
#
FactoryBot.define do
facto... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/account.rb | Ruby | mit | 191 | main | 372 | # frozen_string_literal: true
FactoryBot.define do
factory :account do
company_name { Faker::Company.name }
user_id { create(:user).id }
trait :for_production_tests do
# Add any specific attributes or associations needed for production tests
# For example:
# has_many :productions
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/items.rb | Ruby | mit | 191 | main | 857 | # == Schema Information
#
# Table name: items
#
# id :bigint not null, primary key
# description :string
# discount :decimal(, )
# ipi_tax :decimal(, )
# long_description :string
# quantity :integer
# sku :string
# unity ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/bling_order_items.rb | Ruby | mit | 191 | main | 1,690 | # == Schema Information
#
# Table name: bling_order_items
#
# id :bigint not null, primary key
# aliquotaIPI :decimal(, )
# alteration_date :datetime
# codigo :string
# collected_alteration_date :date
# date :datetime... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/stocks.rb | Ruby | mit | 191 | main | 639 | # == Schema Information
#
# Table name: stocks
#
# id :bigint not null, primary key
# total_balance :integer
# total_virtual_balance :integer
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/production_products.rb | Ruby | mit | 191 | main | 212 | FactoryBot.define do
factory :production_product do
association :production
association :product
quantity { 5 }
pieces_delivered { 0 }
dirty { 0 }
error { 0 }
discard { 0 }
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/categories.rb | Ruby | mit | 191 | main | 454 | # frozen_string_literal: true
# == Schema Information
#
# Table name: categories
#
# id :bigint not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_categories_on_account_id (accou... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/products.rb | Ruby | mit | 191 | main | 1,118 | # frozen_string_literal: true
# == Schema Information
#
# Table name: products
#
# id :bigint not null, primary key
# active :boolean
# bar_code :string
# extra_sku :string
# highlight :boolean
# name :string
# price :float
# sku :string
# created_at :datet... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/sale_product.rb | Ruby | mit | 191 | main | 383 | require_relative '../support/factory_helpers'
FactoryBot.define do
factory :sale_product do
quantity { Faker::Number.between(1, 100) }
value { Faker::Commerce.price }
created_at { Faker::Time.between(from: DateTime.now - 1, to: DateTime.now) }
updated_at { Faker::Time.between(from: DateTime.now - 1, ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/customers.rb | Ruby | mit | 191 | main | 765 | # frozen_string_literal: true
# == Schema Information
#
# Table name: customers
#
# id :bigint not null, primary key
# cellphone :string
# cpf :string
# email :string
# name :string
# phone :string
# created_at :datetime not null
# updated_at :datetime ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/account_features.rb | Ruby | mit | 191 | main | 454 | # == Schema Information
#
# Table name: account_features
#
# id :bigint not null, primary key
# is_enabled :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# feature_id :integer not n... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/bling_data.rb | Ruby | mit | 191 | main | 654 | # == Schema Information
#
# Table name: bling_data
#
# id :bigint not null, primary key
# access_token :string
# expires_at :datetime
# expires_in :integer
# refresh_token :string
# scope :text
# token_type :string
# created_at :datetime not null
# updated_at ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/purchase_products.rb | Ruby | mit | 191 | main | 917 | # frozen_string_literal: true
# == Schema Information
#
# Table name: purchase_products
#
# id :bigint not null, primary key
# quantity :integer
# store_entrance :integer default("Sem_Loja")
# value :float
# created_at :datetime not null
# updated_at ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/sale.rb | Ruby | mit | 191 | main | 700 | # frozen_string_literal: true
require_relative '../support/factory_helpers'
FactoryBot.define do
factory :sale do
store_sale { 0 }
created_at { Faker::Time.between(from: DateTime.now - 1, to: DateTime.now) }
updated_at { Faker::Time.between(from: DateTime.now - 1, to: DateTime.now) }
account_id { cr... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/productions.rb | Ruby | mit | 191 | main | 1,569 | # == Schema Information
#
# Table name: productions
#
# id :bigint not null, primary key
# confirmed :boolean
# consider :boolean default(FALSE)
# cut_date :datetime
# expected_delivery_date :date
# observation :text
# pai... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/shein_orders.rb | Ruby | mit | 191 | main | 375 | # == Schema Information
#
# Table name: shein_orders
#
# id :bigint not null, primary key
# data :jsonb
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
#
# Indexes
#
# index_shein_orders_on_account_id (account_id)
#
FactoryBot.define ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/user.rb | Ruby | mit | 191 | main | 386 | # frozen_string_literal: true
FactoryBot.define do
factory :user do
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
email { Faker::Internet.email }
company_name { Faker::Company.name }
cpf_cnpj { Faker::Company.brazilian_company_number }
phone { Faker::Number.number(... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/revenue_estimations.rb | Ruby | mit | 191 | main | 481 | # == Schema Information
#
# Table name: revenue_estimations
#
# id :bigint not null, primary key
# average_ticket :decimal(, )
# date :date
# quantity :integer
# revenue :decimal(, )
# created_at :datetime not null
# updated_at :datetime not nu... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/factories/bling_module_situations.rb | Ruby | mit | 191 | main | 326 | FactoryBot.define do
factory :bling_module_situation do
sequence(:situation_id) { |n| n }
name { "Situation #{Faker::Lorem.word}" }
module_id { Faker::Number.number(digits: 2).to_i } # Ensure this is an integer
inherited_id { Faker::Number.number(digits: 2) }
color { Faker::Color.hex_color }
en... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/controllers/products_controller_spec.rb | Ruby | mit | 191 | main | 384 | require 'rails_helper'
RSpec.describe ProductsController, type: :controller do
describe 'GET #index' do
let!(:products) { create_list(:product, 3) }
xit 'returns http success' do
get :index
expect(response).to have_http_status(:success)
end
xit 'assigns @products' do
get :index
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/lib/stock_forecasts/basic_stock_spec.rb | Ruby | mit | 191 | main | 2,321 | # frozen_string_literal: true
require 'rails_helper'
require 'forecasts/basic_stock'
RSpec.describe ::Forecasts::BasicStock do
include_context 'when user account'
let(:sku) { 'VEST' }
let(:product) { FactoryBot.create(:product, sku: sku, account_id: user.account.id) }
let(:order) { FactoryBot.create(:bling_or... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/lib/customer/import_customer_spec.rb | Ruby | mit | 191 | main | 1,601 | # frozen_string_literal: true
require 'csv'
require 'customer/import_customer_csv'
describe 'ImportCustomerCSV' do
let(:customer) { create(:customer) }
it 'creates customers by importing a valid csv file' do
Tempfile.open(['customers.csv', '.csv']) do |temp|
CSV.open(temp, 'wb', col_sep: ';', headers... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/routing/stores_routing_spec.rb | Ruby | mit | 191 | main | 959 | require "rails_helper"
RSpec.describe StoresController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/stores").to route_to("stores#index")
end
it "routes to #new" do
expect(get: "/stores/new").to route_to("stores#new")
end
it "routes to #show" do
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/routing/shein_orders_routing_spec.rb | Ruby | mit | 191 | main | 1,060 | require "rails_helper"
RSpec.describe SheinOrdersController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/shein_orders").to route_to("shein_orders#index")
end
it "routes to #new" do
expect(get: "/shein_orders/new").to route_to("shein_orders#new")
end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/routing/tailors_routing_spec.rb | Ruby | mit | 191 | main | 976 | require "rails_helper"
RSpec.describe TailorsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/tailors").to route_to("tailors#index")
end
it "routes to #new" do
expect(get: "/tailors/new").to route_to("tailors#new")
end
it "routes to #show" d... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/routing/productions_routing_spec.rb | Ruby | mit | 191 | main | 1,044 | require "rails_helper"
RSpec.describe ProductionsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/productions").to route_to("productions#index")
end
it "routes to #new" do
expect(get: "/productions/new").to route_to("productions#new")
end
it... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/bling_order_items_helper_spec.rb | Ruby | mit | 191 | main | 474 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingOrderItemsHelper, type: :helper do
describe '#link_to_external_bling_order' do
context 'when bling_order_id is present' do
it 'has complete link to external target blank tag' do
expect(helper.link_to_external_bling_order('123... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/productions_helper_spec.rb | Ruby | mit | 191 | main | 448 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the ProductionsHelper. For example:
#
# describe ProductionsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# en... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/tailors_helper_spec.rb | Ruby | mit | 191 | main | 436 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the TailorsHelper. For example:
#
# describe TailorsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# en... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/revenue_estimations_helper_spec.rb | Ruby | mit | 191 | main | 469 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the RevenueEstimationsHelper. For example:
#
# describe RevenueEstimationsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this t... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/shein_orders_helper_spec.rb | Ruby | mit | 191 | main | 448 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SheinOrdersHelper. For example:
#
# describe SheinOrdersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# en... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/stores_helper_spec.rb | Ruby | mit | 191 | main | 991 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the StoresHelper. For example:
#
# describe StoresHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/locales_helper_spec.rb | Ruby | mit | 191 | main | 436 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the LocalesHelper. For example:
#
# describe LocalesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# en... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/helpers/bling_order_item_histories_helper_spec.rb | Ruby | mit | 191 | main | 515 | # frozen_string_literal: true
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the BlingOrderItemHistoriesHelper. For example:
#
# describe BlingOrderItemHistoriesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.con... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/daily_canceled_order_job_spec.rb | Ruby | mit | 191 | main | 1,327 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe DailyCanceledOrderJob, type: :job do
let(:user) { FactoryBot.create(:user) }
let(:date) { Date.new(2023, 11, 22) }
let(:alteration_date) { Date.new(2023, 12, 14) }
let(:situation_id) { BlingOrderItem::Status::PENDING }
let(:bling_order_id) ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/bling_order_item_creator_job_spec.rb | Ruby | mit | 191 | main | 727 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingOrderItemCreatorJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
FactoryBot.create(:bling_d... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/current_done_bling_order_item_job_spec.rb | Ruby | mit | 191 | main | 2,097 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe CurrentDoneBlingOrderItemJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
allow(Date).to receive... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/verified_bling_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,648 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe VerifiedBlingOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
allow(Date).to receive(:... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/stock_sync_job_spec.rb | Ruby | mit | 191 | main | 432 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe StockSyncJob, type: :job do
describe '#perform' do
include_context 'when user account'
before { FactoryBot.create(:product) }
it 'creates stock' do
VCR.use_cassette('bling_stocks', erb: true) do
expect do
descri... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/printed_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,192 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe PrintedOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
BlingOrderItem.destroy_all
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/bling_order_item_destroyer_job_spec.rb | Ruby | mit | 191 | main | 1,226 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingOrderItemDestroyerJob, type: :job do
include_context 'with bling token'
let(:found_bling_order_id) { '19178587026' }
let(:bling_order_item) { FactoryBot.create(:bling_order_item, account_id: user.account.id) }
describe '#perform' do
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/collected_bling_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,357 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe CollectedBlingOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
allow(Date).to receive(:tod... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/checked_bling_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,717 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe CheckedBlingOrderItemsJob, type: :job do
BlingOrderItem.destroy_all
let(:user) { FactoryBot.create(:user) }
describe '#perform' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/weekly_canceled_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,702 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe WeeklyCanceledOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
FactoryBot.create(:blin... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/canceled_bling_order_item_job_spec.rb | Ruby | mit | 191 | main | 1,476 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe CanceledBlingOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
FactoryBot.create(:bling... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/in_progress_order_items_job_spec.rb | Ruby | mit | 191 | main | 1,485 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe InProgressOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
FactoryBot.create(:bling_da... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/jobs/pending_order_items_job_spec.rb | Ruby | mit | 191 | main | 2,522 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe PendingOrderItemsJob, type: :job do
let(:user) { FactoryBot.create(:user) }
describe '#perform_now' do
before do
allow_any_instance_of(BlingOrderItem).to receive(:synchronize_items).and_return(true)
FactoryBot.create(:bling_datum... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/support/request_helper.rb | Ruby | mit | 191 | main | 294 | # frozen_string_literal: true
module RequestHelper
def body_json(symbolize_key: false)
json = JSON.parse(response.body)
symbolize_key ? json.symbolize_keys : json
rescue StandardError
{}
end
end
RSpec.configure do |config|
config.include RequestHelper, type: :request
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/support/factory_helpers.rb | Ruby | mit | 191 | main | 540 | # frozen_string_literal: true
module FactoryHelpers
def self.upload_file(src, content_type, binary = false)
path = Rails.root.join(src)
original_filename = ::File.basename(path)
content = File.open(path).read
tempfile = Tempfile.open(original_filename)
tempfile.write content
tempfile.rewind
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/support/shared_contexts/accountable.rb | Ruby | mit | 191 | main | 499 | # frozen_string_literal: true
require 'spec_helper'
shared_context 'when user account' do
let(:user) { FactoryBot.create(:user) }
before { FactoryBot.create(:bling_datum, account_id: user.account.id) }
end
shared_context 'with bling token' do
let(:user) { FactoryBot.create(:user) }
before { FactoryBot.crea... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/support/shared_contexts/product.rb | Ruby | mit | 191 | main | 358 | # frozen_string_literal: true
require 'spec_helper'
shared_context 'when skip synchronize_stock callback' do
before do
Product.skip_callback(:save, :after, :synchronize_stock)
end
after do
Product.set_callback(:save, :after, :synchronize_stock)
end
end
shared_context 'with product' do
let(:product... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/support/shared_contexts/feature_bling.rb | Ruby | mit | 191 | main | 308 | require 'spec_helper'
shared_context 'with bling feature' do
let(:feature_bling) { FactoryBot.create(:feature, feature_key: FeatureKey::BLING_INTEGRATION, is_enabled: true) }
before do
user.account.features << feature_bling
user.account.account_features.first.update(is_enabled: true)
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/account_feature_spec.rb | Ruby | mit | 191 | main | 949 | # == Schema Information
#
# Table name: account_features
#
# id :bigint not null, primary key
# is_enabled :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# feature_id :integer not n... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/purchase_product_spec.rb | Ruby | mit | 191 | main | 1,324 | # frozen_string_literal: true
# == Schema Information
#
# Table name: purchase_products
#
# id :bigint not null, primary key
# quantity :integer
# store_entrance :integer default("Sem_Loja")
# value :float
# created_at :datetime not null
# updated_at ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/sale_spec.rb | Ruby | mit | 191 | main | 1,171 | # frozen_string_literal: true
# == Schema Information
#
# Table name: sales
#
# id :bigint not null, primary key
# disclosure :boolean
# discount :float
# exchange :boolean default(FALSE)
# online :boolean
# order_code ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/stock_spec.rb | Ruby | mit | 191 | main | 7,679 | # == Schema Information
#
# Table name: stocks
#
# id :bigint not null, primary key
# total_balance :integer
# total_virtual_balance :integer
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.