symbiont 0.11.0 → 0.12.0

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: bd01188718c924a7aa3c99657e0298949e8f0e7d
4
- data.tar.gz: cfe062617af607bd769e130bc5ae758a35ed9238
3
+ metadata.gz: e4dd5da4488bf024530d92fe4153d35de0cb682b
4
+ data.tar.gz: 63df367508079f7fe43c1764f9b31639d7dbd223
5
5
  SHA512:
6
- metadata.gz: 2d3dbcda06fad22a7e0aec22fa05bd7ad55bba73d0b9b4145650cc75a376baa08dcc3af81647ec3232e6e57f6d6e7e256a8d776c98fb02cf5076f9bc75c89d31
7
- data.tar.gz: 37bc5b36c3f0288d4a2e301afe0572d1f5b9502549a4e94ec4c1f1aaf93e4932c9fb42449b887f08a4cefd3bca1f717b49b953d9b2b35f4013c5ed3ef8b6e668
6
+ metadata.gz: 92eaac0062c704ef7cbd99dc51c67f90e5f73d7232176ce18ef45093884b0d8040a452fb6dfe800c755a62dcdc8f2abd23ba1a985f06f62a1dd86a67a5ac53df
7
+ data.tar.gz: 820896b1c967e3a3954925237e11856ffae0632a094cc6b7674d873c34800230c53e5b8da13608ac7353a5673a5756e2b70c511775f5573bf22fa123b211f7b2
data/.gitignore CHANGED
@@ -13,6 +13,7 @@ lib/bundler/man
13
13
  pkg
14
14
  rdoc
15
15
  spec/reports
16
+ spec/examples.txt
16
17
  test/tmp
17
18
  test/version_tmp
18
19
  tmp
@@ -25,4 +26,4 @@ mkmf.log
25
26
  .DS_Store
26
27
  .DS_Store?
27
28
  .Trashes
28
- .thumbs.db
29
+ .thumbs.db
data/.hound.yml ADDED
@@ -0,0 +1,76 @@
1
+ AllCops:
2
+ Exclude:
3
+ - symbiont.gemspec
4
+ - test/*.rb
5
+ - spec/**/*
6
+
7
+ # missing top-level module documentation comment
8
+ Style/Documentation:
9
+ Enabled: false
10
+
11
+ # prefer reduce over inject
12
+ Style/CollectionMethods:
13
+ PreferredMethods:
14
+ reduce: 'inject'
15
+
16
+ # use each_with_object instead of inject
17
+ Style/EachWithObject:
18
+ Enabled: false
19
+
20
+ # removing the preference for string single quotes
21
+ Style/StringLiterals:
22
+ Enabled: false
23
+
24
+ # prefer fail over raise
25
+ Style/SignalException:
26
+ Enabled: false
27
+
28
+ Style/TrailingComma:
29
+ EnforcedStyleForMultiline: comma
30
+
31
+ # this never works for validations
32
+ Style/AlignHash:
33
+ EnforcedLastArgumentHashStyle: ignore_implicit
34
+
35
+ # align multi-line params with previous line
36
+ Style/AlignParameters:
37
+ EnforcedStyle: with_fixed_indentation
38
+
39
+ # indent `when` clause one step from `case`
40
+ Style/CaseIndentation:
41
+ IndentOneStep: true
42
+
43
+ # don't force crappy var names for reduce/inject loops
44
+ Style/SingleLineBlockParams:
45
+ Enabled: false
46
+
47
+ # for method chains, keep the dot with the method name
48
+ Style/DotPosition:
49
+ EnforcedStyle: leading
50
+
51
+ Style/AccessorMethodName:
52
+ Enabled: false
53
+
54
+ # stop nesting so hard
55
+ Metrics/BlockNesting:
56
+ Max: 2
57
+
58
+ # short methods
59
+ Metrics/MethodLength:
60
+ Max: 20
61
+
62
+ Metrics/LineLength:
63
+ Max: 105
64
+
65
+ # fewer parameters
66
+ Metrics/ParameterLists:
67
+ Max: 5
68
+
69
+ Metrics/AbcSize:
70
+ Enabled: false
71
+
72
+ Metrics/ModuleLength:
73
+ Max: 120
74
+
75
+ Metrics/CyclomaticComplexity:
76
+ Max: 7
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .hound.yml
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+
3
+ sudo: false
4
+
5
+ rvm:
6
+ - 2.0.0
7
+ - 2.1
8
+ - 2.2
9
+
10
+ branches:
11
+ only:
12
+ - master
13
+
14
+ notifications:
15
+ recipients:
16
+ - jeffnyman@gmail.com
17
+
18
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'simplecov', '~> 0.10.0', require: false
4
- gem 'coveralls', require: false
5
-
6
3
  gemspec
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Symbiont
2
2
 
