-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsession_spec.rb
73 lines (56 loc) · 1.63 KB
/
session_spec.rb
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
require 'spec_helper'
describe KegbotApi::Session do
let(:client) { KegbotApi::Client.new TEST_API_BASEURL }
describe "Class Methods" do
let(:all) { client.Session.all }
describe "::all" do
describe "Is Array Like" do
it "responds_to length" do
expect(all).to respond_to :length
end
it "responds_to []" do
expect(all).to respond_to :[]
end
end
it "length == 65" do
expect(all.length).to eq 65
end
end
describe "::find(65)" do
subject { client.Session.find 65 }
it "Succeeds" do
expect(subject).to_not be nil
end
it "id == 65" do
expect(subject.id).to eq 65
end
it "raise NotFoundError on invalid ID" do
expect { client.Session.find 999999 }.to raise_error(KegbotApi::NotFoundError)
end
end
end
describe "Instance Methods" do
subject { client.Session.first }
it "id == 65" do
expect(subject.id).to eq 65
end
it "name == ''" do
expect(subject.name).to eq ''
end
it "start_time == '2014-02-27T00:08:15+00:00'" do
expect(subject.start_time).to eq DateTime.iso8601('2014-02-27T00:08:15+00:00').to_time
end
it "end_time == '2014-02-27T03:08:15+00:00'" do
expect(subject.end_time).to eq DateTime.iso8601('2014-02-27T03:08:15+00:00').to_time
end
it "volume_ml == 222.0" do
expect(subject.volume_ml).to eq 222.0
end
it "active? == true" do
expect(subject).to be_active
end
it "to_s containts 'KegbotApi::Session'" do
expect(subject.to_s).to include 'KegbotApi::Session'
end
end
end