flood-capybara 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: a82db60e58b791d24a3023c728e6810419f0500e
4
- data.tar.gz: 05246ab3b4773bffb9661effd9afa1f4297b34b1
3
+ metadata.gz: c0842e4845b2859966c1e7becf2bcb8d6a16ae42
4
+ data.tar.gz: e1db53d2b668d2b461112d31f497c83c478c0b7c
5
5
  SHA512:
6
- metadata.gz: e1614e8c97070239cf819b28bff6e2996216c37b77525b718d86ac4f721d7e61b62c6e874e75dabe3fa4b5a89a8a4d06bf996082d17e310c8211e25d32300403
7
- data.tar.gz: 24115bab09ab22e0030182f8c194b4bac22e1e53edb2db290c9bee1991585d8d9bde906eb0f3ce6bf4f22b0c627faf57387c4c040924a6cbbebf1cd361a3365f
6
+ metadata.gz: b36653205744714f47b1e0b1cb4e8e318a8ed9053060a6312d3ef79f845de4a78190caaa7f4e806ef3a0f15cef38baccd1bcd80bc94a93ef5d66859175d26c45
7
+ data.tar.gz: 1c361af3839908f3f26e5bcfc3d8c2308851971415c213c0cf019ac29f80f71e6b8ccb08eba853b9be8911bccd2d9841b827b4953bb5ac8fbbdeee2ce121d54a
@@ -99,7 +99,8 @@ class FloodCapybara
99
99
  override_hosts: args[:override_hosts],
100
100
  override_parameters: args[:override_parameters],
101
101
  started: args[:started],
102
- stopped: args[:stopped]
102
+ stopped: args[:stopped],
103
+ meta: git_info
103
104
  },
104
105
  flood_files: flood_files,
105
106
  region: args[:region],
@@ -108,6 +109,16 @@ class FloodCapybara
108
109
  }.merge(args)
109
110
  end
110
111
 
112
+ def git_info
113
+ {
114
+ sha: `git rev-parse HEAD`.chomp,
115
+ repository: {
116
+ full_name: `git rev-parse --abbrev-ref HEAD`.chomp,
117
+ url: `git config --get remote.origin.url`.chomp
118
+ }
119
+ }
120
+ end
121
+
111
122
  def flood_files
112
123
  {
113
124
  file: File.new("#{file.path}", 'rb')
@@ -1,5 +1,5 @@
1
1
  module Flood
2
2
  module Capybara
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -4,6 +4,16 @@ require 'pry'
4
4
 
5
5
  ENV['PUBLIC_IPV4'] ||= `curl -s --fail --connect-timeout 1 http://169.254.169.254/latest/meta-data/public-ipv4 || curl -s --connect-timeout 10 ifconfig.me || echo 127.0.0.1`.chomp
6
6
 
7
+ def uri(url)
8
+ if url && !url.empty?
9
+ URI.parse(url).scheme.nil? ? URI.parse("http://#{url}") : URI.parse(url)
10
+ end
11
+ end
12
+
13
+ def parse_path(url)
14
+ uri(url).path if url && !url.empty?
15
+ end
16
+
7
17
  describe "sign in", type: :feature do
8
18
  before :each do
9
19
  page.driver.clear_network_traffic if Capybara.default_driver == :poltergeist
@@ -14,10 +24,14 @@ describe "sign in", type: :feature do
14
24
  page.driver.network_traffic.each do |request|
15
25
  next unless request
16
26
  next unless request.response_parts && request.response_parts.any? && request.response_parts.last
27
+ # binding.pry if request.url =~ /stats/
28
+ skip = true if request.response_parts.last.content_type =~ /font|image|css|javascript/
29
+ skip = false if request.headers.to_s =~ /XMLHttpRequest/
30
+ next if skip
17
31
  @client.index index: "results-#{Time.now.utc.strftime("%Y.%m.%d")}", type: 'capybara', body: {
18
32
  timestamp: (Time.now.utc.to_f * 1000).to_i.to_s,
19
33
  url: request.url,
20
- label: CGI::escape(request.url),
34
+ label: CGI::escape(parse_path(request.url)),
21
35
  request_headers: request.headers.map {|header| header['name'] << '=' << header['value'] }.join(';'),
22
36
  response_headers: request.response_parts.last.headers.map {|header| header['name'] << '=' << header['value'] }.join(';'),
23
37
  start_time: (request.time.to_f * 1000).to_i.to_s,
@@ -39,15 +53,8 @@ describe "sign in", type: :feature do
39
53
  end
40
54
  end
41
55
 
42
- it "should just work" do
43
- visit '/'
44
- expect(page).to have_content 'Flood'
45
- end
46
- end
47
-
48
- describe "navigate", type: :feature do
49
56
  it "should visit homepage" do
50
- visit '/'
57
+ visit '/wmeS3yIYPs0vM9tFdNQqoQ?grid_id=1'
51
58
  expect(page).to have_content 'Flood'
52
59
  end
53
60
 
data/spec/spec_helper.rb CHANGED
@@ -6,13 +6,12 @@ require 'capybara/poltergeist'
6
6
  require 'elasticsearch'
7
7
 
8
8
  Capybara.default_driver = :poltergeist
9
- Capybara.save_and_open_page_path = File.dirname(__FILE__) + '/var/log/flood/custom'
10
9
  Capybara.app_host = ENV['APP_HOST'] || "http://127.0.0.1"
11
10
  Capybara.default_wait_time = 5
12
11
 
13
12
  RSpec.configure do |config|
14
13
  config.before(:all) do
15
- @client = Elasticsearch::Client.new log: false
14
+ @client = Elasticsearch::Client.new host: `boot2docker ip`.chomp, log: false
16
15
  end
17
16
  config.after(:all) do
18
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flood-capybara
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
  - Tim Koopmans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler