This repository was archived by the owner on Dec 1, 2021. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathrspec_spec.rb
More file actions
99 lines (63 loc) · 2.31 KB
/
Copy pathrspec_spec.rb
File metadata and controls
99 lines (63 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# # encoding: utf-8
describe "The Rspec ruby gem" do
# context "Domain Specific Language" do
# it "creates examples with the #it keyword" do
# # this test code passes, so this example passes
# 1.should eq 1
# end
# it "has keywords like #context, and #describe to help organize the spec, or specification" do
# # test code goes here
# (1+2).should eq 3
# end
# it "has easily readable methods like #should to test any object" do
# "Hello".should eq "Hello"
# end
# it "has #should_not to test for negative cases" do
# 1.should_not eq 2
# end
# it "creates readable predicate methods" do
# # Integers have #zero? and #nil? predicate methods, so
# # rspec automatically supports the #be_zero and #be_nil parameter to #should_not method
# 1.should_not be_zero
# 1.should_not be_nil
# end
# it "alerts you when examples fail" do
# # When this example fails,
# # it will show "expected" as 2, and "actual" as 1
# 1.should eq 2
# end
# it "supports placeholder examples that lack code (like this one)"
# it "requires that examples use expectations (like #should) to work properly" do
# # The following expression is false.
# # However, this example PASSES because no expectation was created.
# true == false
# # The following line of code is correct, and would cause the example to fail:
# # true.should == false
# # Lesson: It's easy to write bad tests.
# end
# it "should count the characters in my name" do
# "Renée".should have(5).characters
# end
# it "should check how to spell my name" do
# "Renée".should include("ée")
# end
# end
context "Examples for in-class test exploration" do
it "should know order of operations" do
# Fix the Failing Test
# Order of Operations is Please Excuse My Dear Aunt Sally:
# Parentheses, Exponents, Multiplication, Division, Addition, Subtraction
(1+1-5*6/2).should eq -13
end
it "should count the characters in your name" do
name = "Jordan"
name.should have(6).characters
end
it "should check basic math" do
(2+2).should eq 4
end
it "should check basic spelling" do
"Hello".should include('llo')
end
end
end