|
3 | 3 | describe HTTP do
|
4 | 4 | describe ".setup" do
|
5 | 5 | it 'presents the $.ajaxSetup() object as a Hash' do
|
6 |
| - HTTP.setup.should be_a Hash |
| 6 | + expect(HTTP.setup).to be_a Hash |
7 | 7 | end
|
8 | 8 | end
|
9 | 9 |
|
|
16 | 16 |
|
17 | 17 | async "block gets called on success" do
|
18 | 18 | HTTP.get('spec/fixtures/simple.txt') do |response|
|
19 |
| - run_async { response.should be_ok } |
| 19 | + async { response.should be_ok } |
20 | 20 | end
|
21 | 21 | end
|
22 | 22 |
|
23 | 23 | async "block gets called on failure" do
|
24 | 24 | HTTP.get('/spec/does/not/exist.txt') do |response|
|
25 |
| - run_async { response.should_not be_ok } |
| 25 | + async { response.should_not be_ok } |
26 | 26 | end
|
27 | 27 | end
|
28 | 28 | end
|
|
34 | 34 |
|
35 | 35 | async "returns a promise which accepts a then-block for successful response" do
|
36 | 36 | HTTP.get('spec/fixtures/simple.txt').then do |response|
|
37 |
| - run_async { response.should be_ok } |
| 37 | + async { response.should be_ok } |
38 | 38 | end
|
39 | 39 | end
|
40 | 40 |
|
41 | 41 | async "returns a promise which accepts a fail-block for failing response" do
|
42 | 42 | HTTP.get('spec/does/not/exist.txt').fail do |response|
|
43 |
| - run_async { response.should_not be_ok } |
| 43 | + async { response.should_not be_ok } |
44 | 44 | end
|
45 | 45 | end
|
46 | 46 | end
|
|
49 | 49 | describe '#body' do
|
50 | 50 | async 'returns the response body as a string' do
|
51 | 51 | HTTP.get('spec/fixtures/simple.txt') do |response|
|
52 |
| - run_async { response.body.should == "hey" } |
| 52 | + async { response.body.should == "hey" } |
53 | 53 | end
|
54 | 54 | end
|
55 | 55 | end
|
56 | 56 |
|
57 | 57 | describe '#json' do
|
58 | 58 | async 'returns the json converted into native ruby objects' do
|
59 | 59 | HTTP.get('spec/fixtures/user.json') do |response|
|
60 |
| - run_async { response.json.should == { 'name' => 'Adam', 'age' => 26 } } |
| 60 | + async { response.json.should == { 'name' => 'Adam', 'age' => 26 } } |
61 | 61 | end
|
62 | 62 | end
|
63 | 63 | end
|
64 | 64 |
|
65 | 65 | describe '#ok?' do
|
66 | 66 | async 'returns true when the request was a sucess' do
|
67 | 67 | HTTP.get('spec/fixtures/simple.txt') do |response|
|
68 |
| - run_async { response.should be_ok } |
| 68 | + async { expect(response).to be_ok } |
69 | 69 | end
|
70 | 70 | end
|
71 | 71 |
|
72 | 72 | async 'returns false when the request failed' do
|
73 | 73 | HTTP.get('spec/fixtures/non_existant.txt') do |response|
|
74 |
| - run_async { response.should_not be_ok } |
| 74 | + async { response.should_not be_ok } |
75 | 75 | end
|
76 | 76 | end
|
77 | 77 | end
|
|
0 commit comments