Share
Embed
Transcript
193 slides
-
Why hate to write test? * Protect our code. Saturday,
November 23, 13 -
Why hate to write test? * Hard to think about
how to start. * Protect our code. Saturday, November 23, 13 -
Why hate to write test? * Hard to think about
how to start. * It is painful, can’t keep on going. * Protect our code. Saturday, November 23, 13 -
Why hate to write test? * Hard to think about
how to start. * It is painful, can’t keep on going. * Protect our code. Write test after implementation! Saturday, November 23, 13 -
Why hate to write test? * Hard to think about
how to start. * It is painful, can’t keep on going. * Protect our code. Write test after implementation! It is not TDD. Saturday, November 23, 13 -
Something behind that * Hard to think about how to
write it. * It is painful, can’t keep on going. Saturday, November 23, 13 -
Something behind that * Hard to think about how to
write it. * It is painful, can’t keep on going. * Write it Step by Step, test reflect your design structure. Saturday, November 23, 13 -
Something behind that * Hard to think about how to
write it. * It is painful, can’t keep on going. * It is a signal about your bad design. * Write it Step by Step, test reflect your design structure. Saturday, November 23, 13 -
Why need OO design? * Code is unclearly. * Hard
to understand. Saturday, November 23, 13 -
Why need OO design? * Code is unclearly. * Hard
to understand. * It is unmaintainable. Saturday, November 23, 13 -
Refactor the bad structure as earlier as possible. Test reflects
the design structure. Saturday, November 23, 13 -
Refactor the bad structure as earlier as possible. Test reflects
the design structure. Discovering better OO design with test Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
2.Send out the email to clients. Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
2.Send out the email to clients. 3.Client reply the email. Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
2.Send out the email to clients. 3.Client reply the email. 4.SendCloud webhook send a post request to our callback url. Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
2.Send out the email to clients. 3.Client reply the email. 4.SendCloud webhook send a post request to our callback url. 5.Create a comment. Saturday, November 23, 13 -
Pragmatic.ly Working Flow SendCloud Client 1.Tell SendCloud to send email.
2.Send out the email to clients. 3.Client reply the email. 4.SendCloud webhook send a post request to our callback url. 5.Create a comment. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud 1. Verify the
post request. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud 1. Verify the
post request. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud Reply-To: [email protected] 1.
Verify the post request. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud Reply-To: [email protected] 1.
Verify the post request. 2. Validate the reply email information. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud Reply-To: [email protected] 1.
Verify the post request. 2. Validate the reply email information. 3.Create a comment. Saturday, November 23, 13 -
Where to begin with I need a callback url Saturday,
November 23, 13 -
Where to begin with class EmailRepliesController < ApplicationController def create
end end I need a callback url Saturday, November 23, 13 -
Where to begin with class EmailRepliesController < ApplicationController def create
end end I need a callback url Test First Saturday, November 23, 13 -
Where to begin with class EmailRepliesController < ApplicationController def create
end end I need a callback url describe EmailRepiesController do describe "POST create" do end end Test First Saturday, November 23, 13 -
Verify Post Request Source describe EmailRepiesController do describe "POST create"
do end end Saturday, November 23, 13 -
Verify Post Request Source describe EmailRepiesController do describe "POST create"
do context "when the post request is a valid request" do end end end Saturday, November 23, 13 -
context "when the post request is not a valid request"
do Verify Post Request Source describe EmailRepiesController do describe "POST create" do context "when the post request is a valid request" do end end end end Saturday, November 23, 13 -
context "when the post request is not a valid request"
do Verify Post Request Source describe EmailRepiesController do describe "POST create" do context "when the post request is a valid request" do it "returns status 200" end end end end Saturday, November 23, 13 -
context "when the post request is not a valid request"
do Verify Post Request Source describe EmailRepiesController do describe "POST create" do context "when the post request is a valid request" do it "returns status 200" end it "returns status 422" end end end Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud Reply-To: [email protected] 1.
Verify the post request. 2. The reply email information. 3.Create a comment. Saturday, November 23, 13 -
What we need to do? Pragmatic.ly SendCloud Reply-To: [email protected] 1.
Verify the post request. 2. The reply email information. 3.Create a comment. Saturday, November 23, 13 -
Validation & Creation describe "POST create" do context "when the
post request is a valid request" do it "returns status 200" end end Saturday, November 23, 13 -
Validation & Creation describe "POST create" do context "when the
post request is a valid request" do it "returns status 200" end end Saturday, November 23, 13 -
Validation & Creation describe "POST create" do context "when the
post request is a valid request" do it "returns status 200" end end context "when the project uid is valid" do end Saturday, November 23, 13 -
context "when the project uid is invalid" do end Validation
& Creation describe "POST create" do context "when the post request is a valid request" do it "returns status 200" end end context "when the project uid is valid" do end Saturday, November 23, 13 -
context "when the project uid is invalid" do end Validation
& Creation describe "POST create" do context "when the post request is a valid request" do it "returns status 200" end end context "when the project uid is valid" do end it "doesn't create the comment" Saturday, November 23, 13 -
Validation & Creation context "when the project uid is valid"
do end Saturday, November 23, 13 -
Validation & Creation context "when the project uid is valid"
do end context "when the user email is valid" do end Saturday, November 23, 13 -
context "when the user uid is invalid" do it "doesn't
create the comment" end Validation & Creation context "when the project uid is valid" do end context "when the user email is valid" do end Saturday, November 23, 13 -
context "when the user uid is invalid" do it "doesn't
create the comment" end Validation & Creation context "when the project uid is valid" do end context "when the user email is valid" do end context "when the user has the right to access this project" do end Saturday, November 23, 13 -
context "when the user uid is invalid" do it "doesn't
create the comment" end Validation & Creation context "when the project uid is valid" do end context "when the user email is valid" do end context "when the user has the right to access this project" do context "when the user has no right to access this project" do it "doesn't create the comment" end end Saturday, November 23, 13 -
context "when the user uid is invalid" do it "doesn't
create the comment" end Validation & Creation context "when the project uid is valid" do end context "when the user email is valid" do end context "when the user has the right to access this project" do context "when the user has no right to access this project" do it "doesn't create the comment" end end # Next Step Saturday, November 23, 13 -
context "when the user has the right to access this
project" do Validation & Creation end Saturday, November 23, 13 -
context "when the ticket uid is valid" do context "when
the user has the right to access this project" do Validation & Creation end end Saturday, November 23, 13 -
context "when the ticket uid is valid" do context "when
the ticket uid is invalid" do context "when the user has the right to access this project" do Validation & Creation end end end Saturday, November 23, 13 -
context "when the ticket uid is valid" do context "when
the ticket uid is invalid" do it "creates the comment" context "when the user has the right to access this project" do Validation & Creation end end end Saturday, November 23, 13 -
context "when the ticket uid is valid" do context "when
the ticket uid is invalid" do it "doesn't create the comment" it "creates the comment" context "when the user has the right to access this project" do Validation & Creation end end end Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Controller Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project User Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project User Ticket Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project User Ticket Comment Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project User Ticket Comment Controller SendCloud Saturday, November 23, 13 -
What do we get now? context "when the project uid
is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Project User Ticket Comment Controller SendCloud Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) end else ... end else ... end else .... Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) end else ... end else ... end else .... Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) end else ... end else ... end else .... Refactor it? Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) end else ... end else ... end else .... Refactor it? It is too late! Saturday, November 23, 13 -
def create No Test! if post_request_valid project = Project.find(...) if
project.valid user = User.find(...) if user.valid if user.have_access_right ticket = Ticket.find(...) if ticket.valid Comment.create(...) end else ... end else ... end else .... Refactor it? It is too late! Technical Debt Saturday, November 23, 13 -
Let’s go back context "when the project uid is valid"
do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" end context "when the ticket uid is invalid" do it "doesn't create the comment" end end context "when the user has no right to access this project" do it "doesn't create the comment" end end context "when the user uid is invalid" do it "doesn't create the comment" end end context "when the project uid is invalid" do it "doesn't create the comment" end Saturday, November 23, 13 -
Test reflect the design Controller context "when the post request
is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
Test reflect the design context "when the project uid is
valid" do Controller Project context "when the post request is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
Test reflect the design context "when the project uid is
valid" do Controller Project User context "when the user uid is valid" do context "when the post request is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
Test reflect the design context "when the project uid is
valid" do Controller Project User context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the post request is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
Test reflect the design context "when the project uid is
valid" do Controller Project User Ticket context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do context "when the post request is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
Test reflect the design context "when the project uid is
valid" do Controller Project User Ticket Comment context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" context "when the post request is a valid request" do describe "POST create" do SendCloud Saturday, November 23, 13 -
1. I didn’t write any codes 2. What did I
find with test Saturday, November 23, 13 -
Test reflect the design Controller Project User Ticket Comment SendCloud
Saturday, November 23, 13 -
Test reflect the design Structural Coupling! Controller Project User Ticket
Comment SendCloud Saturday, November 23, 13 -
Test reflect the design Structural Coupling! Controller Project User Ticket
Comment SendCloud Doing too many things! Saturday, November 23, 13 -
Test reflect the design Structural Coupling! Controller Project User Ticket
Comment SendCloud Doing too many things! Knowing too much details! Saturday, November 23, 13 -
context "when the post request is a valid request" do
context "when the project uid is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" SendCloud Re-Design From Test Controller Project User Ticket Comment Saturday, November 23, 13 -
context "when the post request is a valid request" do
context "when the project uid is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" SendCloud Re-Design From Test Controller Project User Ticket Comment Saturday, November 23, 13 -
context "when the post request is a valid request" do
context "when the project uid is valid" do context "when the user uid is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do it "creates the comment for iteration" SendCloud Re-Design From Test Controller Project User Ticket Comment Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance email_handler.should_receive(:handle) Saturday, November 23, 13 -
Re-Design SendCloud Controller context "when the post request is a
valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance post :create, timestamp: timestamps, token: token, signature: signature email_handler.should_receive(:handle) Saturday, November 23, 13 -
Re-Design SendCloud Controller EmailHandler context "when the post request is
a valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance post :create, timestamp: timestamps, token: token, signature: signature email_handler.should_receive(:handle) Saturday, November 23, 13 -
Re-Design SendCloud Controller EmailHandler Mock context "when the post request
is a valid request" do it "tells email handler to handle the request" do end email_handler = EmailHandler.any_instance post :create, timestamp: timestamps, token: token, signature: signature email_handler.should_receive(:handle) Saturday, November 23, 13 -
Re-Design Controller class EmailRepliesController < ApplicationController def create if post_request_authenticated
EmailHandler.new(params).handle head(200) else head(422) end end def post_request_authenticated ... end end Saturday, November 23, 13 -
Re-Design Controller class EmailRepliesController < ApplicationController def create if post_request_authenticated
EmailHandler.new(params).handle head(200) else head(422) end end def post_request_authenticated ... end end email_handler = EmailHandler.any_instance email_handler.should_receive(:handle) Test Saturday, November 23, 13 -
Re-Design Controller class EmailRepliesController < ApplicationController def create if post_request_authenticated
EmailHandler.new(params).handle head(200) else head(422) end end def post_request_authenticated ... end end email_handler = EmailHandler.any_instance email_handler.should_receive(:handle) Test Saturday, November 23, 13 -
New Class EmailHandler class EmailHandler def initialize(params) end def handle
end end EmailHandler.new(params).handle Saturday, November 23, 13 -
New Class EmailHandler class EmailHandler def initialize(params) end def handle
end end describe EmailHandler do describe "#initialize" do end describe "#handle" do end end EmailHandler.new(params).handle Saturday, November 23, 13 -
New Class EmailHandler class EmailHandler def initialize(params) end def handle
end end describe EmailHandler do describe "#initialize" do end describe "#handle" do end end describe "#handle" do end EmailHandler.new(params).handle Saturday, November 23, 13 -
New Class EmailHandler class EmailHandler def initialize(params) end def handle
end end describe EmailHandler do describe "#initialize" do end describe "#handle" do end end context "when the project uid is valid" do context "when the user email is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do .... describe "#handle" do end EmailHandler.new(params).handle Saturday, November 23, 13 -
EmailHandler#handle context "when the project uid is valid" do context
"when the user email is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do .... describe "#handle" do end Saturday, November 23, 13 -
EmailHandler#handle context "when the project uid is valid" do context
"when the user email is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do .... describe "#handle" do end Saturday, November 23, 13 -
EmailHandler#handle context "when the project uid is valid" do context
"when the user email is valid" do context "when the user has the right to access this project" do context "when the ticket uid is valid" do .... describe "#handle" do end describe "#handle" do context "when it is a valid email" do it "creates a comment" end context "when it is a invalid email" do it "doesn't create a comment" end end Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } before { email_handler.stub(:valid_email?).and_return(true) } Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } before { email_handler.stub(:valid_email?).and_return(true) } email_hander.handle Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } before { email_handler.stub(:valid_email?).and_return(true) } email_hander.handle Comment.count.should == 1 Saturday, November 23, 13 -
it "creates a comment" do EmailHandler#handle describe "#handle" do context
"when it is a valid email" do end end let(:email_handler) { EmailHandler.new(....) } before { email_handler.stub(:valid_email?).and_return(true) } email_hander.handle Comment.count.should == 1 context "when it is a invalid email" do let(:email_handler) { EmailHandler.new(....) } before { email_handler.stub(:valid_email?).and_return(false) } it "doesn't create a comment" do email_hander.handle Comment.count.should == 0 end end Saturday, November 23, 13 -
class EmailHandler def initialize end def handle if valid_email? #create
comment end end def valid_email? #validate the email information. end end EmailHandler#handle Saturday, November 23, 13 -
class EmailHandler def initialize end def handle if valid_email? #create
comment end end def valid_email? #validate the email information. end end EmailHandler#handle Saturday, November 23, 13 -
class EmailHandler def initialize end def handle if valid_email? #create
comment end end def valid_email? #validate the email information. end end EmailHandler#handle Saturday, November 23, 13 -
class EmailHandler def initialize end def handle if valid_email? #create
comment end end def valid_email? #validate the email information. end end EmailHandler#handle describe "#valid_email?" do end Saturday, November 23, 13 -
class EmailHandler def initialize end def handle if valid_email? #create
comment end end def valid_email? #validate the email information. end end EmailHandler#handle describe "#valid_email?" do context "all objects is valid" #true context "invalid project" #false context "invalid user" #false context "invalid ticket" #false end Saturday, November 23, 13 -
What we got class EmailHandler def initialize end def handle
if self.valid_email? #create comment end end def valid_email? #validate the email. end end class EmailRepliesController < AC def create if post_request_authenticated? EmailHandler.new(params).handle head(200) else head(422) end end def post_request_authenticated? ... end end Saturday, November 23, 13 -
What we got SendCloud Controller EmailHandler handle valid_email? Mock Stub
Saturday, November 23, 13 -
What we got SendCloud Controller EmailHandler handle valid_email? Comment Mock
Stub Saturday, November 23, 13 -
What we got SendCloud Controller EmailHandler handle valid_email? Comment Project
Ticket User Mock Stub Saturday, November 23, 13 -
Controller EmailHandler handle valid_email? Mock Mock and Stub Mock: Command
method. Saturday, November 23, 13 -
Controller EmailHandler handle valid_email? Mock Stub Mock and Stub Mock:
Command method. Saturday, November 23, 13 -
Controller EmailHandler handle valid_email? Mock Stub Mock and Stub Mock:
Command method. Stub: Query method. Saturday, November 23, 13 -
Controller EmailHandler handle valid_email? Mock Stub Mock and Stub Mock:
Command method. Stub: Query method. Mock is brittle. Saturday, November 23, 13 -
Controller EmailHandler handle valid_email? Mock Stub Mock and Stub Mock:
Command method. Stub: Query method. Mock is brittle. Integrate Test Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
* Test could be a documentation. Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
* Test could be a documentation. * Flexible Api. Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
* Test could be a documentation. * Flexible Api. Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock * Test could be a documentation. * Flexible Api. Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Isolate * Test could be a documentation. * Flexible Api. Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Stub Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Stub Isolate Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Stub Isolate Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Changed? Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Stub Isolate Isolate Isolate * Test could be a documentation. * Flexible Api. Changed? New Object Changed? Changed? Saturday, November 23, 13 -
Benefits SendCloud Controller EmailHandler handle valid_email? Comment Project Ticket User
Mock Stub Isolate Isolate Isolate * Test could be a documentation. * Flexible Api. Changed? New Object New Object Changed? Changed? Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Saturday,
November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A B C Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A B C Doing too many things Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A B C Doing too many things Single Responsibility Principle Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A B C too much details Doing too many things Single Responsibility Principle Saturday, November 23, 13 -
Example & Principles Boss B A C D Customer Boss
Customer Department Alice Bob A B C too much details Tell Doing too many things Single Responsibility Principle Saturday, November 23, 13 -
Review When do we to refactor code? What do we
need to refactor? Saturday, November 23, 13 -
Review Test guides us go forward. When do we to
refactor code? What do we need to refactor? Saturday, November 23, 13 -
Review Test guides us go forward. We begin to refactor
when we feel pain in Test. When do we to refactor code? What do we need to refactor? Saturday, November 23, 13 -
Review Test guides us go forward. We begin to refactor
when we feel pain in Test. When do we to refactor code? What do we need to refactor? We reduce the dependencies found by Test. Saturday, November 23, 13