W4D4 Flashcards

1
Q

TDD

A

Test Driven Development

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do we test

A

Check that everything is working. Increases flexibility by reducing fear that something might be broken in the future.

Naturally produces documentation for our code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

TDD Pyramid

A

Unit - Foundation, for specific methods. Classes are tested in isolation (use doubles)

Integration - Test how parts are working together, you need fewer

End 2 End - Tests the flow of the application from start to finish.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Red > Green > Refactor

A

Write tests before the code, they should all fail.

Green Minimuum amount of code to pass the test

Refactor > clean up the code to make everything look better

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Demo

A

setup, structure, syntax

describe,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

RSPEC setup

A
mkdir project
cd project
bundle init
gems**
rspec -- init
--format documentaion
--color

create a lib folder
file.rb
in spec
file_spec.rb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

DESCRIBE Class

A

require ‘rspec’
require ‘class’

describe Class do

end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

DESCRIBE ‘readability string’

A

describe ‘#method_test’ do

end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

IT ‘readably test string”

A

it ‘expected execution’ do

end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CONTEXT block

A

wrap a given it block when some context to help with readability

context ‘with valid arguments’ do

it ‘intantiates correctly’ do

end

end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ALLOW

A

allow(:board).to receive(:vaild_pos?).and_return(false)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

allow

A

simulates behavior that you would have required for the test to be testable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

let(:) vs subject(:)

A

let signifies it is not the primary focus, subject is the focus

you can have multiple lets, but not multiple subjects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly