quandl_cassinatra 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
data/UPGRADE.md CHANGED
@@ -1,3 +1,4 @@
1
- ## 0.1
1
+ ## 0.1.14
2
2
 
3
- Initial
3
+ * add Dataset#trim_start, Dataset#trim_end
4
+ * add specs to test that api returns expected trim_start, trim_end
@@ -9,7 +9,7 @@ class Dataset
9
9
  include Concerns::Properties
10
10
  include Searchable
11
11
 
12
- attributes :id, :column_ids, :data
12
+ attributes :id, :column_ids, :data, :trim_start, :trim_end
13
13
 
14
14
  delegate :columns_count, :created_at, :frequency, :rows_count, :type, :updated_at, to: :dataset_attribute
15
15
 
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Cassinatra
3
- VERSION = '0.1.13'
3
+ VERSION = '0.1.14'
4
4
  end
5
5
  end
@@ -2,15 +2,14 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Dataset do
5
- subject { Dataset.new }
6
5
 
7
- it { should respond_to :columns_count }
8
- it { should respond_to :data }
9
- it { should respond_to :data_table }
10
-
11
- context "create" do
6
+ context "before save" do
12
7
 
13
8
  subject{ build(:dataset) }
9
+
10
+ it { should respond_to :columns_count }
11
+ it { should respond_to :data }
12
+ it { should respond_to :data_table }
14
13
 
15
14
  it "should have data" do
16
15
  subject.data_table.count.should eq 730
@@ -20,9 +19,26 @@ describe Dataset do
20
19
  subject.data_table[0].count.should eq 4
21
20
  end
22
21
 
23
- it "should create the dataset" do
24
- subject.save
25
- Dataset.find(subject.id).data.count.should eq 730
22
+ end
23
+
24
+ context "after save" do
25
+
26
+ subject{ d = create(:dataset); Dataset.find(d.id) }
27
+
28
+ describe "#column_ids" do
29
+ it "should have 3 columns" do
30
+ subject.column_ids.count.should eq 3
31
+ end
32
+ it "should each be present" do
33
+ puts "subject.column_ids #{subject.column_ids}"
34
+ subject.column_ids.each{|cid| cid.present?.should be_true }
35
+ end
36
+ end
37
+
38
+ describe "#data" do
39
+ it "should have data" do
40
+ subject.data.count.should eq 730
41
+ end
26
42
  end
27
43
 
28
44
  end
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Dataset do
5
+
6
+ subject{ build(:dataset) }
7
+
8
+ describe "#trim_start" do
9
+ context "before_save" do
10
+ it "should be nil" do
11
+ subject.trim_start.should be_nil
12
+ end
13
+ end
14
+ context "after_save" do
15
+ before(:each){ subject.save }
16
+ it "should equal the last date" do
17
+ subject.trim_start.should eq subject.data_table[-1][0]
18
+ end
19
+ end
20
+ end
21
+
22
+ describe "#trim_end" do
23
+ context "before_save" do
24
+ it "should be nil" do
25
+ subject.trim_end.should be_nil
26
+ end
27
+ end
28
+ context "after_save" do
29
+ before(:each){ subject.save }
30
+ it "should equal the first date" do
31
+ subject.trim_end.should eq subject.data_table[0][0]
32
+ end
33
+ end
34
+ end
35
+
36
+ end
data/spec/spec_helper.rb CHANGED
@@ -15,5 +15,6 @@ end
15
15
  # LOAD GEM
16
16
 
17
17
  require "quandl/cassinatra"
18
- Quandl::Cassinatra.use 'http://192.168.33.10:8983/wikiposit_cassandra/'
18
+ # Quandl::Cassinatra.use 'http://192.168.33.10:8983/wikiposit_cassandra/'
19
+ Quandl::Cassinatra.use 'http://localhost:9292/'
19
20
  include Quandl::Cassinatra
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_cassinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
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-08-06 00:00:00.000000000 Z
12
+ date: 2013-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -255,6 +255,7 @@ files:
255
255
  - spec/factories/dataset.rb
256
256
  - spec/quandl/cassinatra/dataset/persistence_spec.rb
257
257
  - spec/quandl/cassinatra/dataset/searchable_spec.rb
258
+ - spec/quandl/cassinatra/dataset/trim_spec.rb
258
259
  - spec/quandl/cassinatra/multiset_spec.rb
259
260
  - spec/spec_helper.rb
260
261
  homepage: http://blake.hilscher.ca/
@@ -286,5 +287,6 @@ test_files:
286
287
  - spec/factories/dataset.rb
287
288
  - spec/quandl/cassinatra/dataset/persistence_spec.rb
288
289
  - spec/quandl/cassinatra/dataset/searchable_spec.rb
290
+ - spec/quandl/cassinatra/dataset/trim_spec.rb
289
291
  - spec/quandl/cassinatra/multiset_spec.rb
290
292
  - spec/spec_helper.rb