Skip to content

Instantly share code, notes, and snippets.

@bhserna
Created December 17, 2016 01:28
Show Gist options
  • Save bhserna/4284c4f5c361e2c9b636d11a13b489dd to your computer and use it in GitHub Desktop.
Save bhserna/4284c4f5c361e2c9b636d11a13b489dd to your computer and use it in GitHub Desktop.
def portfolio_with(attrs)
FakePortfolio.new(attrs)
end
class FakePortfolio
attr_reader :projects_with_investment, :principal_invested,
:current_value, :generated_value, :value_of_received_payments,
:count_of_received_payments
def initialize(attrs)
@projects_with_investment = attrs[:projects_with_investment] || []
@principal_invested = attrs[:principal_invested] || 0
@current_value = attrs[:current_value] || 0
@generated_value = attrs[:generated_value] || 0
@value_of_received_payments = attrs[:value_of_received_payments] || 0
@count_of_received_payments = attrs[:count_of_received_payments] || 0
end
def has_current_value_with_adjustment?
end
end
describe "fake portfolio implements investments value interface" do
subject { portfolio_with({}) }
it_behaves_like "investments value interface"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment