-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathautomobile_spec.rb
More file actions
39 lines (31 loc) · 1.07 KB
/
automobile_spec.rb
File metadata and controls
39 lines (31 loc) · 1.07 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
require 'rspec'
require_relative('../models/automobile.rb')
describe 'Automobile' do
carspecs = {wheels: 4, colour: "Red", make: "Shiznit", year: "1970", model: "Skoda"}
myauto = Vehicle.new(carspecs)
it "should have a model" do
myauto.model.should == "Skoda"
end
it 'should return the number of wheels' do
myauto.wheels.should be_a_kind_of Numeric
end
it "should have a colour" do
myauto.colour.should == carspecs[:colour]
end
it "should have a make" do
myauto.make.should == carspecs[:make]
end
it "should have a year" do
myauto.year.should == carspecs[:year]
end
it "should update specs" do
newspecs = {wheels: 4, colour: "Yellow", make: "Toyota", model: "Corolla", year: "2003"}
myauto.update(newspecs)
myauto.tires.should == newspecs[:tires]
myauto.wheels.should == newspecs[:wheels]
myauto.colour.should == newspecs[:colour]
myauto.make.should == newspecs[:make]
myauto.model.should == newspecs[:model]
myauto.year.should == newspecs[:year]
end
end