Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specs 02, 14, and 15a: Fix Style #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/02_array_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# group is a class. The 'subject' will be an instance of that class.
# https://rspec.info/features/3-12/rspec-core/subject/implicit-subject/

# Note: Using an implicit subject is not recommended for most situations.
# NOTE: Using an implicit subject is not recommended for most situations.
# The next lesson will cover explicit subjects, which are recommended over
# implicit subjects.

Expand All @@ -15,7 +15,7 @@
it 'is an Array' do
expect(subject).to be_an(Array)
end

# Below is one-line syntax that does the same as the above test.
# Look at the doc string that is auto-generated when this test is run
# (in a terminal window).
Expand All @@ -24,18 +24,18 @@

context 'when using predicate matchers' do
context 'when using the empty? predicate method' do
# A predicate method in Ruby ends with a ? and only returns true or false.
# A predicate method in Ruby ends with a ? and only returns true or false.
it 'returns true' do
expect(subject.empty?).to eq true
end
end

# RSpec can leverage this to create predicate matchers for any predicate method.
# https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/predicates/
it 'is empty' do
expect(subject).to be_empty
end

# Below is one-line syntax that does the same as the above test.
# Look at the doc string that is auto-generated when this test is run
# (in a terminal window).
Expand Down
2 changes: 1 addition & 1 deletion spec/14_find_number_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# lib/14_find_number.rb file. An instance of 'FindNumber' is initialized with
# min, max, answer and guess. There are default values for answer and guess.

# Note: the 'RandomNumber' class has not been written. During TDD, we will need
# NOTE: the 'RandomNumber' class has not been written. During TDD, we will need
# to create a double for RandomNumber in the tests for FindNumber.
# https://rspec.info/features/3-12/rspec-mocks/basics/test-doubles/

Expand Down
16 changes: 8 additions & 8 deletions spec/15a_binary_game_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# will need to stub any inside methods because they will be called when you
# create an instance of the class.

# 2. You do not have to test methods that only contain 'puts' or 'gets'
# 2. You do not have to test methods that only contain 'puts' or 'gets'
# because they are well-tested in the standard Ruby library.

# 3. Private methods do not need to be tested because they should have test
Expand All @@ -96,7 +96,7 @@
# Looping Script Method -> Test the behavior of the method (for example, it
# stops when certain conditions are met).

# Note: #player_input will stop looping when the valid_input is between?(min, max)
# NOTE: #player_input will stop looping when the valid_input is between?(min, max)

subject(:game_input) { described_class.new(1, 10) }

Expand Down Expand Up @@ -153,7 +153,7 @@
# Located inside #player_input (Looping Script Method)
# Query Method -> Test the return value

# Note: #verify_input will only return a number if it is between?(min, max)
# NOTE: #verify_input will only return a number if it is between?(min, max)

context 'when given a valid input as argument' do
xit 'returns valid input' do
Expand Down Expand Up @@ -184,19 +184,19 @@

context 'when updating value of random number' do
# Instead of using a normal double, as we did in TDD, we are going to
# use an instance_double. Differently from the normal test double we've
# been using so far, a verifying double can produce an error if the method
# use an instance_double. Differently from the normal test double we've
# been using so far, a verifying double can produce an error if the method
# being stubbed does not exist in the actual class. Verifying doubles are a
# great tool to use when you're doing integration testing and need to make
# sure that different classes work together in order to fulfill some bigger
# computation.
# https://rspec.info/features/3-12/rspec-mocks/verifying-doubles/

# You should not use verifying doubles for unit testings. Unit testing relies
# You should not use verifying doubles for unit testings. Unit testing relies
# on using doubles to test the object in isolation (i.e., not dependent on any
# other object). One important concept to understand is that the BinarySearch
# other object). One important concept to understand is that the BinarySearch
# or FindNumber class doesn't care if it is given an actual random_number class
# object. It only cares that it is given an object that can respond to certain
# object. It only cares that it is given an object that can respond to certain
# methods. This concept is called polymorphism.
# https://www.geeksforgeeks.org/polymorphism-in-ruby/

Expand Down