pretender-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1203f9df04b877d6a7ad3cc32daca9b01a1fd844
4
- data.tar.gz: 723f9bc1e3792b40e644dcb043ae20e2b7826939
3
+ metadata.gz: 0ec1ff6ecb58d8f0818f17bdce6fa7be134b5568
4
+ data.tar.gz: ba026fc420d75d51ba17233335b43d3ebd2b663a
5
5
  SHA512:
6
- metadata.gz: 0f946042676557f164c3f72d722cb0bff9fb30c134adb2b23557785dbd414199dc803332d729318d32a26bb1ee7faf1cffae22bc679d993a544986619517d687
7
- data.tar.gz: 3a6a9d11965883cc5eb568f466c0cfb528c60846b3dabfa4c95f3bbd3e48254f482af6420a4fa093442ad9b2b19126acf3bed354f87f78b610e06ddf79334308
6
+ metadata.gz: 4f99b2b324c8d48811266538409e748e664e6a7b1a8031c8287db7df899a744b0e6aea796fa99eb7329c93bc15349f0e1ee6a819b6313a1f0b83f9627d5e941b
7
+ data.tar.gz: ce84d57e34a62cb124b0e737590bb31a8379d55d8614a0fd2b557c35840d1a6785f252fed2a66a84656dfb644e668fefebaeeb406addee46cab3c2dace5ec171
data/README.md CHANGED
@@ -20,6 +20,24 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Cucumber
24
+
25
+ ```ruby
26
+ # features/support/env.rb
27
+ require 'pretender/rails/cucumber'
28
+
29
+ # features/step_definitions/pretender.rb
30
+ Given(/^there is a "(.*?)" endpoint$/) do |url|
31
+ @stub = stub("get", url, [200, {}, ""])
32
+ end
33
+
34
+ Given(/^that endpoint returns "(.*?)"$/) do |response|
35
+ @stub.response = [200, {}, response]
36
+ end
37
+ ```
38
+
39
+ ### In development
40
+
23
41
  ```ruby
24
42
  Pretender.server.stub('get', 'https://api.github.com/repos/code0100fun/pretender-rails', [200, {}, {name: "mock-repo"}.to_json])
25
43
  ```
@@ -18,7 +18,10 @@ module Pretender
18
18
 
19
19
  def shutdown(page)
20
20
  stubs.clear
21
- page.execute_script('typeof(server) !== "undefined" && server.shutdown();')
21
+ if page.driver.browser.respond_to? :execute_script
22
+ page.execute_script('typeof(server) !== "undefined" && server.shutdown();')
23
+ end
24
+ rescue Capybara::NotSupportedByDriver => e
22
25
  end
23
26
 
24
27
  def stub(method, route, response)
@@ -62,10 +65,10 @@ module Pretender
62
65
  <script>
63
66
  var server = new Pretender(function(){
64
67
  #{routes}
65
- this.get('*any', this.passthrough);
66
- this.post('*any', this.passthrough);
67
- this.put('*any', this.passthrough);
68
- this.delete('*any', this.passthrough);
68
+ this.get('/*any', this.passthrough);
69
+ this.post('/*any', this.passthrough);
70
+ this.put('/*any', this.passthrough);
71
+ this.delete('/*any', this.passthrough);
69
72
  });
70
73
  </script>
71
74
  JS
@@ -1,5 +1,5 @@
1
1
  module Pretender
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretender-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chase McCarthy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler