sw2at-tw 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +157 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/sw2at-tw.gemspec +6 -9
- metadata +5 -19
- data/README.rdoc +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e5abd0f46c3c286cbfaef819073121390cf0635
|
4
|
+
data.tar.gz: aa97bb2b66d7cb18bb416cd5811ad397ba8c6592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe99bd4b2d79babbcf0a2b54864349bda23f7c9a3eb5e7af975551b42da271926934ad9ef83bdefff7d28be29db91a65d533b980de2484de400412f3c49a6aa
|
7
|
+
data.tar.gz: 451775490fadb836e1f564bb964aa5b70efb17a301cc77383f869fdf77cc2fa71964c03ff27a3de5057cac39ad4212d211b31ec2abff9f1755770dda353c09f8
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
# sw2at-tw
|
2
|
+
## SWAT(Simple Way to Automate Tests) - Test World
|
3
|
+
Gem for simplying initialization of complex data in your tests.
|
4
|
+
|
5
|
+
## How to install
|
6
|
+
|
7
|
+
Check this [example](https://github.com/tw4qa/swat-tw-example) or follow instructions below.
|
8
|
+
|
9
|
+
`gem install rails`
|
10
|
+
|
11
|
+
`rails new swat-tw-app`
|
12
|
+
|
13
|
+
`cd swat-tw-app`
|
14
|
+
|
15
|
+
`bundle install`
|
16
|
+
|
17
|
+
install RSpec
|
18
|
+
```ruby
|
19
|
+
group :development, :test do
|
20
|
+
gem 'rspec-rails', '~> 3.0'
|
21
|
+
end
|
22
|
+
```
|
23
|
+
`bundle install`
|
24
|
+
|
25
|
+
Add RSpec files.
|
26
|
+
|
27
|
+
`rails generate rspec:install`
|
28
|
+
|
29
|
+
Create some database for your app.
|
30
|
+
|
31
|
+
`rake db:create`
|
32
|
+
|
33
|
+
Add a model
|
34
|
+
|
35
|
+
`rails g model User`
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
class CreateUsers < ActiveRecord::Migration
|
39
|
+
def change
|
40
|
+
create_table :users do |t|
|
41
|
+
t.column :email, :string
|
42
|
+
t.column :full_name, :string
|
43
|
+
|
44
|
+
t.timestamps null: false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
`rake db:migrate`
|
51
|
+
|
52
|
+
|
53
|
+
Add TestWorld gem to your Gemfile
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
gem 'sw2at-tw', '0.0.3'
|
57
|
+
```
|
58
|
+
|
59
|
+
`bundle install`
|
60
|
+
|
61
|
+
Create your own TestWorld class.
|
62
|
+
|
63
|
+
"AppTestWorld" is a name of your Swat::TestWorld subclass, you can pass any name here.
|
64
|
+
|
65
|
+
`rails g swat:test_world:install AppTestWorld`
|
66
|
+
|
67
|
+
Edit your new class in Rails.root/lib/swat/AppTestWorld.rb
|
68
|
+
Add Methods:
|
69
|
+
```ruby
|
70
|
+
def init_situation
|
71
|
+
if @options[:john]
|
72
|
+
User.create(email: 'john.smith@gmail.com', full_name: 'John Smith')
|
73
|
+
end
|
74
|
+
|
75
|
+
if @options[:josh]
|
76
|
+
User.create(email: 'josh.doe@gmail.com', full_name: 'Josh Doe')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def some_very_specific_logic
|
81
|
+
puts 'Hello Test Word!'
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
Configure RSpec, add lines tp Rails.root/spec/spec_helper.rb
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
require 'sw2at-tw'
|
89
|
+
require_relative '../lib/swat/AppTestWorld'
|
90
|
+
Swat::TestWorld.setup(config, klass: AppTestWorld)
|
91
|
+
```
|
92
|
+
|
93
|
+
Use helpers in your test. Rails.root/spec/models/user_spec.rb
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
require 'rails_helper'
|
97
|
+
|
98
|
+
RSpec.describe User, type: :model do
|
99
|
+
|
100
|
+
context 'No Swat Options' do
|
101
|
+
init_tw
|
102
|
+
|
103
|
+
it 'should have Users' do
|
104
|
+
expect(User.count).to eq(0)
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'John created' do
|
110
|
+
init_tw( john: true )
|
111
|
+
|
112
|
+
it 'should have Users' do
|
113
|
+
|
114
|
+
expect(User.count).to eq(1)
|
115
|
+
john = User.where(email: 'john.smith@gmail.com').take
|
116
|
+
expect(john.full_name).to eq('John Smith')
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'John & Josh' do
|
122
|
+
init_tw( john: true, josh: true )
|
123
|
+
|
124
|
+
it 'should have Users' do
|
125
|
+
expect(User.all.map(&:full_name)).to eq([ 'John Smith', 'Josh Doe' ])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'Methods' do
|
130
|
+
init_tw
|
131
|
+
|
132
|
+
it 'should call Test World methods' do
|
133
|
+
@tw.some_very_specific_logic
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
Run RSpec
|
140
|
+
|
141
|
+
`rspec`
|
142
|
+
|
143
|
+
## Contributing to sw2at-tw
|
144
|
+
|
145
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
146
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
147
|
+
* Fork the project.
|
148
|
+
* Start a feature/bugfix branch.
|
149
|
+
* Commit and push until you are happy with your contribution.
|
150
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
151
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
152
|
+
|
153
|
+
# Copyright
|
154
|
+
|
155
|
+
Copyright (c) 2015 Vitaly Tarasenko. See LICENSE.txt for
|
156
|
+
further details.
|
157
|
+
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "sw2at-tw"
|
18
|
-
gem.homepage = "http://github.com/
|
18
|
+
gem.homepage = "http://github.com/tw4qa/sw2at-tw"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = %Q{ Swat Test World - Helper for test data generation. }
|
21
21
|
gem.description = %Q{ You can define your own strategies for test data generation. And simply create them in RSpec tests. }
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/sw2at-tw.gemspec
CHANGED
@@ -2,27 +2,27 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: sw2at-tw 0.0.
|
5
|
+
# stub: sw2at-tw 0.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "sw2at-tw"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Vitaly Tarasenko"]
|
14
|
-
s.date = "2015-06-
|
14
|
+
s.date = "2015-06-24"
|
15
15
|
s.description = " You can define your own strategies for test data generation. And simply create them in RSpec tests. "
|
16
16
|
s.email = "vetal.tarasenko@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
|
-
"README.
|
19
|
+
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
"Gemfile",
|
24
24
|
"LICENSE.txt",
|
25
|
-
"README.
|
25
|
+
"README.md",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"lib/sw2at-tw.rb",
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/swat/test_world/templates/test_world_subclass.rb",
|
36
36
|
"sw2at-tw.gemspec"
|
37
37
|
]
|
38
|
-
s.homepage = "http://github.com/
|
38
|
+
s.homepage = "http://github.com/tw4qa/sw2at-tw"
|
39
39
|
s.licenses = ["MIT"]
|
40
40
|
s.rubygems_version = "2.2.2"
|
41
41
|
s.summary = "Swat Test World - Helper for test data generation."
|
@@ -44,7 +44,6 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.specification_version = 4
|
45
45
|
|
46
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<sw2at-capybara>, ["~> 0.0.1"])
|
48
47
|
s.add_runtime_dependency(%q<timecop>, ["~> 0.7.1"])
|
49
48
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
50
49
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -52,7 +51,6 @@ Gem::Specification.new do |s|
|
|
52
51
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
53
52
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
54
53
|
else
|
55
|
-
s.add_dependency(%q<sw2at-capybara>, ["~> 0.0.1"])
|
56
54
|
s.add_dependency(%q<timecop>, ["~> 0.7.1"])
|
57
55
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
58
56
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -61,7 +59,6 @@ Gem::Specification.new do |s|
|
|
61
59
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
62
60
|
end
|
63
61
|
else
|
64
|
-
s.add_dependency(%q<sw2at-capybara>, ["~> 0.0.1"])
|
65
62
|
s.add_dependency(%q<timecop>, ["~> 0.7.1"])
|
66
63
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
67
64
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sw2at-tw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitaly Tarasenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: sw2at-capybara
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.1
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: timecop
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,12 +101,12 @@ executables: []
|
|
115
101
|
extensions: []
|
116
102
|
extra_rdoc_files:
|
117
103
|
- LICENSE.txt
|
118
|
-
- README.
|
104
|
+
- README.md
|
119
105
|
files:
|
120
106
|
- .document
|
121
107
|
- Gemfile
|
122
108
|
- LICENSE.txt
|
123
|
-
- README.
|
109
|
+
- README.md
|
124
110
|
- Rakefile
|
125
111
|
- VERSION
|
126
112
|
- lib/sw2at-tw.rb
|
@@ -132,7 +118,7 @@ files:
|
|
132
118
|
- lib/swat/test_world/templates/methods.rb
|
133
119
|
- lib/swat/test_world/templates/test_world_subclass.rb
|
134
120
|
- sw2at-tw.gemspec
|
135
|
-
homepage: http://github.com/
|
121
|
+
homepage: http://github.com/tw4qa/sw2at-tw
|
136
122
|
licenses:
|
137
123
|
- MIT
|
138
124
|
metadata: {}
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= sw2at-tw
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to sw2at-tw
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2015 Vitaly Tarasenko. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|