Skip to content

Commit

Permalink
Add the first tests
Browse files Browse the repository at this point in the history
For #25
  • Loading branch information
aeatencio committed Nov 19, 2020
1 parent 9adad55 commit 703577f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 8 deletions.
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ version: "3.8"
services:
web:
image: crystallang/crystal:0.35.1
command: crystal run app/twiliosim.cr
command: crystal run src/twiliosim.cr
ports:
- 3000
volumes:
- ./src:/app
- .:/app
working_dir: /app
ngrok:
image: wernight/ngrok
ports:
Expand Down
1 change: 1 addition & 0 deletions pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose run --rm web crystal spec
73 changes: 73 additions & 0 deletions spec/call_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
require "spec"
require "../src/models/call"

include Twiliosim

describe Call do
describe "#status" do
it "initializes created" do
call = Call.new("foo", "bar", "baz")

call.status.should eq "created"
end

it "starts in-progress" do
call = Call.new("foo", "bar", "baz")

call.start

call.status.should eq "in-progress"
end

it "finished completed" do
call = Call.new("foo", "bar", "baz")

call.finish

call.status.should eq "completed"
end
end

describe "#id" do
it "initializes with a new (random) UUID" do
call_0 = Call.new("foo_0", "bar_1", "baz_2")
call_1 = Call.new("foo_1", "bar_1", "baz_1")

call_0.id.size.should eq 36
call_1.id.size.should eq 36
call_0.id.should_not eq call_1.id
end
end

describe "#to" do
it "initializes OK" do
call = Call.new("foo", "bar", "baz")

call.to.should eq "foo"
end
end

describe "#from" do
it "initializes OK" do
call = Call.new("foo", "bar", "baz")

call.from.should eq "bar"
end
end

describe "#account_sid" do
it "initializes OK" do
call = Call.new("foo", "bar", "baz")

call.account_sid.should eq "baz"
end
end

describe "#no_reply" do
it "initializes OK" do
call = Call.new("foo", "bar", "baz")

call.no_reply.should eq false
end
end
end
2 changes: 0 additions & 2 deletions spec/spec_helper.cr

This file was deleted.

4 changes: 0 additions & 4 deletions spec/twiliosim_spec.cr

This file was deleted.

0 comments on commit 703577f

Please sign in to comment.