describe IncomeTax::Countries::Ethiopia do
  subject(:result) { described_class.new(income: income, income_type: type) }
  let(:type) { :gross }

  describe "from gross income of 0" do
    let(:income)       { 0                                         }
    its(:rate)         { should be == Rational(0, 1)               }
    its(:gross_income) { should be == 0                            }
    its(:net_income)   { should be == 0                            }
    its(:taxes)        { should be == 0                            }
  end

  describe "from gross income of 1000" do
    let(:income)       { 1000                                      }
    its(:rate)         { should be == Rational(0, 1)               }
    its(:gross_income) { should be == 1000                         }
    its(:net_income)   { should be == 1000                         }
    its(:taxes)        { should be == 0                            }
  end

  describe "from gross income of 10000" do
    let(:income)       { 10000                                     }
    its(:rate)         { should be == Rational(69, 742)            }
    its(:gross_income) { should be == 10000                        }
    its(:net_income)   { should be == 9070                         }
    its(:taxes)        { should be == 930                          }
  end

  describe "from gross income of 100000" do
    let(:income)       { 100000                                    }
    its(:rate)         { should be == Rational(33, 122)            }
    its(:gross_income) { should be == 100000                       }
    its(:net_income)   { should be == 72950                        }
    its(:taxes)        { should be == 27050                        }
  end

  describe "from gross income of 100000000" do
    let(:income)       { 100000000                                 }
    its(:rate)         { should be == Rational(197, 563)           }
    its(:gross_income) { should be == 100000000                    }
    its(:net_income)   { should be == 65007950                     }
    its(:taxes)        { should be == 34992050                     }
  end

  describe "from net income of 0" do
    let(:type)         { :net                                      }
    let(:income)       { 0                                         }
    its(:rate)         { should be == Rational(0, 1)               }
    its(:gross_income) { should be == 0                            }
    its(:net_income)   { should be == 0                            }
    its(:taxes)        { should be == 0                            }
  end

  describe "from net income of 1000" do
    let(:type)         { :net                                      }
    let(:income)       { 1000                                      }
    its(:rate)         { should be == Rational(0, 1)               }
    its(:gross_income) { should be == 1000                         }
    its(:net_income)   { should be == 1000                         }
    its(:taxes)        { should be == 0                            }
  end

  describe "from net income of 10000" do
    let(:type)         { :net                                      }
    let(:income)       { 10000                                     }
    its(:rate)         { should be == Rational(36, 365)            }
    its(:gross_income) { should be == "11094.1176470588235".to_d   }
    its(:net_income)   { should be == 10000                        }
    its(:taxes)        { should be == "1094.11764705882353".to_d   }
  end

  describe "from net income of 100000" do
    let(:type)         { :net                                      }
    let(:income)       { 100000                                    }
    its(:rate)         { should be == Rational(67, 228)            }
    its(:gross_income) { should be == "141615.384615384615".to_d   }
    its(:net_income)   { should be == 100000                       }
    its(:taxes)        { should be == "41615.384615384615".to_d    }
  end

  describe "from net income of 100000000" do
    let(:type)         { :net                                      }
    let(:income)       { 100000000                                 }
    its(:rate)         { should be == Rational(288, 823)           }
    its(:gross_income) { should be == "153833923.076923076".to_d   }
    its(:net_income)   { should be == 100000000                    }
    its(:taxes)        { should be == "53833923.076923077".to_d    }
  end
end
