/
dossier_spec.rb
57 lines (46 loc) · 1.4 KB
/
dossier_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
require 'spec_helper'
describe Dossier do
it "is a module" do
Dossier.should be_a(Module)
end
it "is configurable" do
Dossier.configure
Dossier.configuration.should_not be_nil
end
it "has a configuration" do
Dossier.configure
Dossier.configuration.should be_a(Dossier::Configuration)
end
it "allows configuration via a block" do
some_client = Object.new
Dossier.configure do |config|
config.client = some_client
end
Dossier.configuration.client.should eq(some_client)
end
it "exposes the configurations client via Dossier.client" do
Dossier.configure
Dossier.configuration.should_receive(:client)
Dossier.client
end
describe "report naming" do
let(:klass) { HelloMyFriendsReport }
let(:name) { 'hello_my_friends' }
it "converts a report class to a report name" do
expect(Dossier.class_to_name(klass)).to eq(name)
end
it "converting a report name to a report class" do
expect(Dossier.name_to_class(name)).to eq(klass)
end
describe "with namespaces" do
let(:klass) { Cats::Are::SuperFunReport }
let(:name) { 'cats/are/super_fun' }
it "converts a report class to a report name" do
expect(Dossier.class_to_name klass).to eq name
end
it "converts a report name to a report class" do
expect(Dossier.name_to_class name).to eq klass
end
end
end
end