Created
September 9, 2015 21:43
-
-
Save pacoguevara/c982185304a331e4f65d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe CatEmpresa, :type => :model do | |
describe "class methods" do | |
describe ".cat_empresa_array_by_invoices" do | |
# Aqui crear una empresa y varias facturas con esa empresa | |
before(:each) do | |
@tipo_cambio = FactoryGirl.create(:tipo_cambio) | |
end | |
context "when there are invoices between 2 companies" do | |
it "returns an array of cat_empresas ids for concepts" do | |
cat_empresas_array = CatEmpresa.cat_empresa_array_by_invoices(@empresa, @invoices) | |
expect(cat_empresas_array.count).to eql 4 | |
end | |
end | |
end | |
describe ".cat_empresa_by_invoices" do | |
# Aqui crear una empresa y varias facturas con esa empresa | |
before(:each) do | |
@tipo_cambio = FactoryGirl.create(:tipo_cambio) | |
end | |
context "when there are invoices between 2 companies" do | |
it "returns CatEmpresa instance of the more frequent tag" do | |
cat_empresa = CatEmpresa.cat_empresa_by_invoices(@empresa, @invoices) | |
expect(cat_empresa.id).to eql 1 | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe Factura, :type => :model do | |
describe "class methods" do | |
describe ".add_cat_empresa_to_invoice" do | |
# Crear una factura y una CatEmpresa | |
before(:each) do | |
@tipo_cambio = FactoryGirl.create(:tipo_cambio) | |
end | |
context "when an invoice is tagged" do | |
it "returns an invoice tagged" do | |
invoice = Factura.add_cat_empresa_to_invoice(@invoice, @cat_empresa) | |
expect(invoice.id).to eql @invoice.id | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment