expressive 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- expressive (0.0.21)
4
+ expressive (0.0.22)
5
5
  awesome_print (~> 1.0.2)
6
6
  json
7
7
  polyglot (~> 0.3.3)
@@ -30,7 +30,7 @@ GEM
30
30
  rb-fsevent (~> 0.9.1)
31
31
  rb-inotify (~> 0.8.8)
32
32
  method_source (0.8)
33
- mime-types (1.22)
33
+ mime-types (1.21)
34
34
  polyglot (0.3.3)
35
35
  pry (0.9.10)
36
36
  coderay (~> 1.0.5)
@@ -1,3 +1,3 @@
1
1
  module Expressive
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
3
3
  end
@@ -165,13 +165,14 @@ module Expressive
165
165
  the_proc = lookup_result.last
166
166
  the_proc.call(options, key, *Array(cells[2..-1]).map {|cell| cell.eval(scope)})
167
167
  end
168
- end
168
+ end
169
169
  end
170
170
 
171
171
  def perform_webhook(verb, scope, cells)
172
172
  #convert cells to array so it can manipulated easily
173
- cells_array = cells.map{|c| c.text_value.gsub('"', '')}
173
+ cells_array = cells.map{|c| c.text_value.gsub(/\A"|"\Z/, '')}
174
174
  url = cells_array.shift
175
+ url = Expressive.run(url, scope) || url
175
176
  headers = create_webhook_headers(cells_array)
176
177
  params = create_webhook_parameters(scope, cells_array)
177
178
  begin
@@ -164,7 +164,7 @@ describe "Expressive" do
164
164
  end
165
165
 
166
166
  describe "understands retrieving the id of an object" do
167
- it do
167
+ it do
168
168
  @scope["an_object"] = mock(:an_object, id: 5)
169
169
  Expressive.run('($id an_object)', @scope).should == 5
170
170
  end
@@ -270,5 +270,16 @@ describe "Expressive" do
270
270
  @scope['goodbye'].should eql 'srsly'
271
271
  end
272
272
  end
273
+
274
+ context "conditional post" do
275
+ it "should post to correct url" do
276
+ @scope['ohai'] = "world"
277
+ @scope["monty"] = "python"
278
+ request = stub_request(:post, "www.example.com").with(body: {'monty' => 'python', 'ohai' => 'world'}).to_return(body: {'goodbye' => 'srsly'})
279
+ Expressive.run('(post (if (= ohai "world") "http://www.example.com", "http://www.wrongurl.com") "*")', @scope)
280
+ assert_requested(request)
281
+ @scope['goodbye'].should eql 'srsly'
282
+ end
283
+ end
273
284
  end
274
285
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
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-04-23 00:00:00.000000000 Z
12
+ date: 2013-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_gntp
@@ -294,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
294
  version: '0'
295
295
  segments:
296
296
  - 0
297
- hash: -660560315151736319
297
+ hash: 2019720455442608896
298
298
  required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  none: false
300
300
  requirements:
@@ -303,10 +303,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  version: '0'
304
304
  segments:
305
305
  - 0
306
- hash: -660560315151736319
306
+ hash: 2019720455442608896
307
307
  requirements: []
308
308
  rubyforge_project:
309
- rubygems_version: 1.8.23
309
+ rubygems_version: 1.8.24
310
310
  signing_key:
311
311
  specification_version: 3
312
312
  summary: Scheme-like language for manipulating CaseBlocks cases