legato 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,4 +3,5 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  lib/demo.rb
6
- .rvmrc
6
+ .rvmrc
7
+ coverage
@@ -1,3 +1,17 @@
1
+ ## Legato 0.2.0 ##
2
+
3
+ * Changed Query API for #metrics & #dimensions
4
+
5
+ If you add metrics and dimensions to a query, it will not modify the
6
+ parent (of the query) class's dimensions or metrics. Resolves issue #40.
7
+
8
+ *Tony Pitale*
9
+
10
+ ## Legato 0.1.0 ##
11
+
12
+ * Added dynamic segment support from @etiennebarrie
13
+ * Fixed some readme typos from PR by @juuso
14
+
1
15
  ## Legato 0.0.3 ##
2
16
 
3
17
  * Merged branch oauth-1-support
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "vcr", "2.0.0.beta2"
29
29
  s.add_development_dependency "fakeweb"
30
30
  s.add_development_dependency "oauth2"
31
+ s.add_development_dependency "simplecov"
31
32
 
32
33
  s.add_runtime_dependency "multi_json"
33
34
  end
@@ -25,5 +25,9 @@ module Legato
25
25
  def ==(other)
26
26
  name == other.name && elements == other.elements
27
27
  end
28
+
29
+ def include?(element)
30
+ @elements.include?(element)
31
+ end
28
32
  end
29
33
  end
@@ -172,11 +172,11 @@ module Legato
172
172
  # end
173
173
 
174
174
  def metrics
175
- parent_klass.metrics
175
+ @metrics ||= parent_klass.metrics.dup
176
176
  end
177
177
 
178
178
  def dimensions
179
- parent_klass.dimensions
179
+ @dimensions ||= parent_klass.dimensions.dup
180
180
  end
181
181
 
182
182
  def sort=(arr)
@@ -1,3 +1,3 @@
1
1
  module Legato
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -18,6 +18,7 @@ describe Legato::Query do
18
18
  context "a query" do
19
19
  before :each do
20
20
  @klass = Class.new
21
+ @klass.extend(Legato::Model)
21
22
  @block = lambda {eql(:key, 1000)}
22
23
  @klass.stubs(:filters).returns({:high => @block})
23
24
  @klass.stubs(:segments).returns([])
@@ -131,6 +132,34 @@ describe Legato::Query do
131
132
  @query.should have_received(:apply_options).with({:sort => [:city]})
132
133
  end
133
134
 
135
+ context "when modifying dimensions" do
136
+ it 'changes the query dimensions' do
137
+ @query.dimensions << :city
138
+ @query.dimensions.include?(:city).should be_true
139
+ end
140
+
141
+ it 'does not change the parent class dimensions' do
142
+ empty_dimensions = Legato::ListParameter.new(:dimensions, [])
143
+
144
+ @query.dimensions << :city
145
+ @klass.dimensions.should eq(empty_dimensions)
146
+ end
147
+ end
148
+
149
+ context "when modifying metrics" do
150
+ it 'changes the query metrics' do
151
+ @query.metrics << :pageviews
152
+ @query.metrics.include?(:pageviews).should be_true
153
+ end
154
+
155
+ it 'does not change the parent class metrics' do
156
+ empty_metrics = Legato::ListParameter.new(:metrics, [])
157
+
158
+ @query.metrics << :pageviews
159
+ @klass.metrics.should eq(empty_metrics)
160
+ end
161
+ end
162
+
134
163
  context 'when applying filters' do
135
164
  before :each do
136
165
  @filter = Legato::Filter.new(:key, :eql, 1000, nil)
@@ -1,3 +1,6 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
1
4
  require 'bundler/setup'
2
5
 
3
6
  require 'rspec'
@@ -19,4 +22,6 @@ RSpec.configure do |config|
19
22
 
20
23
  config.extend VCR::RSpec::Macros
21
24
  config.include Support::Macros::OAuth
25
+
26
+ config.order = 'random'
22
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
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-07-19 00:00:00.000000000 Z
12
+ date: 2013-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -123,6 +123,22 @@ dependencies:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
126
142
  - !ruby/object:Gem::Dependency
127
143
  name: multi_json
128
144
  requirement: !ruby/object:Gem::Requirement