Пример #1
0
class DescribeRSpecOrdering(Spec):
    def before(self):
        self.m = Mock()

    def it_should_receive_flip_before_flop(self):
        self.m.should_access.flip().once.ordered
        self.m.should_access.flop().once.ordered
        self.m.flip()
        self.m.flop()

    @fails_verification
    def it_should_fail_when_not_receiving_flip_before_flop(self):
        self.m.should_access.flip().once.ordered
        self.m.should_access.flop().once.ordered
        self.m.flop()
        self.m.flip()

    def it_should_receive_one_two_three_in_order(self):
        self.m.should_access.one().ordered
        self.m.should_access.two().ordered
        self.m.should_access.three().ordered

        self.m.one()
        self.m.two()
        self.m.three()

    @fails_verification
    def it_should_fail_when_receiving_one_two_three_not_in_order1(self):
        self.m.should_access.one().ordered
        self.m.should_access.two().ordered
        self.m.should_access.three().ordered

        self.m.two()
        self.m.one()
        self.m.three()

    @fails_verification
    def it_should_fail_when_receiving_one_two_three_not_in_order2(self):
        self.m.should_access.one().ordered
        self.m.should_access.two().ordered
        self.m.should_access.three().ordered

        self.m.two()
        self.m.three()
        self.m.one()

    @fails_verification
    def it_should_fail_when_receiving_one_two_three_not_in_order3(self):
        self.m.should_access.one().ordered
        self.m.should_access.two().ordered
        self.m.should_access.three().ordered

        self.m.one()
        self.m.three()
        self.m.two()

    def it_should_receive_one_two_in_order_but_others_do_not_matter(self):
        self.m.should_access.zero()
        self.m.should_access.one().ordered
        self.m.should_access.two().ordered

        self.m.one()
        self.m.one_and_a_half()
        self.m.zero()
        self.m.two()