tsuite 0.1.5

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e7ffdd91582326e57046e17196cbbdb9515b9373
4
+ data.tar.gz: d959eefb5c58282e8adc745f7bf326d2f74387b8
5
+ SHA512:
6
+ metadata.gz: 8cba0a1f002f69f1f2f08cce1c34a63f14e7a878bc9eb30c7b2e0f0183403766bb2e0854463798c3f4d7c7433fe7c95fb44b64c4a5e4f4e635de9c7faae71fb4
7
+ data.tar.gz: 4a2448a8759b0aedda47baaafdadb181afda97006f5f7c479311cb8498616e87df314b18342d138879a1902fdc7a73bd2513c70efd8828e12eb16197ad38af2b
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.8
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at lthwaits@hotmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tsuite.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ # Tsuite
2
+
3
+ Ever get tired of adding multiple gems for testing Rails apps? Add this one line to your Gemfile:
4
+
5
+ ```ruby
6
+ gem 'tsuite', group: :test
7
+ ```
8
+
9
+ and you'll get these 7 gems:
10
+
11
+ * rspec-rails
12
+ * cucumber-rails
13
+ * database_cleaner
14
+ * simplecov
15
+ * launchy
16
+ * rack_session_access
17
+ * poltergeist
18
+
19
+ Bundle, and then it's easy to configure everything with one generator:
20
+
21
+ $ rails g tsuite:install
22
+
23
+ Additionally, with RSpec tests you have a new block you can use to selectively
24
+ cause a group of "it" blocks to run sequentially, without transaction rollbacks:
25
+
26
+ ```ruby
27
+ describe Item do
28
+ before(:all) do
29
+ @red_item = Item.create(color: "red", is_fixed_color: false, cost: 100)
30
+ @blue_item = Item.create(color: "red", is_fixed_color: true, cost: 100)
31
+ end
32
+
33
+ context "with a non-fixed color"
34
+ without_transactions do # <== MAKES THIS PART RUN CUMULATIVELY
35
+ it "should be able to change color" do
36
+ @red_item.update(color: "green")
37
+ expect(@red_item).to be_valid
38
+ end
39
+ it "will still be the same changed color in another example" do
40
+ # Look ma, no rollback:
41
+ expect(@red_item.color).to eq("green")
42
+ end
43
+ end
44
+ end
45
+
46
+ context "with a fixed color"
47
+ # ...
48
+ end
49
+ end
50
+ ```
51
+
52
+ Another enhancement for Cucumber testing is to allow most scenarios to run
53
+ with Selenium, and only run selective scenarios with Poltergeist by using this
54
+ syntax:
55
+
56
+ ```ruby
57
+ @poltergeist
58
+ Scenario: Viewing the home page
59
+ Given I am logged on as a "Travel Agent"
60
+ When p_I go to the home page
61
+ Then p_I should see a list of countries
62
+ ```
63
+
64
+ ## A shout out:
65
+
66
+ Props out to Ketan Patel who came up with the original idea for this gem.
67
+
68
+ ## Contributing
69
+
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lorint/tsuite. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
71
+
72
+
73
+ ## License
74
+
75
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'tasks/install_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tsuite"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,19 @@
1
+ require 'rails/generators'
2
+ module Tsuite
3
+ class InstallGenerator < Rails::Generators::Base
4
+ desc "Add the rspec \"spec\" and cucumber \"features\" folders, plus support for @poltergeist"
5
+
6
+ def self.source_root
7
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
8
+ end
9
+
10
+ # Can add command line options defined like Thor:
11
+ # class_option :extra, :desc => "Add extra stuff", :type => :boolean, :default => false
12
+ # Reference these options later with options[:my_opt]
13
+ def install
14
+ generate "rspec:install"
15
+ generate "cucumber:install"
16
+ template 'features/support/poltergeist.rb'
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ require 'capybara/poltergeist'
2
+
3
+ # Allow individual cucumber scenarios to work with Poltergeist instead of selenium
4
+ Around('@poltergeist') do |scenario, block|
5
+ @capy_def_driver = Capybara.default_driver
6
+ @capy_js_driver = Capybara.javascript_driver
7
+ # Just for this scenario, let's go Poltergeist
8
+ Capybara.default_driver = :poltergeist
9
+ Capybara.javascript_driver = :poltergeist
10
+ block.call
11
+ # Reset it back to the original
12
+ Capybara.default_driver = @capy_def_driver # Usually :rack_test
13
+ Capybara.javascript_driver = @capy_js_driver # Usually :selenium
14
+ end
@@ -0,0 +1,18 @@
1
+ module Tsuite
2
+ class InstallTask
3
+ if defined? Rake::DSL
4
+ include Rake::DSL
5
+ end
6
+ def install_tasks
7
+ namespace :tsuite do
8
+ desc 'Set up rspec and cucumber environments'
9
+ task :install do
10
+ sh "rails g rspec:install"
11
+ sh "rails g cucumber:install"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ Tsuite::InstallTask.new.install_tasks
@@ -0,0 +1,53 @@
1
+ require 'tsuite/version'
2
+ require 'rspec/rails/feature_check'
3
+
4
+ # module Tsuite
5
+ # end
6
+
7
+ if RSpec::Rails::FeatureCheck.has_active_record?
8
+ require 'rspec/core'
9
+ RSpec.configure do |config|
10
+ # Force a "describe" block to work sequentially
11
+ # instead of by using transactions (normally the default)
12
+ # so that you can set up something using before(:all) and have it
13
+ # be cumulative over multiple "it" examples.
14
+ def without_transactions(&block)
15
+ before(:all) do
16
+ if defined?(DatabaseCleaner)
17
+ @previous_database_cleaner_strategy_setting = DatabaseCleaner.strategy
18
+ DatabaseCleaner.strategy = :truncation
19
+ end
20
+ @previous_transactional_fixture_setting = self.use_transactional_fixtures
21
+ self.use_transactional_fixtures = false
22
+ end
23
+
24
+ yield
25
+
26
+ after(:all) do
27
+ DatabaseCleaner.strategy = @previous_database_cleaner_strategy_setting if defined?(DatabaseCleaner)
28
+ self.use_transactional_fixtures = @previous_transactional_fixture_setting
29
+ end
30
+ end
31
+
32
+ # Force a "describe" block have each "it" example operate independently,
33
+ # so that each example starts with the same condition established by any
34
+ # before(:all) or before(:each) blocks.
35
+ def with_transactions(&block)
36
+ before(:all) do
37
+ if defined?(DatabaseCleaner)
38
+ @previous_database_cleaner_strategy_setting = DatabaseCleaner.strategy
39
+ DatabaseCleaner.strategy = :transaction
40
+ end
41
+ @previous_transactional_fixture_setting = self.use_transactional_fixtures
42
+ self.use_transactional_fixtures = false
43
+ end
44
+
45
+ yield
46
+
47
+ after(:all) do
48
+ DatabaseCleaner.strategy = @previous_database_cleaner_strategy_setting if defined?(DatabaseCleaner)
49
+ self.use_transactional_fixtures = @previous_transactional_fixture_setting
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ module Tsuite
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tsuite/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tsuite"
8
+ spec.version = Tsuite::VERSION
9
+ spec.authors = ["Ketan Patel", "Lorin Thwaits"]
10
+ spec.email = ["lorint@gmail.com"]
11
+
12
+ spec.summary = %q{7 Rails testing gems conveniently rolled into one}
13
+ spec.description = %q{Just run rails g tsuite:install and start testing with rspec and cucumber!}
14
+ spec.homepage = "https://github.com/lorint/tsuite"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.add_dependency "selenium-webdriver"
26
+ spec.add_dependency "poltergeist"
27
+ spec.add_dependency "rspec-rails"
28
+ spec.add_dependency "cucumber-rails"
29
+ spec.add_dependency "database_cleaner"
30
+ spec.add_dependency "simplecov"
31
+ spec.add_dependency "launchy"
32
+ spec.add_dependency "rack_session_access"
33
+
34
+
35
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
36
+ spec.bindir = "exe"
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ["lib"]
39
+
40
+ spec.add_development_dependency "bundler", "~> 1.11"
41
+ spec.add_development_dependency "rake", "~> 10.0"
42
+ spec.add_development_dependency "rspec", "~> 3.0"
43
+
44
+ spec.post_install_message = "Your test suite is complete, and now you can run \"rails g tsuite:install\"."
45
+ end
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tsuite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Ketan Patel
8
+ - Lorin Thwaits
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2016-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: selenium-webdriver
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: poltergeist
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: cucumber-rails
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: database_cleaner
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: simplecov
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: launchy
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rack_session_access
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: bundler
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '1.11'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '1.11'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rake
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '10.0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '10.0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: rspec
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '3.0'
168
+ description: Just run rails g tsuite:install and start testing with rspec and cucumber!
169
+ email:
170
+ - lorint@gmail.com
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - ".gitignore"
176
+ - ".rspec"
177
+ - ".travis.yml"
178
+ - CODE_OF_CONDUCT.md
179
+ - Gemfile
180
+ - LICENSE.txt
181
+ - README.md
182
+ - Rakefile
183
+ - bin/console
184
+ - bin/setup
185
+ - lib/generators/tsuite/install_generator.rb
186
+ - lib/generators/tsuite/templates/features/support/poltergeist.rb
187
+ - lib/tasks/install_task.rb
188
+ - lib/tsuite.rb
189
+ - lib/tsuite/version.rb
190
+ - tsuite.gemspec
191
+ homepage: https://github.com/lorint/tsuite
192
+ licenses:
193
+ - MIT
194
+ metadata:
195
+ allowed_push_host: https://rubygems.org
196
+ post_install_message: Your test suite is complete, and now you can run "rails g tsuite:install".
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements: []
211
+ rubyforge_project:
212
+ rubygems_version: 2.5.1
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: 7 Rails testing gems conveniently rolled into one
216
+ test_files: []