class WhenAnActionMethodIsNotSoAmbiguous: @classmethod def examples_of_not_so_ambiguous_action_names(self): def method_with_because_and_when_in_the_name(): pass yield method_with_because_and_when_in_the_name def method_with_when_and_since_in_the_name(self): pass yield method_with_when_and_since_in_the_name def method_with_since_and_after_in_the_name(self): pass yield method_with_since_and_after_in_the_name def method_with_after_and_because_in_the_name(self): pass yield method_with_after_and_because_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_an_action(self): assert self.result is ACTION
class WhenASetupMethodIsNotSoAmbiguous: @classmethod def examples_of_not_so_ambiguous_setup_names(self): def method_with_establish_and_context_in_the_name(): pass yield method_with_establish_and_context_in_the_name def method_with_context_and_given_in_the_name(): pass yield method_with_context_and_given_in_the_name def method_with_given_and_establish_in_the_name(): pass yield method_with_given_and_establish_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_setup(self): assert self.result is SETUP
class WhenAMethodContainsAKeywordAsPartOfAWord: @classmethod @examples def examples_of_methods_with_it_in_part_of_a_word(self): def itinerary(self): pass yield itinerary def given_an_identifier(self): self.identifier = NameBasedIdentifier() def when_i_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_ignore_it(self): assert self.result is None
class WhenIdentifyingATeardownMethod: @classmethod def examples_of_legal_teardown_names(self): def method_with_cleanup_in_the_name(): pass yield method_with_cleanup_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_a_teardown(self): assert self.result is TEARDOWN
class WhenAnExamplesMethodIsNotSoAmbiguous: @classmethod def examples_of_not_so_ambiguous_examples_names(self): def method_with_example_and_data_in_the_name(): pass yield method_with_example_and_data_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) @assertion def it_should_identify_it_as_examples(self): assert self.result is EXAMPLES
class WhenIdentifyingATeardownMethod: @classmethod def examples_of_legal_teardown_names(self): def method_with_cleanup_in_the_name(): pass yield method_with_cleanup_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method( self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_a_teardown(self): assert self.result is TEARDOWN
class WhenAnExamplesMethodIsNotSoAmbiguous: @classmethod def examples_of_not_so_ambiguous_examples_names(self): def method_with_example_and_data_in_the_name(): pass yield method_with_example_and_data_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method( self, method): self.result = self.identifier.identify_method(method) @assertion def it_should_identify_it_as_examples(self): assert self.result is EXAMPLES
class WhenIdentiyingANormalMethod: @classmethod def examples_of_uninteresting_names(self): def an_innocuous_function(self): pass yield an_innocuous_function def another_method(self): pass yield another_method def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_ignore_it(self): assert self.result is None
class WhenIdentiyingANormalMethod: @classmethod def examples_of_uninteresting_names(self): def an_innocuous_function(self): pass yield an_innocuous_function def another_method(self): pass yield another_method def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method( self, method): self.result = self.identifier.identify_method(method) def it_should_ignore_it(self): assert self.result is None
class WhenAnAssertionMethodIsNotSoAmbiguous: @classmethod def examples_of_not_so_ambiguous_assertion_names(self): def method_with_it_and_should_in_the_name(): pass yield method_with_it_and_should_in_the_name def method_with_should_and_then_in_the_name(self): pass yield method_with_should_and_then_in_the_name def method_with_then_and_must_in_the_name(self): pass yield method_with_then_and_must_in_the_name def method_with_must_and_will_in_the_name(self): pass yield method_with_must_and_will_in_the_name def method_with_will_and_it_in_the_name(self): pass yield method_with_will_and_it_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method( self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_an_assertion(self): assert self.result is ASSERTION
class WhenIdentifyingAnAssertionMethod: @classmethod def examples_of_legal_assertion_names(self): def method_with_it_in_the_name(): pass yield method_with_it_in_the_name def method_with_should_in_the_name(self): pass yield method_with_should_in_the_name def method_with_then_in_the_name(self): pass yield method_with_then_in_the_name def method_with_must_in_the_name(self): pass yield method_with_must_in_the_name def method_with_will_in_the_name(self): pass yield method_with_will_in_the_name def establish(self): self.identifier = NameBasedIdentifier() def because_the_framework_asks_the_plugin_to_identify_the_method(self, method): self.result = self.identifier.identify_method(method) def it_should_identify_it_as_an_assertion(self): assert self.result is ASSERTION