|
21 | 21 | it 'should render correctly' do |
22 | 22 | should eq "first,second,third\n1,2,3\n" |
23 | 23 | end |
| 24 | + |
| 25 | + context 'with headers_only option' do |
| 26 | + let(:options) { {headers_only: true} } |
| 27 | + |
| 28 | + it 'should render only headers' do |
| 29 | + should eq "first,second,third\n" |
| 30 | + end |
| 31 | + end |
24 | 32 | end |
25 | 33 |
|
26 | 34 | context 'with homogenous records' do |
|
37 | 45 | it 'should render correctly' do |
38 | 46 | should == "first,second,third\n10,20,30\n11,21,31\n" |
39 | 47 | end |
| 48 | + |
| 49 | + context 'with headers_only option' do |
| 50 | + let(:options) { {headers_only: true} } |
| 51 | + |
| 52 | + it 'should render only headers' do |
| 53 | + should eq "first,second,third\n" |
| 54 | + end |
| 55 | + end |
40 | 56 | end |
41 | 57 |
|
42 | | - context 'with hetreogenous records' do |
| 58 | + context 'with heterogeneous records' do |
43 | 59 | let(:records) do |
44 | 60 | 2.times.map do |i| |
45 | 61 | double(:foo, :as_csv => { |
|
56 | 72 | ,,,11,21,31 |
57 | 73 | " |
58 | 74 | end |
| 75 | + |
| 76 | + context 'with headers_only option' do |
| 77 | + let(:options) { {headers_only: true} } |
| 78 | + |
| 79 | + it 'should render only headers' do |
| 80 | + should eq "first0,second0,third0,first1,second1,third1\n" |
| 81 | + end |
| 82 | + end |
59 | 83 | end |
60 | 84 |
|
61 | 85 | context 'with record not respond_to? `as_csv`' do |
|
0 commit comments