-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathautomobile_spec.rb
More file actions
63 lines (43 loc) · 1.28 KB
/
automobile_spec.rb
File metadata and controls
63 lines (43 loc) · 1.28 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
require 'rspec'
require 'bundler/setup'
require_relative '../db/setup'
require_relative "../models/automobile"
describe Automobile do
let!(:car) {Automobile.new(color: "blue", make: "Honda", model: "S2000", year: 2001)}
it "should have color" do
car.color.should eq("blue")
end
it "should have a make" do
car.make.should eq("Honda")
end
it "should have a model" do
car.model.should eq("S2000")
end
it "should have a year" do
car.year.should eq(2001)
end
it "should be able to change attributes" do
car.color = "green"
car.color.should eq("green")
end
it "should have four wheels" do
Automobile.number_of_wheels.should eq(4)
end
end
describe Motorcycle do
it "should override the number of wheels" do
Motorcycle.number_of_wheels.should eq(2)
end
end
describe Vehicle do
Vehicle.create(color: "gray", make: "USN", model: "Ballistic Sub", year: 2008)
Vehicle.create(color: "while", make: "NASA", model: "SATURN V", year: 1969)
Vehicle.create(color: "blue", make: "Honda", model: "CR-V", year: 1999)
Vehicle.create(color: "blue", make: "Honda", model: "Accord", year: 2009)
it "should return a count of vehicles" do
Vehicle.count.should eq(4)
end
it "should return a count of blue honda accords" do
Vehicle.count_blue_hondas.should eq(1)
end
end