Permalink
Browse files

Minor speedups to specs. And added a tool to time each spec.

  • Loading branch information...
1 parent a538320 commit d195ded46b40b90654f2288563b83448de0a2e47 @jimlindstrom committed Apr 14, 2012
View
@@ -2,5 +2,6 @@
require "bundler/gem_tasks"
task :test do
+ sh "if git status | grep 'modified:' | grep annual_report >/dev/null; then echo \"\n\nYou should get rid of ~/.finmodeling\"; fi"
sh "rspec -c -fd -I. -Ispec spec/*spec.rb"
end
View
@@ -1,10 +1,10 @@
-Bump the schema versions (e.g., in 10K and 10Q reports)
Try to figure out why the change in equity is not equal to comprehensive income, in cases where we know it.
- Some 10k's (and even some 10q's?) have Statements of SE
- When they don't:
- Some 10q's have AOCI broken out on BS. We can look for deltas
- Some 10q's have disclosures that list components of OCI or CI
- The remaining residual is probably stock-based compensation expense
+ - minority interests makes it screwey. also, preferred dividends?
Reformulated Statement of Shareholder Equity
@@ -53,10 +53,9 @@ def balance_sheet
def income_statement
if @income_stmt.nil?
calculations=@taxonomy.callb.calculation
- inc_stmt = calculations.find{ |x| (x.clean_downcased_title =~ /statement.*operations/) or
- (x.clean_downcased_title =~ /statement[s]*.*of.*earnings/) or
- (x.clean_downcased_title =~ /statement[s]*.*of.*income/) or
- (x.clean_downcased_title =~ /statement[s]*.*of.*net.*income/) }
+ inc_stmt = calculations.find{ |x| (x.clean_downcased_title =~ /statement(|s).*operations/) or
+ (x.clean_downcased_title =~ /statement(|s).*of.*earnings/) or
+ (x.clean_downcased_title =~ /statement(|s).*of.*(|net.*)income/) }
if inc_stmt.nil?
raise RuntimeError.new("Couldn't find income statement in: " + calculations.map{ |x| "\"#{x.clean_downcased_title}\"" }.join("; "))
end
@@ -6,14 +6,9 @@
before(:all) do
company = FinModeling::Company.new(FinModeling::Mocks::Entity.new)
filing_url = company.annual_reports.last.link
- FinModeling::Config::disable_caching
@filing = FinModeling::AnnualReportFiling.download(filing_url)
end
- after(:all) do
- FinModeling::Config::enable_caching
- end
-
subject { @filing }
its(:balance_sheet) { should be_a FinModeling::BalanceSheetCalculation }
its(:income_statement) { should be_a FinModeling::IncomeStatementCalculation }
@@ -29,7 +24,9 @@
context "when the report has a statement of shareholders' equity" do
before(:all) do
filing_url = "http://www.sec.gov/Archives/edgar/data/315189/000110465910063219/0001104659-10-063219-index.htm"
+ FinModeling::Config::disable_caching
@filing = FinModeling::AnnualReportFiling.download filing_url
+ FinModeling::Config::enable_caching
end
subject { @filing }
@@ -5,9 +5,7 @@
describe FinModeling::EquityChangeCalculation do
before(:all) do
deere_2011_annual_rpt = "http://www.sec.gov/Archives/edgar/data/315189/000110465910063219/0001104659-10-063219-index.htm"
- FinModeling::Config::disable_caching
@filing = FinModeling::AnnualReportFiling.download(deere_2011_annual_rpt)
- FinModeling::Config::enable_caching
@ses_period = @filing.shareholder_equity_statement.periods.last
@equity_changes = @filing.shareholder_equity_statement.equity_change_calculation
@@ -6,12 +6,9 @@
before(:all) do
company = FinModeling::Company.new(FinModeling::Mocks::Entity.new)
filing_url = company.quarterly_reports.last.link
- FinModeling::Config::disable_caching
+ FinModeling::Config::disable_caching
@filing = FinModeling::QuarterlyReportFiling.download(filing_url)
- end
-
- after(:all) do
- FinModeling::Config::enable_caching
+ FinModeling::Config::enable_caching
end
subject { @filing }
@@ -21,25 +18,10 @@
context "when the report doesn't have a statement of shareholders' equity" do
its(:has_a_shareholder_equity_statement?) { should be_false }
- #its(:shareholder_equity_statement) { should be_nil } ## should raise an error
its(:is_valid?) { should == [@filing.income_statement,
@filing.balance_sheet,
@filing.cash_flow_statement].all?{|x| x.is_valid?} }
end
- #context "when the report has a statement of shareholders' equity" do
- # before(:all) do
- # filing_url = "http://www.sec.gov/Archives/edgar/data/789019/000119312511115186/0001193125-11-115186-index.htm"
- # @filing = FinModeling::CompanyFiling.download filing_url
- # end
- # subject { @filing }
- #
- # its(:has_a_shareholder_equity_statement?) { should be_true }
- # its(:shareholder_equity_statement) { should be_a FinModeling::EquityStatementCalculation }
- # its(:is_valid?) { should == [@filing.income_statement,
- # @filing.balance_sheet,
- # @filing.cash_flow_statement,
- # @filing.shareholder_equity_statement].all?{|x| x.is_valid?} }
- #end
context "after write_constructor()ing it to a file and then eval()ing the results" do
before(:all) do

0 comments on commit d195ded

Please sign in to comment.