swamp 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/features/step_definitions/swamp_steps.rb +14 -14
- data/lib/swamp/version.rb +1 -1
- data/lib/swamp/wrapper.rb +6 -1
- data/swamp.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 847a3ad24ced1c7638928fb5ede6945aa0e45b5c
|
4
|
+
data.tar.gz: b1bfa972a7c19a3022e75e18c006ed37f69f6f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a048407fe8e70e48cbb7d546b7192f602f7b3a45b410c971357c26b099b24ed425ef9064d7df292a844cde56a2f045432b914aa9d65b163cf3533c6ab2f7099
|
7
|
+
data.tar.gz: 2544657716ca5091ae0ffbee4cad07357eac354d4d01dfe1ada3f273d7b6acad60289faeafb7975fe0ebf3f8ff3de63b9ceeab9018f32233d8caa4a253369a7d
|
@@ -6,7 +6,7 @@ When /^(?:I start it|that swamp is already running)$/ do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
Then /^I should see "(.*?)"$/ do |outcome|
|
9
|
-
fake_output.messages.
|
9
|
+
expect(fake_output.messages).to include(outcome)
|
10
10
|
end
|
11
11
|
|
12
12
|
Given /^I enter the url for this page: "(\w+\.html)"$/ do |page|
|
@@ -25,15 +25,15 @@ When /^I attempt to scan this page: "(\w+\.html)"$/ do |page|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
Then /^(?:swamp|it) should output the following code snippets?$/ do |string|
|
28
|
-
fake_output.messages.
|
28
|
+
expect(fake_output.messages).to include(string)
|
29
29
|
end
|
30
30
|
|
31
31
|
Then /^swamp should not output any snippet$/ do
|
32
|
-
fake_output.messages.size.
|
32
|
+
expect(fake_output.messages.size).to be <= 3
|
33
33
|
fake_output.messages.each do |m|
|
34
|
-
m.
|
35
|
-
m.
|
36
|
-
m.
|
34
|
+
expect(m).not_to include("def")
|
35
|
+
expect(m).not_to include("source.")
|
36
|
+
expect(m).not_to include("page.")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -42,7 +42,7 @@ Given /^that swamp already have scanned a page$/ do
|
|
42
42
|
path = File.join(File.dirname(__FILE__), '../support/page_examples/', "button.html")
|
43
43
|
@url = "file://#{path}"
|
44
44
|
swamp.scan(@url)
|
45
|
-
fake_output.messages.
|
45
|
+
expect(fake_output.messages).to include("def sign_up\n page.click_button(\"Sign Up\")\nend")
|
46
46
|
end
|
47
47
|
|
48
48
|
When /^I attempt to hit enter at the terminal$/ do
|
@@ -50,19 +50,19 @@ When /^I attempt to hit enter at the terminal$/ do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
Then /^swamp should scan the current page$/ do
|
53
|
-
fake_output.messages.size.
|
54
|
-
fake_output.messages[3].
|
55
|
-
fake_output.messages[4].
|
53
|
+
expect(fake_output.messages.size).to be <= 5
|
54
|
+
expect(fake_output.messages[3]).to eq "Scanning, please wait..."
|
55
|
+
expect(fake_output.messages[4]).to eq "def sign_up\n page.click_button(\"Sign Up\")\nend"
|
56
56
|
end
|
57
57
|
|
58
58
|
Then /^swamp should highlight this (element|link): "(.+)"$/ do |mode, selector|
|
59
59
|
page = Capybara.current_session
|
60
|
-
page.
|
60
|
+
expect(page).to have_css "#{selector}[style]"
|
61
61
|
if mode == "element"
|
62
|
-
page.find(selector)[:style].
|
63
|
-
page.find(selector)[:style].
|
62
|
+
expect(page.find(selector)[:style]).to include("border-width: 3px")
|
63
|
+
expect(page.find(selector)[:style]).to include("border-color: rgb(255, 0, 0)")
|
64
64
|
else
|
65
|
-
page.find(selector)[:style].
|
65
|
+
expect(page.find(selector)[:style]).to include("background-color: rgb(255, 0, 0)")
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
data/lib/swamp/version.rb
CHANGED
data/lib/swamp/wrapper.rb
CHANGED
@@ -18,9 +18,14 @@ module Swamp
|
|
18
18
|
def scan
|
19
19
|
found_snippets = []
|
20
20
|
@meta_collection.each do | element_collection |
|
21
|
-
found_snippets += element_collection.get.map { | element |
|
21
|
+
found_snippets += element_collection.get.map { | element | build_snippet(element) }
|
22
22
|
end
|
23
23
|
found_snippets
|
24
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def build_snippet(element)
|
28
|
+
@setup.builder.build_snippet(element)
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
data/swamp.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "capybara", '~> 2.4'
|
22
|
-
spec.add_dependency "selenium-webdriver", '~> 2.
|
22
|
+
spec.add_dependency "selenium-webdriver", '~> 2.46'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", '~> 1.6'
|
25
25
|
spec.add_development_dependency "rake", '~> 10.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juraci de Lima Vieira Neto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.46'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.46'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|