|
2 | 2 | API_KEY_ATTR = "api key from attrs" |
3 | 3 | API_KEY_ENV = "api key from env" |
4 | 4 |
|
5 | | - subject do |
| 5 | + let(:cloudconvert) do |
6 | 6 | CloudConvert::Client.new(api_key: API_KEY_ATTR) |
7 | 7 | end |
8 | 8 |
|
9 | 9 | describe ".new" do |
10 | 10 | it "reads the api key out of attrs" do |
11 | | - expect(subject.api_key).to eq API_KEY_ATTR |
| 11 | + expect(cloudconvert.api_key).to eq API_KEY_ATTR |
12 | 12 | end |
13 | 13 |
|
14 | 14 | it "reads the api key out of the env variable" do |
|
19 | 19 |
|
20 | 20 | it "prefers the api key out of attrs" do |
21 | 21 | with_env CLOUDCONVERT_API_KEY: API_KEY_ENV do |
22 | | - expect(subject.api_key).to eq API_KEY_ATTR |
| 22 | + expect(cloudconvert.api_key).to eq API_KEY_ATTR |
23 | 23 | end |
24 | 24 | end |
25 | 25 |
|
|
33 | 33 |
|
34 | 34 | it "reads the sandbox bool out of the env variable" do |
35 | 35 | with_env CLOUDCONVERT_SANDBOX: "true" do |
36 | | - expect(subject.sandbox).to eq true |
| 36 | + expect(cloudconvert.sandbox).to eq true |
37 | 37 | end |
38 | 38 |
|
39 | 39 | with_env CLOUDCONVERT_SANDBOX: "TRUE" do |
40 | | - expect(subject.sandbox).to eq true |
| 40 | + expect(cloudconvert.sandbox).to eq true |
41 | 41 | end |
42 | 42 | end |
43 | 43 |
|
|
52 | 52 | end |
53 | 53 |
|
54 | 54 | it "defaults to false when no sandbox bool is supplied" do |
55 | | - expect(subject.sandbox).to be false |
| 55 | + expect(cloudconvert.sandbox).to be false |
56 | 56 | end |
57 | 57 | end |
58 | 58 |
|
59 | 59 | describe "#download" do |
60 | 60 | it "downloads the file and returns a tempfile" do |
61 | 61 | stub_request(:get, "https://storage.cloudconvert.com/file.mp4").to_return(body: "video content") |
62 | | - expect(subject.download("https://storage.cloudconvert.com/file.mp4")).to be_a Tempfile |
| 62 | + expect(cloudconvert.download("https://storage.cloudconvert.com/file.mp4")).to be_a Tempfile |
63 | 63 | end |
64 | 64 | end |
65 | 65 |
|
66 | 66 | describe "#jobs" do |
67 | 67 | it "returns jobs resource" do |
68 | | - expect(subject.jobs).to be_a CloudConvert::Resources::Jobs |
| 68 | + expect(cloudconvert.jobs).to be_a CloudConvert::Resources::Jobs |
69 | 69 | end |
70 | 70 | end |
71 | 71 |
|
72 | 72 | describe "#tasks" do |
73 | 73 | it "returns tasks resource" do |
74 | | - expect(subject.tasks).to be_a CloudConvert::Resources::Tasks |
| 74 | + expect(cloudconvert.tasks).to be_a CloudConvert::Resources::Tasks |
75 | 75 | end |
76 | 76 | end |
77 | 77 |
|
78 | 78 | describe "#users" do |
79 | 79 | it "returns users resource" do |
80 | | - expect(subject.users).to be_a CloudConvert::Resources::Users |
| 80 | + expect(cloudconvert.users).to be_a CloudConvert::Resources::Users |
81 | 81 | end |
82 | 82 | end |
83 | 83 | end |
0 commit comments