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 | spec/models/account_spec.rb | Ruby | mit | 191 | main | 1,288 | # == 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_accounts_on_user_id (user_id)
#
# Fo... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/revenue_estimation_spec.rb | Ruby | mit | 191 | main | 1,395 | # frozen_string_literal: true
# == 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_... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/category_spec.rb | Ruby | mit | 191 | main | 827 | # 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/models/shein_order_spec.rb | Ruby | mit | 191 | main | 448 | # == 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)
# data :json
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/customer_spec.rb | Ruby | mit | 191 | main | 1,271 | # 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/models/production_spec.rb | Ruby | mit | 191 | main | 9,197 | # == Schema Information
#
# Table name: productions
#
# id :bigint not null, primary key
# confirmed :boolean
# consider :boolean default(FALSE)
# cut_date :datetime
# expected_delivery_date :date
# fabric_cost :decimal(10,... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/feature_spec.rb | Ruby | mit | 191 | main | 471 | # == 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/models/sale_product_spec.rb | Ruby | mit | 191 | main | 851 | # == Schema Information
#
# Table name: sale_products
#
# id :bigint not null, primary key
# quantity :integer
# value :float
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
# product_id :bigint
# sale_id :bigint
#
# Indexes
#
# ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/user_spec.rb | Ruby | mit | 191 | main | 1,234 | # == 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 default(""), not null
# fir... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/bling_module_situation_spec.rb | Ruby | mit | 191 | main | 1,351 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingModuleSituation, type: :model do
describe 'validations' do
subject { build(:bling_module_situation) }
it { should validate_presence_of(:situation_id) }
it { should validate_uniqueness_of(:situation_id) }
it { should validate_p... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/tailor_spec.rb | Ruby | mit | 191 | main | 1,077 | # == 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)
#
require 'rails_helper'
RSpe... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/bling_order_item_spec.rb | Ruby | mit | 191 | main | 15,165 | # == Schema Information
#
# Table name: bling_order_items
#
# id :bigint not null, primary key
# aliquotaIPI :decimal(, )
# alteration_date :datetime
# city :string(10485760)
# codigo :string
# collected_alteration_da... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/store_spec.rb | Ruby | mit | 191 | main | 461 | # == 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/models/bling_datum_spec.rb | Ruby | mit | 191 | main | 1,027 | # == 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/models/payment_spec.rb | Ruby | mit | 191 | main | 1,821 | require 'rails_helper'
RSpec.describe Payment, type: :model do
let(:account) { create(:account) }
let(:tailor) { create(:tailor, account: account) }
let(:production) { create(:production, account: account, tailor: tailor) }
describe 'associations' do
it { should belong_to(:production) }
end
describe ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/product_spec.rb | Ruby | mit | 191 | main | 6,386 | # 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/models/item_spec.rb | Ruby | mit | 191 | main | 1,004 | # == 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/models/services/product/count_quantity_spec.rb | Ruby | mit | 191 | main | 551 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Product::CountQuantity, type: :services do
context 'when call the service' do
include_context 'with product'
include_context 'when user account'
let(:purchase_product) { create(:purchase_product, product:, account: user.accoun... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/product/duplicate_spec.rb | Ruby | mit | 191 | main | 415 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Product::Duplicate, type: :services do
context 'when call the service' do
let(:product) { create(:product) }
it 'change for copy name' do
result = described_class.call(product: product)
expect(Product.last.sku).to eq(... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/product/update_status_spec.rb | Ruby | mit | 191 | main | 554 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Product::UpdateStatus, type: :services do
context 'when call the service' do
let(:product) { create(:product) }
it 'change status active true to active false' do
result = described_class.call(product: product)
expect(... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/bling/order_spec.rb | Ruby | mit | 191 | main | 2,519 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Bling::Order, type: :services do
let!(:bling_datum) { FactoryBot.create(:bling_datum, account_id: 1) }
let(:order_command) { 'find_orders' }
let(:situation) { 15 }
describe '#call' do
context 'when given number of page in optio... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/bling/update_order_status_spec.rb | Ruby | mit | 191 | main | 774 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Bling::UpdateOrderStatus, type: :service do
include_context 'with bling token'
let(:collected_order_id) { 19_436_662_536 }
let(:collected_status) { 173_631 }
let(:order) { FactoryBot.create(:bling_order_item, bling_order_id: collect... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/bling/product_spec.rb | Ruby | mit | 191 | main | 2,137 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Bling::Product, type: :services do
let(:product_command) { 'find_products' }
describe '#call' do
before { FactoryBot.create(:bling_datum, account_id: 1) }
context 'when given number of page in options' do
before { allow(... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/models/services/bling/stock_spec.rb | Ruby | mit | 191 | main | 1,412 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Services::Bling::Stock, type: :services do
let(:stock_command) { 'find_stocks' }
describe '#call' do
before { FactoryBot.create(:bling_datum, account_id: 1) }
context 'when filtering by bling_product_id' do
let(:options) { { idsPr... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/decorators/error_decorator_spec.rb | Ruby | mit | 191 | main | 494 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe ErrorDecorator do
let(:purchase_product) { FactoryBot.build(:purchase_product, quantity: 0) }
let(:pretty_message) do
purchase_product.valid?
purchase_product.errors.full_messages.join(', ')
end
describe '#full_messages' do
befor... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/decorators/bling_order_item_decorator_spec.rb | Ruby | mit | 191 | main | 3,119 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingOrderItemDecorator, type: :decorator do
let(:bling_order) { FactoryBot.create(:bling_order_item) }
let(:bling_order_id) { bling_order.bling_order_id }
let(:bling_order_decorated) { bling_order.decorate }
describe '#title' do
it 'dec... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/decorators/product_decorator_spec.rb | Ruby | mit | 191 | main | 914 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe ProductDecorator, type: :decorator do
subject(:product_decorated) { product.decorate }
let(:long_sku) { 'ADFSKJDFSKJHG-KJHLKJFHG-ASLKJFHJ-ASKJFHJ-AKLSJDFHAKSLJFH' }
let(:truncated_sku) { 'ADFSKJDFSKJHG-KJ...' }
let(:short_sku) { 'SHORTDESCRI... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/shein_orders/edit.html.erb_spec.rb | Ruby | mit | 191 | main | 430 | require 'rails_helper'
RSpec.describe "shein_orders/edit", type: :view do
let(:shein_order) {
SheinOrder.create!(
data: ""
)
}
before(:each) do
assign(:shein_order, shein_order)
end
it "renders the edit shein_order form" do
render
assert_select "form[action=?][method=?]", shein_o... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/shein_orders/new.html.erb_spec.rb | Ruby | mit | 191 | main | 365 | require 'rails_helper'
RSpec.describe "shein_orders/new", type: :view do
before(:each) do
assign(:shein_order, SheinOrder.new(
data: ""
))
end
it "renders new shein_order form" do
render
assert_select "form[action=?][method=?]", shein_orders_path, "post" do
assert_select "input[nam... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/shein_orders/show.html.erb_spec.rb | Ruby | mit | 191 | main | 259 | require 'rails_helper'
RSpec.describe "shein_orders/show", type: :view do
before(:each) do
assign(:shein_order, SheinOrder.create!(
data: ""
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/stores/new.html.erb_spec.rb | Ruby | mit | 191 | main | 615 | require 'rails_helper'
RSpec.describe "stores/new", type: :view do
before(:each) do
assign(:store, Store.new(
name: "MyString",
address: "MyString",
phone: "MyString",
email: "MyString",
account_id: create(:account).id
))
end
it "renders new store form" do
render
a... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/stores/edit.html.erb_spec.rb | Ruby | mit | 191 | main | 496 | require 'rails_helper'
RSpec.describe "stores/edit", type: :view do
before(:each) do
@store = assign(:store, create(:store))
end
it "renders the edit store form" do
render
assert_select "form[action=?][method=?]", store_path(@store), "post" do
assert_select "input[name=?]", "store[name]"
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/stores/index.html.erb_spec.rb | Ruby | mit | 191 | main | 800 | require 'rails_helper'
RSpec.describe "stores/index", type: :view do
before(:each) do
assign(:stores, [
Store.create!(
name: "Name",
address: "Address",
phone: "Phone",
email: "Email",
account: create(:account)
),
Store.create!(
name: "Name",
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/stores/show.html.erb_spec.rb | Ruby | mit | 191 | main | 353 | require 'rails_helper'
RSpec.describe "stores/show", type: :view do
before(:each) do
@store = assign(:store, create(:store))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Name/)
expect(rendered).to match(/Address/)
expect(rendered).to match(/Phone/)
expect(rende... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/views/devise/sessions/new.html.erb_spec.rb | Ruby | mit | 191 | main | 789 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'devise/sessions/new.html.erb', type: :view do
include Capybara::DSL
context 'when sign in is successful' do
let!(:user) { FactoryBot.create(:user) }
it 'greet the user' do
visit root_path
fill_in 'user_email', with: user.e... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/orders_control_spec.rb | Ruby | mit | 191 | main | 720 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'orders control' do
context 'when show orders control' do
before do
get show_orders_control_path
end
it 'is a successful response' do
expect(response).to have_http_status(:found)
end
end
context 'when show orders p... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/tailors_spec.rb | Ruby | mit | 191 | main | 4,179 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to test the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/home_spec.rb | Ruby | mit | 191 | main | 3,702 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'home' do
describe 'get root_path' do
let(:user) { FactoryBot.create(:user) }
context 'with feature bling' do
let(:feature_bling) { FactoryBot.create(:feature, feature_key: FeatureKey::BLING_INTEGRATION, is_enabled: true) }
be... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/shein_bling_order_items_spec.rb | Ruby | mit | 191 | main | 310 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'SheinBlingOrderItems', type: :request do
include_context 'with user signed in'
describe 'GET /index' do
before { get shein_bling_order_items_path }
it 'is success' do
expect(response).to be_successful
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/bling_order_items_spec.rb | Ruby | mit | 191 | main | 5,002 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Stocks', type: :request do
include_context 'with user signed in'
describe 'GET /index' do
before do
FactoryBot.create_list(:bling_order_item, 2, account_id: user.account.id)
end
context 'when authorized' do
include_cont... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/productions_spec.rb | Ruby | mit | 191 | main | 4,427 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to test the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/bling_datas_spec.rb | Ruby | mit | 191 | main | 1,109 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'BlingData', type: :request do
describe 'GET index' do
include_context 'with user signed in'
context 'when authorized' do
include_context 'with bling feature'
it 'has successfully response' do
get bling_data_path
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/suppliers_spec.rb | Ruby | mit | 191 | main | 291 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Suppliers', type: :request do
include_context 'with user signed in'
describe 'GET /suppliers' do
it 'is success' do
get suppliers_url
expect(response).to have_http_status(:success)
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/stores_spec.rb | Ruby | mit | 191 | main | 4,023 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to test the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/locales_spec.rb | Ruby | mit | 191 | main | 261 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe "Locales", type: :request do
describe "GET /set_locale" do
it "returns http found" do
get set_locale_path
expect(response).to have_http_status(:found)
end
end
end |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/revenue_estimations_spec.rb | Ruby | mit | 191 | main | 2,482 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'RevenueEstimations', type: :request do
let(:user) { FactoryBot.create(:user) }
describe 'GET /index' do
before do
sign_in user
get revenue_estimations_path
end
it 'is success' do
expect(response).to be_successful
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/stocks_spec.rb | Ruby | mit | 191 | main | 1,248 | # # frozen_string_literal: true
# require 'rails_helper'
# RSpec.describe 'Stocks', type: :request do
# let(:user) { FactoryBot.create(:user) }
# let(:product) { FactoryBot.create(:product, account_id: user.account.id) }
# before do
# # Mock Pagy to avoid pagination issues in tests
# allow_any_instance... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/products_spec.rb | Ruby | mit | 191 | main | 3,183 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Product' do
describe 'DELETE /product/:id' do
include_context 'with user signed in'
let!(:product) { FactoryBot.create(:product, account_id: user.account.id) }
context 'when product has neither sales nor purchase associated to it' do... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/purchase_products_spec.rb | Ruby | mit | 191 | main | 1,780 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'PurchaseProduct' do
describe 'POST purchase_products_path' do
include_context 'with user signed in'
let!(:product) { FactoryBot.create(:product, account_id: user.account.id) }
context 'when valid' do
it 'creates purchase produc... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/customers_spec.rb | Ruby | mit | 191 | main | 4,420 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Customers', type: :request do
let(:valid_params) { FactoryBot.attributes_for(:customer) }
describe 'GET /customers' do
include_context 'with user signed in'
context 'when feature bling' do
include_context 'with bling feature'
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/bling_order_item_histories_spec.rb | Ruby | mit | 191 | main | 1,894 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'BlingOrderItemHistories', type: :request do
let(:user) { FactoryBot.create(:user) }
let(:params) do
{ bling_order: { initial_date: (Date.today - 1.day).strftime,
final_date: Date.today.strftime } }
end
before do
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/dashboards_spec.rb | Ruby | mit | 191 | main | 575 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Dashboards', type: :request do
describe 'GET /others_status' do
include_context 'with user signed in'
let(:feature_bling) { FactoryBot.create(:feature, feature_key: FeatureKey::BLING_INTEGRATION, is_enabled: true) }
before do
us... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/requests/sale_products_spec.rb | Ruby | mit | 191 | main | 1,498 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'SaleProduct' do
describe 'POST /sale_products/new' do
include_context 'with user signed in'
let!(:product) { FactoryBot.create(:product, account_id: user.account.id) }
context 'when valid' do
it 'creates purchase product' do
... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/presenters/bling_order_item_histories_presenter_spec.rb | Ruby | mit | 191 | main | 1,176 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe BlingOrderItemHistoriesPresenter do
describe '#initialize' do
it 'raises argument error' do
expect { described_class.new }.to raise_exception(ArgumentError)
end
end
describe '#presentable' do
context 'when there is not collec... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | spec/reports/daily_revenue_report_spec.rb | Ruby | mit | 191 | main | 3,044 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe DailyRevenueReport do
describe '#initialize' do
it 'raises argument error' do
expect { described_class.new }.to raise_exception(ArgumentError)
end
end
describe '#presentable' do
context 'when there is not collection' do
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | locomotivecms_wagon.gemspec | Ruby | mit | 191 | master | 1,955 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'locomotive/wagon/version'
Gem::Specification.new do |gem|
gem.name = 'locomotivecms_wagon'
gem.version = Locomotive::Wagon::VERSION
gem.authors = ['Didier Laf... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | Rakefile | Ruby | mit | 191 | master | 636 | #!/usr/bin/env rake
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'rake'
require 'vcr'
require 'rspec'
require 'rspec/core/rake_task'
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'locomotive/wagon'
require 'locomotive/wagon/version'
# === Gems install tasks ===
Bundler::Ge... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | Gemfile | Ruby | mit | 191 | master | 1,454 | source 'https://rubygems.org'
# Specify your gem's dependencies in locomotivecms_wagon.gemspec
gemspec
# Mac OS X
gem 'rb-fsevent', '~> 0.10.3', require: 'rb-fsevent' if RUBY_PLATFORM.include?('darwin')
# Unix
gem 'therubyracer', require: 'v8', platforms: :ruby unless RUBY_PLATFORM.include?('darwin')
gem 'rb-inotif... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon.rb | Ruby | mit | 191 | master | 5,627 | require_relative 'wagon/exceptions'
require 'oj'
module Locomotive
module Wagon
DEFAULT_PLATFORM_URL = 'https://station.locomotive.works'.freeze
# Authenticate an user to the Hosting platform.
# If the user does not exist, then create an account for her/him.
# At the end, store the API key in the ~... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/cli.rb | Ruby | mit | 191 | master | 19,323 | require 'thor'
require 'thor/runner'
module Locomotive
module Wagon
module CLI
module CheckPath
protected
# Check if the path given in option ('.' by default) points to a Locomotive
# site. It is also possible to pass a path other than the one from the options.
#
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/clone_command.rb | Ruby | mit | 191 | master | 903 | require 'active_support'
require 'active_support/core_ext'
module Locomotive::Wagon
class CloneCommand < Struct.new(:name, :path, :options, :shell)
def self.clone(name, path, options, shell)
new(name, path, options, shell).clone
end
def clone
# create an empty site with the minimal setting... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_command.rb | Ruby | mit | 191 | master | 1,617 | require 'locomotive/common'
require_relative '../tools/styled_yaml'
require_relative 'loggers/pull_logger'
require_relative_all 'concerns'
require_relative 'pull_sub_commands/pull_base_command'
require_relative_all 'pull_sub_commands'
module Locomotive::Wagon
class PullCommand < Struct.new(:env, :path, :... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/init_command.rb | Ruby | mit | 191 | master | 404 | module Locomotive::Wagon
class InitCommand < Struct.new(:generator_klass, :args, :options)
def self.generate(klass, args, options)
new(klass, args, options).generate
end
def generate
args, opts = Thor::Options.split(self.args)
generator = generator_klass.new(args, opts, {})
gen... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/sync_command.rb | Ruby | mit | 191 | master | 1,637 | require 'locomotive/common'
require_relative '../tools/styled_yaml'
require_relative 'loggers/sync_logger'
require_relative_all 'concerns'
require_relative 'sync_sub_commands/concerns/base_concern'
require_relative 'pull_sub_commands/pull_base_command'
require_relative_all 'pull_sub_commands'
require_re... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_command.rb | Ruby | mit | 191 | master | 6,755 | require 'locomotive/steam'
require_relative 'loggers/push_logger'
require_relative_all 'concerns'
require_relative_all '../decorators/concerns'
require_relative_all '../decorators'
require_relative '../tools/glob'
require_relative 'push_sub_commands/push_base_command'
require_relative_all 'push_sub_com... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/serve_command.rb | Ruby | mit | 191 | master | 5,672 | module Locomotive::Wagon
SiteFinder = Struct.new(:repository, :request) { def find; repository.first; end; }
class ServeCommand < Struct.new(:path, :options, :shell)
def initialize(path, options, shell)
super(path, options || {}, shell)
@parent_id = nil
end
def self.start(path, options =... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/generate_command.rb | Ruby | mit | 191 | master | 604 | module Locomotive::Wagon
class GenerateCommand < Struct.new(:name, :args, :options)
def self.generate(name, args, options)
new(name, args, options).generate
end
def generate
Locomotive::Wagon.require_misc_gems
generator = generator_klass.new(args, options, { behavior: :skip })
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/authenticate_command.rb | Ruby | mit | 191 | master | 1,671 | require_relative 'concerns/api_concern'
require_relative 'concerns/netrc_concern'
module Locomotive::Wagon
class AuthenticateCommand < Struct.new(:platform_url, :email, :password, :shell)
include ApiConcern
include NetrcConcern
def self.authenticate(platform_url, email, password, shell)
self.new... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/delete_command.rb | Ruby | mit | 191 | master | 2,507 | require_relative 'concerns/api_concern'
require_relative 'concerns/deploy_file_concern'
require 'active_support/inflector'
module Locomotive::Wagon
class DeleteCommand < Struct.new(:env, :path, :resource, :identifier, :shell)
include ApiConcern
include DeployFileConcern
SITE_RESOURCE = 'site'
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb | Ruby | mit | 191 | master | 567 | module Locomotive::Wagon
class PullThemeAssetsCommand < PullBaseCommand
def _pull
api_client.theme_assets.all.each do |asset|
write_theme_asset(asset)
end
end
def write_theme_asset(asset)
binary = get_asset_binary(asset.url)
if %w(javascript stylesheet).include?(asset.c... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_site_command.rb | Ruby | mit | 191 | master | 3,595 | module Locomotive::Wagon
class PullSiteCommand < PullBaseCommand
def _pull
attributes = current_site.attributes.slice(
'name', 'locales', 'domains', 'timezone', 'seo_title',
'meta_keywords', 'meta_description', 'picture_thumbnail_url',
'metafields', 'metafields_schema', 'metafields... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_content_assets_command.rb | Ruby | mit | 191 | master | 500 | module Locomotive::Wagon
class PullContentAssetsCommand < PullBaseCommand
def _pull
api_client.content_assets.all.each do |asset|
write_content_asset(asset)
end
end
def write_content_asset(asset)
binary = get_asset_binary(asset.url)
write_to_file(content_asset_filepath(a... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb | Ruby | mit | 191 | master | 705 | module Locomotive::Wagon
class PullSnippetsCommand < PullBaseCommand
def _pull
locales.each do |locale|
api_client.snippets.all(locale).each do |snippet|
write_snippet(snippet, locale)
end
end
end
def write_snippet(snippet, locale = nil)
if (template = snippe... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_base_command.rb | Ruby | mit | 191 | master | 2,218 | require_relative './concerns/assets_concern'
module Locomotive::Wagon
class PullBaseCommand < Struct.new(:api_client, :current_site, :path, :env)
include Locomotive::Wagon::AssetsConcern
def self.pull(api_client, current_site, path, env)
new(api_client, current_site, path, env).pull
end
def... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_content_types_command.rb | Ruby | mit | 191 | master | 2,077 | module Locomotive::Wagon
class PullContentTypesCommand < PullBaseCommand
def _pull
api_client.content_types.all.each do |content_type|
write_content_type(content_type)
end
end
def write_content_type(content_type)
yaml = dump(yaml_attributes(content_type), inline: %w(public_sub... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_content_entries_command.rb | Ruby | mit | 191 | master | 3,377 | module Locomotive::Wagon
class PullContentEntriesCommand < PullBaseCommand
def _pull
fetch_content_types do |content_type|
# delete the previous file
reset_file(content_entry_filepath(content_type))
instrument :writing, label: content_type.name
fetch_content_entries(conte... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_pages_command.rb | Ruby | mit | 191 | master | 1,628 | module Locomotive::Wagon
class PullPagesCommand < PullBaseCommand
attr_reader :fullpaths
def _pull
@fullpaths = {}
locales.each do |locale|
api_client.pages.all(locale).each do |page|
fullpaths[page._id] = page.fullpath if locale == default_locale
write_page(page, l... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb | Ruby | mit | 191 | master | 643 | module Locomotive::Wagon
class PullTranslationsCommand < PullBaseCommand
def _pull
translations = api_client.translations.all.inject({}) do |hash, translation|
translation.values.delete_if { |locale, _| !locales.include?(locale) }
hash[translation.key] = translation.values
hash
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/pull_sections_command.rb | Ruby | mit | 191 | master | 506 | module Locomotive::Wagon
class PullSectionsCommand < PullBaseCommand
def _pull
api_client.sections.all.each do |section|
write_section(section)
end
end
def write_section(section)
write_to_file(section_filepath(section), <<-FRONT_MATTER
#{section.definition.to_yaml}
---
#{secti... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/pull_sub_commands/concerns/assets_concern.rb | Ruby | mit | 191 | master | 2,834 | require 'tempfile'
require 'benchmark'
require_relative '../../../tools/yaml_ext.rb'
module Locomotive::Wagon
module AssetsConcern
REGEX = /((https?:\/\/\S+)?\/sites\/[0-9a-f]{24}\/(assets|pages|theme|content_entry[0-9a-f]{24})\/(([^;.\"]+)\/)*([a-zA-Z_\-0-9.%]+)(\?\w+)?)/
# The content assets on the rem... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/sync_sub_commands/sync_pages_command.rb | Ruby | mit | 191 | master | 2,386 | require 'neatjson'
module Locomotive::Wagon
class SyncPagesCommand < PullPagesCommand
include Locomotive::Wagon::BaseConcern
def write_page(page, locale = nil)
instrument :writing, label: "#{page.fullpath} (#{locale})"
filepath = data_path(page, locale)
return if page.fullpath =~ /^lay... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb | Ruby | mit | 191 | master | 939 | module Locomotive::Wagon
class SyncSiteCommand < PullSiteCommand
include Locomotive::Wagon::BaseConcern
def _sync
attributes = current_site.attributes.slice('name', 'timezone', 'seo_title', 'meta_keywords', 'meta_description', 'robots_txt', 'metafields', 'sections_content')
locales.each_with_i... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/sync_sub_commands/sync_translations_command.rb | Ruby | mit | 191 | master | 507 | module Locomotive::Wagon
class SyncTranslationsCommand < PullTranslationsCommand
include Locomotive::Wagon::BaseConcern
private
def write_translations(translations)
write_to_file(translations_filepath, JSON.neat_generate(translations, {
sort: true, short: false, padding: 1, object_paddin... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/sync_sub_commands/concerns/base_concern.rb | Ruby | mit | 191 | master | 601 | require 'active_support/concern'
module Locomotive::Wagon
module BaseConcern
extend ActiveSupport::Concern
included do
alias :_sync :_pull
end
module ClassMethods
def sync(api_client, current_site, path, env)
new(api_client, current_site, path, env).sync
end
end
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/loggers/pull_logger.rb | Ruby | mit | 191 | master | 390 | require_relative 'base_logger'
module Locomotive::Wagon
class PullLogger < BaseLogger
def initialize
subscribe :start do |event|
log "\n"
log "Pulling #{event.payload[:name].camelcase}", { color: :black, background: :white }
end
end
private
def subscribe(action = nil,... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/loggers/base_logger.rb | Ruby | mit | 191 | master | 644 | module Locomotive::Wagon
class BaseLogger
private
def log(message, color = nil, ident = nil, print = false)
ident = ' ' * (ident || 0)
message = "#{ident}#{message.gsub("\n", "\n" + ident)}"
message = message.colorize(color) if color
if print
print message
else
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/loggers/push_logger.rb | Ruby | mit | 191 | master | 1,138 | require_relative 'base_logger'
module Locomotive::Wagon
class PushLogger < BaseLogger
def initialize
subscribe 'site_created' do |event|
log "We created your site with the following handle: #{event.payload[:site].handle}", { mode: :bold }
end
subscribe :start do |event|
log "... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/loggers/sync_logger.rb | Ruby | mit | 191 | master | 607 | require_relative 'base_logger'
module Locomotive::Wagon
class SyncLogger < BaseLogger
def initialize
subscribe :start do |event|
log "\n"
log "Syncing #{event.payload[:name].camelcase}", { color: :black, background: :white }
end
subscribe :writing do |event|
log "writ... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/netrc_concern.rb | Ruby | mit | 191 | master | 371 | require 'netrc'
module Locomotive::Wagon
module NetrcConcern
def write_credentials_to_netrc(host, email, api_key)
netrc = Netrc.read
netrc[host] = email, api_key
netrc.save
end
def read_credentials_from_netrc(host)
if entry = Netrc.read[host]
{ email: entry.login, api_k... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/instrumentation_concern.rb | Ruby | mit | 191 | master | 368 | module Locomotive::Wagon
module InstrumentationConcern
def instrument(action, payload = {})
ActiveSupport::Notifications.instrument(instrument_scope_name(action), payload)
end
def instrument_scope_name(action)
name = self.class.name[/::(\w+)Command$/, 1].underscore
['wagon', name, act... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/steam_concern.rb | Ruby | mit | 191 | master | 700 | require 'locomotive/coal'
module Locomotive::Wagon
module SteamConcern
def steam_services
return @steam_services if @steam_services
Locomotive::Steam.configure do |config|
config.mode = :test
config.adapter = { name: :filesystem, path: path, env: options[:env]&.to_... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/spinner_concern.rb | Ruby | mit | 191 | master | 809 | module Locomotive::Wagon
module SpinnerConcern
# http://stackoverflow.com/questions/10262235/printing-an-ascii-spinning-cursor-in-the-console
def show_wait_spinner(sentence = nil, fps = 10)
chars = %w[| / - \\]
delay = 1.0/fps
iter = 0
spinner = Thread.new do
print sentence... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/deploy_file_concern.rb | Ruby | mit | 191 | master | 810 | require 'locomotive/coal'
module Locomotive::Wagon
module DeployFileConcern
def write_deploy_settings(env, path, settings)
File.open(deploy_file(path), 'a+') do |f|
f.write({ env => settings }.to_yaml.sub(/^---/, ''))
end
settings
end
def read_deploy_settings(env, path)
... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/concerns/api_concern.rb | Ruby | mit | 191 | master | 1,592 | require 'locomotive/coal'
module Locomotive::Wagon
module ApiConcern
# Instance of the API client to request an account or his/her list of sites.
def api_client
@api_client ||= Locomotive::Coal::Client.new(api_uri, api_credentials)
end
# Instance of the API client to request resources of a s... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb | Ruby | mit | 191 | master | 2,718 | require 'tempfile'
module Locomotive::Wagon
class PushThemeAssetsCommand < PushBaseCommand
def entities
repositories.theme_asset.all.map do |entity|
next if skip?(entity)
decorated = ThemeAssetDecorator.new(entity)
end.compact.sort { |a, b| a.priority <=> b.priority }
end
d... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb | Ruby | mit | 191 | master | 2,250 | module Locomotive::Wagon
class PushBaseCommand < Struct.new(:api_client, :steam_services, :content_assets_pusher, :remote_site, :filter)
extend Forwardable
def_delegators :steam_services, :current_site, :locale, :repositories
def self.push(api_client, steam_services, content_assets_pusher, remote_site... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_content_assets_command.rb | Ruby | mit | 191 | master | 1,357 | require 'tempfile'
module Locomotive::Wagon
class PushContentAssetsCommand < PushBaseCommand
def initialize(api_client, steam_services)
super(api_client, steam_services, nil)
end
def decorate(local_path)
ContentAssetDecorator.new(File.join(path, 'public', local_path))
end
def pers... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_sections_command.rb | Ruby | mit | 191 | master | 431 | module Locomotive::Wagon
class PushSectionsCommand < PushBaseCommand
def entities
repositories.section.all
end
def decorate(entity)
SectionDecorator.new(entity, content_assets_pusher)
end
def persist(decorated_entity)
api_client.sections.update(decorated_entity.slug, decorate... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_content_types_command.rb | Ruby | mit | 191 | master | 1,517 | module Locomotive::Wagon
class PushContentTypesCommand < PushBaseCommand
attr_reader :step
alias_method :default_push, :_push
def _push
%i(without_relationships only_relationships).each do |step|
@step = step
default_push
end
end
def entities
repositories.con... |
github | locomotivecms/wagon | https://github.com/locomotivecms/wagon | lib/locomotive/wagon/commands/push_sub_commands/push_snippets_command.rb | Ruby | mit | 191 | master | 439 | module Locomotive::Wagon
class PushSnippetsCommand < PushBaseCommand
def entities
repositories.snippet.all
end
def decorate(entity)
SnippetDecorator.new(entity, locale, content_assets_pusher)
end
def persist(decorated_entity)
api_client.snippets.update(decorated_entity.slug, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.