-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.rb
52 lines (47 loc) · 1.01 KB
/
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
require 'rspec'
require './room_status'
require 'fire/forget'
describe RoomStatus do
let (:room) { RoomStatus.new("North Room", "some_url") }
let(:failure_json) {
{
name: "North Room",
url: "",
build: {
number: 20,
phase: "FINISHED",
status: "FAILURE",
url: "/#{20}/"
}
}
}
let(:success_json) {
{
name: "North Room",
url: "",
build: {
number: 20,
phase: "FINISHED",
status: "SUCCESS",
url: "/#{20}/"
}
}
}
before do
FAF.stub(:post)
end
describe '#busy!' do
it 'should set the status to send broken json' do
Time.should_receive(:now).and_return(20)
FAF.should_receive(:post).with("some_url", failure_json, anything)
room.busy!
end
end
describe '#free!' do
it 'should send the success json' do
Time.should_receive(:now).and_return(20)
FAF.should_receive(:post).with("some_url", success_json, anything)
room.free!
end
end
end