spec/support/account_shared_examples.rb in plutus-0.12.2 vs spec/support/account_shared_examples.rb in plutus-0.13

- old
+ new

@@ -3,32 +3,32 @@ let(:account) { FactoryGirl.create(elements[:kind], contra: contra)} subject { account } describe "class methods" do subject { account.class } - its(:balance) { should be_kind_of(BigDecimal) } + its(:balance) { is_expected.to be_kind_of(BigDecimal) } describe "trial_balance" do it "should raise NoMethodError" do - lambda { subject.trial_balance }.should raise_error NoMethodError + expect { subject.trial_balance }.to raise_error NoMethodError end end end describe "instance methods" do - its(:balance) { should be_kind_of(BigDecimal) } + its(:balance) { is_expected.to be_kind_of(BigDecimal) } it "reports a balance with date range" do - account.balance(:from_date => "2014-01-01", :to_date => Date.today).should be_kind_of(BigDecimal) + expect(account.balance(:from_date => "2014-01-01", :to_date => Date.today)).to be_kind_of(BigDecimal) end - it { should respond_to(:credit_entries) } - it { should respond_to(:debit_entries) } + it { is_expected.to respond_to(:credit_entries) } + it { is_expected.to respond_to(:debit_entries) } end it "requires a name" do account.name = nil - account.should_not be_valid + expect(account).not_to be_valid end # Figure out which way credits and debits should apply if elements[:normal_balance] == :debit debit_condition = :> @@ -38,23 +38,23 @@ debit_condition = :< end describe "when given a debit" do before { FactoryGirl.create(:debit_amount, account: account) } - its(:balance) { should be.send(debit_condition, 0) } + its(:balance) { is_expected.to be.send(debit_condition, 0) } describe "on a contra account" do let(:contra) { true } - its(:balance) { should be.send(credit_condition, 0) } + its(:balance) { is_expected.to be.send(credit_condition, 0) } end end describe "when given a credit" do before { FactoryGirl.create(:credit_amount, account: account) } - its(:balance) { should be.send(credit_condition, 0) } + its(:balance) { is_expected.to be.send(credit_condition, 0) } describe "on a contra account" do let(:contra) { true } - its(:balance) { should be.send(debit_condition, 0) } + its(:balance) { is_expected.to be.send(debit_condition, 0) } end end end