act_as_importable 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -57,15 +57,24 @@ describe "an act_as_importable model" do
|
|
57
57
|
Item.should_receive(:import_csv_text).with(File.read(file), {})
|
58
58
|
Item.import_csv_file(file)
|
59
59
|
end
|
60
|
+
it "should return an array of imported records" do
|
61
|
+
Item.import_csv_file(file).should == Item.all.to_a
|
62
|
+
end
|
60
63
|
end
|
61
64
|
|
62
65
|
describe "import csv text" do
|
63
66
|
let(:text) { "name,price\nBeer,2.5\nApple,0.5" }
|
67
|
+
|
64
68
|
it 'should call import_record with row hashes' do
|
65
69
|
Item.should_receive(:import_record).with({'name' => 'Beer', 'price' => '2.5'}, {}).once
|
66
70
|
Item.should_receive(:import_record).with({'name' => 'Apple', 'price' => '0.5'}, {}).once
|
67
71
|
Item.import_csv_text(text)
|
68
72
|
end
|
73
|
+
|
74
|
+
it "should return an array of imported records" do
|
75
|
+
Item.import_csv_text(text).should == Item.all.to_a
|
76
|
+
end
|
77
|
+
|
69
78
|
end
|
70
79
|
|
71
80
|
describe "import record" do
|
@@ -75,6 +84,10 @@ describe "an act_as_importable model" do
|
|
75
84
|
expect { Item.import_record(row) }.to change{Item.count}.by(1)
|
76
85
|
end
|
77
86
|
|
87
|
+
it 'should return the imported item' do
|
88
|
+
Item.import_record(row).should be_a Item
|
89
|
+
end
|
90
|
+
|
78
91
|
describe "unique identifier (uid) option" do
|
79
92
|
|
80
93
|
context "record exists with matching uid" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act_as_importable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|