3
- [ ![Codeship Status for jnyman/symbiont](https://codeship.com/projects/9cd74720-bba9-0132-db22-7ae602eb521b/status?branch=master)](https://codeship.com/projects/72247)
4
-
5
- [![Coverage Status](https://coveralls.io/repos/jnyman/symbiont/badge.svg?branch=master)](https://coveralls.io/r/jnyman/symbiont?branch=master)
3
+ [![Build Status](https://travis-ci.org/jnyman/symbiont.svg)](https://travis-ci.org/jnyman/symbiont)
6
4
  [![Gem Version](https://badge.fury.io/rb/symbiont.svg)](http://badge.fury.io/rb/symbiont)
7
5
  [![Dependency Status](https://gemnasium.com/jnyman/symbiont.png)](https://gemnasium.com/jnyman/symbiont)
8
6
  [![Code Climate](https://codeclimate.com/github/jnyman/symbiont/badges/gpa.svg)](https://codeclimate.com/github/jnyman/symbiont)
@@ -16,20 +14,26 @@ Symbiont provides a semantic domain-specific language that can be used to constr
16
14
 
17
15
  Symbiont is a test solution micro-framework.
18
16
 
19
- A micro-framework provides a focused solution, which means it does one thing and one thing only, instead of trying to solve each and every problem. While doing that one thing it does well, the micro-framework should do it while being expressive and concise. Further, it should be able to serve as one component of your own custom modularized framework, allowing you to compose solutions.
17
+ A micro-framework provides a focused solution, which means it does one thing and one thing only, instead of trying to solve each and every problem. While doing that one thing it does well, the micro-framework should do it while being expressive yet concise. Further, it should be able to serve as one component of your own custom modularized framework, allowing you to compose solutions. To that end, you can use Symbiont directly as an automated test library or you can use it with other tools such as [RSpec](http://rspec.info/), [Cucumber](http://cukes.info/), or my own [Specify](https://github.com/jnyman/specify) tool.
20
18
 
21
- To that end, you can use Symbiont directly as an automated test library or you can use it with other tools such as [RSpec](http://rspec.info/), [Cucumber](http://cukes.info/), or my own [Lucid](https://github.com/jnyman/lucid) tool.
19
+ In terms of what Symbiont does, it provides a way to describe your application in terms of activity and page definitions. Those definitions can then be referenced as part of the DSL that Symbiont provides. This DSL can be utilized in the context of the [Watir-WebDriver test library](https://github.com/watir/watir-webdriver).
22
20
 
23
- In terms of what Symbiont does, it provides a way to describe your application in terms of activity and page definitions. Those definitions can then be referenced by the [Watir-WebDriver test library](https://github.com/watir/watir-webdriver) using the DSL and API that Symbiont provides. The DSL provides a fluent interface that can be used for constructing test execution logic. This fluent interface promotes the idea of compressibility of your test logic, allowing for more factoring, more reuse, and less repetition.
21
+ The DSL provides a fluent interface that can be used for constructing test execution logic. This fluent interface promotes the idea of compressibility of your test logic, allowing for more factoring, more reuse, and less repetition.
24
22
 
25
23
 
26
24
  ## Installation
27
25
 
28
- You can use Symbiont as part of another project, in which case you can add the following to your Gemfile:
26
+ To get the latest stable release, add this line to your application's Gemfile:
29
27
 
30
28
  gem 'symbiont'
31
29
 
32
- And then execute:
30
+ To get the latest code:
31
+
32
+ ```ruby
33
+ gem 'symbiont', git: https://github.com/jnyman/symbiont
34
+ ```
35
+
36
+ After doing one of the above, execute the following command:
33
37
 
34
38
  $ bundle
35
39
 
@@ -57,6 +61,10 @@ So, with that bit of context, think of this library as a facultative, endosymbio
57
61
 
58
62
  ## Contributing
59
63
 
64
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/jnyman/symbiont](https://github.com/jnyman/symbiont). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another testing tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
+
66
+ To contribute to Symbiont:
67
+
60
68
  1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/) ( https://github.com/[my-github-username]/symbiont/fork ).
61
69
  2. Create your feature branch. (`git checkout -b my-new-feature`)
62
70
  3. Commit your changes. (`git commit -am 'new feature'`)
data/Rakefile CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env rake
2
2
  require 'bundler/gem_tasks'
3
+ require 'rdoc/task'
4
+ require 'rubocop/rake_task'
3
5
  require 'rspec/core/rake_task'
4
6
 
7
+ RuboCop::RakeTask.new
8
+
5
9
  namespace :test do
6
10
  desc 'Run the Symbiont script.'
7
11
  task :script do
@@ -15,7 +19,7 @@ namespace :spec do
15
19
  system('rm -rf spec/reports')
16
20
  end
17
21
 
18
- RSpec::Core::RakeTask.new(:all => :clean) do |config|
22
+ RSpec::Core::RakeTask.new(all: :clean) do |config|
19
23
  options = %w(--color)
20
24
  options += %w(--format documentation)
21
25
  options += %w(--format html --out spec/reports/symbiont-test-report.html)
@@ -24,4 +28,11 @@ namespace :spec do
24
28
  end
25
29
  end
26
30
 
27
- task default: %w(spec:all)
31
+ Rake::RDocTask.new do |rdoc|
32
+ rdoc.rdoc_dir = 'doc'
33
+ rdoc.main = 'README.md'
34
+ rdoc.title = "Symbiont #{Symbiont::VERSION}"
35
+ rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
36
+ end
37
+
38
+ task default: ['spec:all', :rubocop]
data/bin/console CHANGED
@@ -6,5 +6,5 @@ require 'symbiont'
6
6
  require 'pry'
7
7
  Pry.start
8
8
 
9
- require 'irb'
10
- IRB.start
9
+ # require 'irb'
10
+ # IRB.start
@@ -1,9 +1,9 @@
1
- module Symbiont
2
- module Accessor
3
- # @param element [Symbol] name of Watir-based object
4
- # @param locator [Hash] locators for referencing the element
5
- def reference_element(element, locator)
6
- browser.send(element, locator)
7
- end
8
- end
9
- end
1
+ module Symbiont
2
+ module Accessor
3
+ # @param element [Symbol] name of Watir-based object
4
+ # @param locator [Hash] locators for referencing the element
5
+ def reference_element(element, locator)
6
+ browser.send(element, locator)
7
+ end
8
+ end
9
+ end
@@ -1,33 +1,33 @@
1
- module Symbiont
2
- module Assertion
3
- include Helpers
4
-
5
- def url_is(url=nil)
6
- url_is_empty if url.nil? or url.empty?
7
- @url = url
8
- end
9
-
10
- def url_matches(pattern=nil)
11
- url_match_is_empty if pattern.nil?
12
- url_match_is_empty if pattern.is_a?(String) and pattern.empty?
13
- @url_match = pattern
14
- end
15
-
16
- def title_is(title=nil)
17
- title_is_empty if title.nil? or title.empty?
18
- @title = title
19
- end
20
-
21
- def asserted_url
22
- @url
23
- end
24
-
25
- def url_match
26
- @url_match
27
- end
28
-
29
- def asserted_title
30
- @title
31
- end
32
- end
33
- end
1
+ module Symbiont
2
+ module Assertion
3
+ include Helpers
4
+
5
+ def url_is(url = nil)
6
+ url_is_empty if url.nil? || url.empty?
7
+ @url = url
8
+ end
9
+
10
+ def url_matches(pattern = nil)
11
+ url_match_is_empty if pattern.nil?
12
+ url_match_is_empty if pattern.is_a?(String) && pattern.empty?
13
+ @url_match = pattern
14
+ end
15
+
16
+ def title_is(title = nil)
17
+ title_is_empty if title.nil? || title.empty?
18
+ @title = title
19
+ end
20
+
21
+ def asserted_url
22
+ @url
23
+ end
24
+
25
+ def url_match
26
+ @url_match
27
+ end
28
+
29
+ def asserted_title
30
+ @title
31
+ end
32
+ end
33
+ end
@@ -1,35 +1,35 @@
1
- module Symbiont
2
- module DataBuilder
3
- extend DataReader
4
-
5
- class << self
6
- attr_accessor :data_source
7
-
8
- def default_data_path
9
- 'data'
10
- end
11
- end
12
-
13
- def data_about(key, specified={})
14
- if key.is_a?(String) && key.match(%r{/})
15
- file, record = key.split('/')
16
- DataBuilder.load("#{file}.yml")
17
- else
18
- record = key.to_s
19
- DataBuilder.load('default.yml')
20
- end
21
-
22
- Symbiont::trace("DataBuilder.data_source = #{DataBuilder.data_source}")
23
-
24
- data = DataBuilder.data_source[record]
25
- raise ArgumentError, "Undefined key for data: #{key}" unless data
26
-
27
- data.merge(specified)
28
- end
29
-
30
- alias_method :data_from, :data_about
31
- alias_method :data_for, :data_about
32
- alias_method :using_data_for, :data_about
33
- alias_method :using_data_from, :data_about
34
- end
35
- end
1
+ module Symbiont
2
+ module DataBuilder
3
+ extend DataReader
4
+
5
+ class << self
6
+ attr_accessor :data_source
7
+
8
+ def default_data_path
9
+ 'data'
10
+ end
11
+ end
12
+
13
+ def data_about(key, specified = {})
14
+ if key.is_a?(String) && key.match(%r{/})
15
+ file, record = key.split('/')
16
+ DataBuilder.load("#{file}.yml")
17
+ else
18
+ record = key.to_s
19
+ DataBuilder.load('default.yml')
20
+ end
21
+
22
+ Symbiont.trace("DataBuilder.data_source = #{DataBuilder.data_source}")
23
+
24
+ data = DataBuilder.data_source[record]
25
+ raise ArgumentError, "Undefined key for data: #{key}" unless data
26
+
27
+ data.merge(specified)
28
+ end
29
+
30
+ alias_method :data_from, :data_about
31
+ alias_method :data_for, :data_about
32
+ alias_method :using_data_for, :data_about
33
+ alias_method :using_data_from, :data_about
34
+ end
35
+ end
@@ -1,22 +1,20 @@
1
- module Symbiont
2
- module DataReader
3
-
4
- def data_path=(path)
5
- @data_path = path
6
- end
7
-
8
- def data_path
9
- return @data_path if @data_path
10
- return default_data_path if self.respond_to? :default_data_path
11
- nil
12
- end
13
-
14
- # The data_source name here must match the name used for the
15
- # class accessor in the data builder. It is this data_source
16
- # variable that connects the reader and the builder.
17
- def load(file)
18
- @data_source = YAML.load_file "#{data_path}/#{file}"
19
- end
20
-
21
- end
22
- end
1
+ module Symbiont
2
+ module DataReader
3
+ def data_path=(path)
4
+ @data_path = path
5
+ end
6
+
7
+ def data_path
8
+ return @data_path if @data_path
9
+ return default_data_path if self.respond_to? :default_data_path
10
+ nil
11
+ end
12
+
13
+ # The data_source name here must match the name used for the
14
+ # class accessor in the data builder. It is this data_source
15
+ # variable that connects the reader and the builder.
16
+ def load(file)
17
+ @data_source = YAML.load_file "#{data_path}/#{file}"
18
+ end
19
+ end
20
+ end
@@ -1,32 +1,39 @@
1
- module Symbiont
2
- module DataSetter
3
- # @param data [Hash] the data to use
4
- def using(data)
5
- data.each do |key, value|
6
- use_data_with(key, value) if object_enabled_for(key)
7
- end
8
- end
9
-
10
- alias_method :using_data, :using
11
- alias_method :use_data, :using
12
- alias_method :using_values, :using
13
- alias_method :use_values, :using
14
-
15
- def use_data_with(key, value)
16
- element = self.send("#{key}")
17
- self.call_method_chain("#{key}.set", value) if element.class == Watir::TextField
18
- self.call_method_chain("#{key}.set") if element.class == Watir::Radio
19
- self.call_method_chain("#{key}.select", value) if element.class == Watir::Select
20
-
21
- return self.call_method_chain("#{key}.check") if element.class == Watir::CheckBox and value
22
- return self.call_method_chain("#{key}.uncheck") if element.class == Watir::CheckBox
23
- end
24
-
25
- private
26
-
27
- def object_enabled_for(key)
28
- web_element = self.send("#{key}")
29
- web_element.enabled? and web_element.visible?
30
- end
31
- end
32
- end
1
+ module Symbiont
2
+ module DataSetter
3
+ # @param data [Hash] the data to use
4
+ def using(data)
5
+ data.each do |key, value|
6
+ use_data_with(key, value) if object_enabled_for(key)
7
+ end
8
+ end
9
+
10
+ alias_method :using_data, :using
11
+ alias_method :use_data, :using
12
+ alias_method :using_values, :using
13
+ alias_method :use_values, :using
14
+
15
+ def use_data_with(key, value)
16
+ element = send("#{key}")
17
+ set_and_select(element, value)
18
+ check_and_uncheck(element, value)
19
+ end
20
+
21
+ private
22
+
23
+ def set_and_select(element, value)
24
+ call_method_chain("#{key}.set", value) if element.class == Watir::TextField
25
+ call_method_chain("#{key}.set") if element.class == Watir::Radio
26
+ call_method_chain("#{key}.select", value) if element.class == Watir::Select
27
+ end
28
+
29
+ def check_and_uncheck(element, value)
30
+ return call_method_chain("#{key}.check") if element.class == Watir::CheckBox && value
31
+ return call_method_chain("#{key}.uncheck") if element.class == Watir::CheckBox
32
+ end
33
+
34
+ def object_enabled_for(key)
35
+ web_element = send("#{key}")
36
+ web_element.enabled? && web_element.visible?
37
+ end
38
+ end
39
+ end