app-tester 0.1.0 → 0.1.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.
- data/README.md +39 -3
- data/lib/app-tester/test.rb +2 -6
- metadata +2 -2
data/README.md
CHANGED
@@ -91,7 +91,7 @@ Connecting to https://github.com...
|
|
91
91
|
* faraday >= 0.8.4
|
92
92
|
* optparse
|
93
93
|
|
94
|
-
##
|
94
|
+
## Install
|
95
95
|
|
96
96
|
It's very easy to install.
|
97
97
|
|
@@ -101,6 +101,41 @@ gem install app-tester
|
|
101
101
|
|
102
102
|
Done! :)
|
103
103
|
|
104
|
+
## Dealing with expectations
|
105
|
+
|
106
|
+
One of the really nice features of this gem is that resembles a lot how RSpec works in terms of expectations.
|
107
|
+
|
108
|
+
So lets assume that you want to test some kind of expectation:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
require "app-tester"
|
112
|
+
|
113
|
+
apptester = AppTester.new do |options|
|
114
|
+
options.add_environment :github => "https://github.com"
|
115
|
+
options.add_environment :google => "https://google.com"
|
116
|
+
options.default_environment = :google
|
117
|
+
end
|
118
|
+
|
119
|
+
apptester.define_test "my test to fail" do
|
120
|
+
var = true
|
121
|
+
|
122
|
+
var.should be_nil
|
123
|
+
end
|
124
|
+
|
125
|
+
apptester.run_test "my test to fail"
|
126
|
+
```
|
127
|
+
|
128
|
+
When you run this test you'll get the following output:
|
129
|
+
|
130
|
+
```
|
131
|
+
$ ruby examples/expectations.rb
|
132
|
+
Connecting to https://google.com...
|
133
|
+
[FAILED] expected: nil
|
134
|
+
got: true on line 12
|
135
|
+
```
|
136
|
+
|
137
|
+
Take a loot at [RSpec::Matches][] for more information on which matchers you can use
|
138
|
+
|
104
139
|
## Adding colours to your tests
|
105
140
|
|
106
141
|
AppTester has a useful helper class that enables anyone to add colours to the tests.
|
@@ -262,5 +297,6 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
262
297
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
263
298
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
264
299
|
|
265
|
-
[
|
266
|
-
[
|
300
|
+
[rspec_matches]: http://rubydoc.info/gems/rspec-expectations/2.4.0/RSpec/Matchers
|
301
|
+
[jruby]: http://jruby.org/
|
302
|
+
[rubinius]: http://rubini.us/
|
data/lib/app-tester/test.rb
CHANGED
@@ -38,15 +38,11 @@ module AppTester
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def get url="", parameters={}
|
41
|
-
connection.get
|
42
|
-
request.url "/", parameters
|
43
|
-
end
|
41
|
+
connection.get url, parameters
|
44
42
|
end
|
45
43
|
|
46
44
|
def post url="", parameters={}
|
47
|
-
connection.post
|
48
|
-
request.url url, parameters
|
49
|
-
end
|
45
|
+
connection.post url, parameters
|
50
46
|
end
|
51
47
|
|
52
48
|
# Run test
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|