app-tester 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -10
- data/lib/app-tester/options.rb +7 -3
- data/lib/app-tester/parser.rb +15 -6
- data/lib/app-tester/test.rb +8 -5
- data/lib/app-tester/timer.rb +4 -8
- data/lib/app-tester/utils/strings.rb +1 -0
- data/lib/app-tester.rb +23 -14
- data/spec/app-tester_spec.rb +53 -59
- metadata +104 -109
- data/test/test_app-tester.rb +0 -11
- data/test/test_helper.rb +0 -3
data/README.md
CHANGED
@@ -28,10 +28,11 @@ apptester = AppTester.new do |options|
|
|
28
28
|
options.add_environment :github => "https://github.com"
|
29
29
|
options.add_environment :google => "https://google.com"
|
30
30
|
options.default_environment = :google # A default environment can be specified
|
31
|
+
options.add_default_option(:something, '-a', '--something', 'this is an option')
|
31
32
|
end
|
32
33
|
|
33
34
|
# Define your tests
|
34
|
-
apptester.define_test "my test" do
|
35
|
+
apptester.define_test "my test" do
|
35
36
|
# Perform a get request to "/"
|
36
37
|
result1 = get "/"
|
37
38
|
# Perform a post request to "/" with token as parameter
|
@@ -46,16 +47,36 @@ apptester.define_test "my test" do |arguments, connection|
|
|
46
47
|
|
47
48
|
# Convert a file to an array
|
48
49
|
p AppTester::Utils.file_to_array arguments[:file] unless arguments[:file].nil?
|
50
|
+
|
49
51
|
end
|
50
52
|
|
51
53
|
apptester.set_options_for "my test" do |options_parser|
|
52
54
|
options_parser.set_option(:file, "-f", "--file FILE", "File to load")
|
53
|
-
options_parser.mandatory_options = 1
|
54
55
|
end
|
55
56
|
|
56
57
|
apptester.run_test "my test"
|
57
58
|
```
|
58
59
|
|
60
|
+
You can define multiple tests by adding more define_test blocks. In this case you might want to run them all, and
|
61
|
+
for this use the following syntax:
|
62
|
+
|
63
|
+
```
|
64
|
+
apptester.run_all
|
65
|
+
```
|
66
|
+
|
67
|
+
You can set a default_option with hte AppTester initialization block,
|
68
|
+
this option will be inherited by all the defined tests.
|
69
|
+
|
70
|
+
You can set mandatory arguments for your tests by passing true as the final argument to set_option :
|
71
|
+
|
72
|
+
```
|
73
|
+
apptester.set_options_for "my test" do |options_parser|
|
74
|
+
options_parser.set_option(:file, "-f", "--file FILE", "File to load", true)
|
75
|
+
end
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
59
80
|
Assuming that this is in a file called my_test.rb, you can run it, via command line:
|
60
81
|
|
61
82
|
```
|
@@ -134,7 +155,7 @@ Connecting to https://google.com...
|
|
134
155
|
got: true on line 12
|
135
156
|
```
|
136
157
|
|
137
|
-
Take a loot at [RSpec::Matches]
|
158
|
+
Take a loot at [RSpec::Matches](http://rubydoc.info/gems/rspec-expectations/2.4.0/RSpec/Matchers) for more information on which matchers you can use
|
138
159
|
|
139
160
|
## Adding colours to your tests
|
140
161
|
|
@@ -151,7 +172,7 @@ apptester = AppTester.new do |options|
|
|
151
172
|
end
|
152
173
|
|
153
174
|
# Define your tests
|
154
|
-
apptester.define_test "my test"
|
175
|
+
apptester.define_test "my test"
|
155
176
|
result = get "/"
|
156
177
|
|
157
178
|
puts "#{AppTester::Utils::Colours.red("Hello")} #{AppTester::Utils::Colours.green("World")}"
|
@@ -194,7 +215,7 @@ apptester = AppTester.new do |options|
|
|
194
215
|
end
|
195
216
|
|
196
217
|
# Define your tests
|
197
|
-
apptester.define_test "my test" do
|
218
|
+
apptester.define_test "my test" do
|
198
219
|
result = get "/"
|
199
220
|
|
200
221
|
AppTester::Timer.new("test timer 1") do
|
@@ -238,7 +259,7 @@ apptester = AppTester.new do |options|
|
|
238
259
|
options.default_environment = :google
|
239
260
|
end
|
240
261
|
|
241
|
-
apptester.define_test "my test" do
|
262
|
+
apptester.define_test "my test" do
|
242
263
|
result = get "/"
|
243
264
|
|
244
265
|
AppTester::Checker.status result
|
@@ -252,7 +273,6 @@ end
|
|
252
273
|
|
253
274
|
apptester.set_options_for "my test" do |options_parser|
|
254
275
|
options_parser.set_option(:file, "-f", "--file FILE", "File to load")
|
255
|
-
options_parser.mandatory_options = 1
|
256
276
|
end
|
257
277
|
|
258
278
|
apptester.run_test "my test"
|
@@ -296,7 +316,6 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
296
316
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
297
317
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
298
318
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
299
|
-
|
300
|
-
[rspec_matches]: http://rubydoc.info/gems/rspec-expectations/2.4.0/RSpec/Matchers
|
319
|
+
|
301
320
|
[jruby]: http://jruby.org/
|
302
|
-
[rubinius]: http://rubini.us/
|
321
|
+
[rubinius]: http://rubini.us/
|
data/lib/app-tester/options.rb
CHANGED
@@ -9,13 +9,13 @@ module AppTester
|
|
9
9
|
attr_accessor :default_environment
|
10
10
|
attr_accessor :log_connections
|
11
11
|
attr_accessor :environments
|
12
|
-
|
12
|
+
attr_accessor :default_options
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@environments = {}
|
16
16
|
@default_environment = nil
|
17
17
|
@log_connections = false
|
18
|
-
|
18
|
+
@default_options = []
|
19
19
|
end
|
20
20
|
|
21
21
|
# Add a new environment to the environment list. This will be used when constructing AppTester::Parser object
|
@@ -27,5 +27,9 @@ module AppTester
|
|
27
27
|
@environments.merge! environment
|
28
28
|
self
|
29
29
|
end
|
30
|
+
|
31
|
+
def add_default_option(symbol, *opts, &block)
|
32
|
+
@default_options << {symbol: symbol, opts: opts, block: block }
|
33
|
+
end
|
30
34
|
end
|
31
|
-
end
|
35
|
+
end
|
data/lib/app-tester/parser.rb
CHANGED
@@ -5,14 +5,11 @@ module AppTester
|
|
5
5
|
# @see http://ruby-doc.org/stdlib-1.9.3/libdoc/optparse/rdoc/OptionParser.html
|
6
6
|
# @attr_reader test_options [AppTester::Options] the options that the user defined when he created the framework
|
7
7
|
# @attr_reader options [Hash] command line arguments that were set when executing the script
|
8
|
-
# @attr_writer mandatory_options [Number] minimum number of command line arguments for this script to run
|
9
8
|
class Parser < OptionParser
|
10
9
|
|
11
10
|
attr_reader :test_options
|
12
11
|
attr_reader :options
|
13
12
|
|
14
|
-
attr_accessor :mandatory_options
|
15
|
-
|
16
13
|
# Build Parser object. Automatically builds with --server argument
|
17
14
|
#
|
18
15
|
# @param options [AppTester::Options] the options that the user defined when he created the framework
|
@@ -21,7 +18,8 @@ module AppTester
|
|
21
18
|
def initialize options
|
22
19
|
@options = { }
|
23
20
|
@test_options = options
|
24
|
-
@
|
21
|
+
@mandatory_arguments = {}
|
22
|
+
@missing_arguments = []
|
25
23
|
super do |x|
|
26
24
|
x.separator ''
|
27
25
|
end
|
@@ -31,17 +29,22 @@ module AppTester
|
|
31
29
|
@options[:server] = @test_options.environments[default_environment]
|
32
30
|
|
33
31
|
set_option(:server, "-s", "--server OPT", @test_options.environments.keys, "Server to connect. Default: #{default_environment}")
|
32
|
+
|
33
|
+
options.default_options.each do |opt|
|
34
|
+
set_option(opt[:symbol].to_sym, *opt[:opts], &opt[:block])
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
38
|
# Add a new option to our optparser
|
37
39
|
#
|
38
40
|
# @param symbol [Symbol] identifier that will be used on the yielded block on define_test
|
39
|
-
# @param opts [
|
41
|
+
# @param opts [Array] command line options definition
|
40
42
|
# @param block [Proc] custom code to be executed. Optional
|
41
43
|
#
|
42
44
|
# @see AppTester
|
43
45
|
# @see OptionParser
|
44
46
|
def set_option(symbol, *opts, &block)
|
47
|
+
@mandatory_arguments[symbol] = {:key => symbol, :argument => opts[0], :switch => opts[1]} if opts[3] == true
|
45
48
|
if block.nil?
|
46
49
|
on(*opts) do |x|
|
47
50
|
case symbol
|
@@ -56,5 +59,11 @@ module AppTester
|
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
62
|
+
def check_mandatory_arguments
|
63
|
+
@mandatory_arguments.each{|a| a = a[1]; @missing_arguments << "Please supply #{a[:argument]} / #{a[:switch]}" unless @options[a[:key]] }
|
64
|
+
@missing_arguments.each{|a| puts a }
|
65
|
+
exit(1) if @missing_arguments.any?
|
66
|
+
end
|
67
|
+
|
59
68
|
end
|
60
|
-
end
|
69
|
+
end
|
data/lib/app-tester/test.rb
CHANGED
@@ -45,25 +45,28 @@ module AppTester
|
|
45
45
|
connection.post url, parameters
|
46
46
|
end
|
47
47
|
|
48
|
+
BacktraceObject = Struct.new(:path, :line_number, :where)
|
49
|
+
|
48
50
|
# Run test
|
49
51
|
def run(arguments=ARGV)
|
50
52
|
append_help_option
|
51
53
|
@parser.parse!(arguments)
|
52
|
-
|
53
|
-
raise OptionParser::MissingArgument if @parser.mandatory_options + 2 > @parser.options.size + 1
|
54
|
+
@parser.check_mandatory_arguments
|
54
55
|
@connection = AppTester::Connection.new @parser.options[:server], @options
|
55
56
|
@self_before_instance_eval = eval "self", @source.binding
|
56
57
|
begin
|
57
58
|
self.instance_eval &@source
|
58
59
|
rescue RSpec::Expectations::ExpectationNotMetError => excp
|
59
60
|
unless defined? IS_RSPEC
|
61
|
+
# Extract and create a backtrace object
|
60
62
|
backtrace = excp.backtrace.map { |x|
|
61
63
|
x.match(/^(.+?):(\d+)(|:in `(.+)')$/);
|
62
|
-
|
64
|
+
BacktraceObject.new($1, $2, $4)
|
63
65
|
}
|
64
66
|
line_number = 0
|
65
|
-
|
66
|
-
|
67
|
+
# Because the correct line number is not the first on the error stack we need to iterate it and find what we want
|
68
|
+
backtrace.each do |backtrace_entry|
|
69
|
+
line_number = backtrace_entry.line_number if backtrace_entry.where == "block in <main>"
|
67
70
|
end
|
68
71
|
puts "#{AppTester::Utils::Strings::FAILED} #{excp.message} on line #{line_number}"
|
69
72
|
end
|
data/lib/app-tester/timer.rb
CHANGED
@@ -26,20 +26,16 @@ module AppTester
|
|
26
26
|
end
|
27
27
|
end_time = Time.now
|
28
28
|
time_passed = ((end_time - beginning_time)*1000).round(3)
|
29
|
-
printf " "
|
30
29
|
|
31
30
|
threshold_message = ""
|
32
31
|
unless threshold.nil?
|
33
32
|
printf "#{AppTester::Utils::Strings::WARNING} " if time_passed.to_f > threshold.to_f
|
34
33
|
threshold_message = " (threshold: #{threshold} ms)"
|
35
34
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
else
|
40
|
-
puts AppTester::Utils::Colours.dark_gray "Time elapsed to #{message}, #{time_passed} milliseconds#{threshold_message}"
|
41
|
-
end
|
35
|
+
message = "to #{message}," if message
|
36
|
+
puts "Time elapsed #{message} #{time_passed} milliseconds#{threshold_message}"
|
37
|
+
puts ""
|
42
38
|
end
|
43
|
-
|
44
39
|
end
|
40
|
+
|
45
41
|
end
|
data/lib/app-tester.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
-
|
3
|
+
##
|
4
4
|
# @abstract AppTester main module and namespace
|
5
5
|
module AppTester
|
6
|
-
VERSION = '0.1.
|
6
|
+
VERSION = '0.1.2'
|
7
7
|
|
8
8
|
# @abstract AppTester main class
|
9
9
|
# @attr_reader [AppTester::Options] Options container. This will be shared across other classes
|
@@ -26,7 +26,7 @@ module AppTester
|
|
26
26
|
# options.log_connection = true
|
27
27
|
# end
|
28
28
|
def new
|
29
|
-
@tests =
|
29
|
+
@tests = []
|
30
30
|
@options = AppTester::Options.new
|
31
31
|
yield @options if block_given?
|
32
32
|
self
|
@@ -55,13 +55,11 @@ module AppTester
|
|
55
55
|
def define_test name="", &block
|
56
56
|
if name.empty?
|
57
57
|
raise AppTester::Error::NameEmptyError, "Attempted to define a test without a name"
|
58
|
-
else
|
59
|
-
if block_given?
|
60
|
-
@tests[name.to_sym] = AppTester::Test.new(name, @options, &block)
|
61
|
-
else
|
62
|
-
@tests[name.to_sym] = nil
|
63
|
-
end
|
64
58
|
end
|
59
|
+
block = Proc.new{} unless block_given?
|
60
|
+
test = AppTester::Test.new(name, @options, &block)
|
61
|
+
@tests.push title: name, test: test
|
62
|
+
test
|
65
63
|
end
|
66
64
|
|
67
65
|
# Retrieve a test by name
|
@@ -82,8 +80,11 @@ module AppTester
|
|
82
80
|
# apptester.define_test "my test"
|
83
81
|
# my_test = apptester.get_test "my test"
|
84
82
|
def get_test name
|
85
|
-
|
86
|
-
|
83
|
+
entry = @tests.find { |t| t[:title] == name }
|
84
|
+
if entry.nil?
|
85
|
+
raise AppTester::Error::TestNotFoundError, "Could not find test #{name}"
|
86
|
+
end
|
87
|
+
entry[:test]
|
87
88
|
end
|
88
89
|
|
89
90
|
# Defines command line options for a given test
|
@@ -106,7 +107,6 @@ module AppTester
|
|
106
107
|
#
|
107
108
|
# apptester.set_options_for "my test" do |options_parser|
|
108
109
|
# options_parser.set_option(:file, "-f", "--file FILE", "File to load")
|
109
|
-
# options_parser.mandatory_options = 0
|
110
110
|
# end
|
111
111
|
def set_options_for name
|
112
112
|
test = get_test name
|
@@ -122,7 +122,6 @@ module AppTester
|
|
122
122
|
# @return [AppTester::Test] the test that we're running
|
123
123
|
#
|
124
124
|
# @raise [AppTester::Error::TestNotFoundError] if no test was found
|
125
|
-
# @raise [OptionParser::MissingArgument] if there's a argument missing from a missmatch in the number of arguments given and mandatory_options on set_options_for method
|
126
125
|
# @raise [Faraday::Error::ConnectionFailed] if there was a problem connecting to the selected server
|
127
126
|
#
|
128
127
|
# @example Run a test
|
@@ -147,6 +146,16 @@ module AppTester
|
|
147
146
|
the_test
|
148
147
|
end
|
149
148
|
|
149
|
+
# Run all tests
|
150
|
+
#
|
151
|
+
# @raise [Faraday::Error::ConnectionFailed] if there was a problem connecting to the selected server
|
152
|
+
def run_all
|
153
|
+
@tests.each do |test|
|
154
|
+
run_test test[:title]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
150
159
|
# Load libraries to be used under this namespace
|
151
160
|
#
|
152
161
|
# @param libs [String] list of libraries to load
|
@@ -161,4 +170,4 @@ module AppTester
|
|
161
170
|
end
|
162
171
|
|
163
172
|
load_libraries "core", "utils", "options", "test", "parser", "connection", "exceptions", "timer", "checker"
|
164
|
-
end
|
173
|
+
end
|
data/spec/app-tester_spec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
require 'tempfile'
|
3
|
-
|
4
3
|
# Time to add your specs!
|
5
4
|
# http://rspec.info/
|
6
5
|
describe "App Tester framework" do
|
@@ -22,13 +21,40 @@ describe "App Tester framework" do
|
|
22
21
|
apptester.options.environments[:development].should eq("localhost://development")
|
23
22
|
end
|
24
23
|
|
25
|
-
|
24
|
+
describe "when setting a default option" do
|
25
|
+
before do
|
26
|
+
apptester = AppTester.new do |options|
|
27
|
+
options.add_default_option(:something, '-a', '--something SOMETHING', 'Say something')
|
28
|
+
end
|
29
|
+
@test = apptester.define_test 'my test'
|
30
|
+
end
|
31
|
+
let(:received_options) { @test.options.default_options }
|
32
|
+
let(:option) { received_options[0] }
|
33
|
+
|
34
|
+
it { received_options.size.should == 1 }
|
35
|
+
it { option[:symbol].should eq(:something) }
|
36
|
+
it { option[:opts].should eq(['-a','--something SOMETHING','Say something']) }
|
37
|
+
it { option[:block].should be_nil }
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should exit if a mandatory arguemnt is missing" do
|
26
41
|
apptester = start_app_tester
|
27
42
|
|
28
|
-
apptester.define_test "my test"
|
29
|
-
|
43
|
+
apptester.define_test "my test"
|
44
|
+
|
45
|
+
apptester.set_options_for "my test" do |test_options|
|
46
|
+
test_options.set_option(:smiles_file, "-f", "--smiles-file FILE", "File containing SMILES for query (one per line)", true)
|
30
47
|
end
|
31
48
|
|
49
|
+
STDOUT.should_receive(:puts).with("Please supply -f / --smiles-file FILE")
|
50
|
+
lambda { apptester.run_test("my test") }.should raise_error(SystemExit)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return help when asked for it" do
|
54
|
+
apptester = start_app_tester
|
55
|
+
|
56
|
+
apptester.define_test "my test"
|
57
|
+
|
32
58
|
lambda { apptester.run_test("my test", ["--help"]) }.should raise_error SystemExit
|
33
59
|
end
|
34
60
|
|
@@ -36,93 +62,60 @@ describe "App Tester framework" do
|
|
36
62
|
apptester = start_app_tester
|
37
63
|
|
38
64
|
mock_arguments "-s" => "production"
|
65
|
+
test = apptester.define_test "test 1"
|
39
66
|
|
40
|
-
apptester.
|
41
|
-
arguments.should be_a(Hash)
|
42
|
-
connection.should be_a(Faraday::Connection)
|
43
|
-
end
|
44
|
-
apptester.define_test("test 2") do
|
45
|
-
arguments.should be_a(Hash)
|
46
|
-
connection.should be_a(Faraday::Connection)
|
47
|
-
end
|
48
|
-
apptester.tests.size.should eq(2)
|
67
|
+
apptester.tests.size.should eq(1)
|
49
68
|
apptester.run_test("test 1").should be_a(AppTester::Test)
|
50
|
-
|
69
|
+
test.arguments.should be_a(Hash)
|
70
|
+
test.connection.should be_a(Faraday::Connection)
|
51
71
|
end
|
52
72
|
|
53
73
|
it "should define a test without a default environment" do
|
54
74
|
apptester = start_app_tester
|
55
|
-
|
56
|
-
apptester.define_test "my test" do
|
57
|
-
arguments[:server].should eq("localhost://production")
|
58
|
-
end
|
59
|
-
|
75
|
+
test = apptester.define_test "my test"
|
60
76
|
apptester.run_test("my test", [])
|
77
|
+
test.arguments[:server].should eq("localhost://production")
|
61
78
|
end
|
62
79
|
|
63
80
|
it "should define a test with a default environment" do
|
64
81
|
apptester = start_app_tester nil, :staging
|
65
|
-
|
66
|
-
apptester.define_test "my test" do
|
67
|
-
arguments[:server].should eq("localhost://staging")
|
68
|
-
end
|
69
|
-
|
82
|
+
test = apptester.define_test "my test"
|
70
83
|
apptester.run_test("my test", [])
|
84
|
+
test.arguments[:server].should eq("localhost://staging")
|
71
85
|
end
|
72
86
|
|
73
87
|
it "should define a test, set custom options and run" do
|
74
88
|
apptester = start_app_tester
|
75
|
-
|
76
|
-
apptester.define_test "my test" do
|
77
|
-
arguments.should be_a(Hash)
|
78
|
-
connection.should be_a(Faraday::Connection)
|
79
|
-
arguments.size.should be(2)
|
80
|
-
arguments[:server].should_not be_empty
|
81
|
-
arguments[:smiles_file].should_not be_empty
|
82
|
-
end
|
83
|
-
|
89
|
+
test = apptester.define_test "my test"
|
84
90
|
apptester.set_options_for "my test" do |test_options|
|
85
91
|
test_options.set_option(:smiles_file, "-f", "--smiles-file FILE", "File containing SMILES for query (one per line)")
|
86
92
|
end
|
87
|
-
|
88
93
|
mocked_arguments = mock_arguments "-s" => "development", "-f" => "../../file.txt"
|
89
|
-
|
90
94
|
apptester.run_test("my test", mocked_arguments)
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should define a test, set custom options, define number mandatory options and run" do
|
94
|
-
apptester = start_app_tester
|
95
|
-
|
96
|
-
apptester.define_test "my test" do
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
mocked_arguments = mock_arguments "-s" => "development"
|
106
|
-
|
107
|
-
lambda { apptester.run_test("my test", mocked_arguments) }.should raise_error OptionParser::MissingArgument
|
96
|
+
test.arguments.should be_a(Hash)
|
97
|
+
test.connection.should be_a(Faraday::Connection)
|
98
|
+
test.arguments.size.should be(2)
|
99
|
+
test.arguments[:server].should_not be_empty
|
100
|
+
test.arguments[:smiles_file].should_not be_empty
|
108
101
|
end
|
109
102
|
|
110
103
|
it "should create a connection" do
|
111
104
|
apptester = start_app_tester :production => "http://www.google.com"
|
112
105
|
|
113
|
-
apptester.define_test "my test"
|
114
|
-
connection.should be_a(Faraday::Connection)
|
115
|
-
end
|
106
|
+
test = apptester.define_test "my test"
|
116
107
|
|
117
108
|
mocked_arguments = mock_arguments "-s" => "production"
|
118
109
|
|
119
110
|
apptester.run_test("my test", mocked_arguments)
|
111
|
+
test.connection.should be_a(Faraday::Connection)
|
120
112
|
end
|
121
|
-
|
122
|
-
|
113
|
+
|
114
|
+
# this should be in a unit test
|
115
|
+
xit "should fetch contents of a connection" do
|
123
116
|
apptester = start_app_tester :production => "https://github.com"
|
124
117
|
|
125
|
-
apptester.define_test "my test" do
|
118
|
+
test = apptester.define_test "my test" do
|
126
119
|
response = get "/"
|
127
120
|
response.status.should eq(200)
|
128
121
|
response.body.should include("github")
|
@@ -134,8 +127,9 @@ describe "App Tester framework" do
|
|
134
127
|
|
135
128
|
apptester.run_test("my test", mocked_arguments)
|
136
129
|
end
|
137
|
-
|
138
|
-
|
130
|
+
|
131
|
+
# this should be in a unit test
|
132
|
+
xit "should return exception on connection failed" do
|
139
133
|
apptester = start_app_tester :production => "http://aoisjdioasjdioasjod"
|
140
134
|
|
141
135
|
apptester.define_test "my test" do
|
metadata
CHANGED
@@ -1,119 +1,111 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-tester
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Jose P. Airosa
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-09-21 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: json
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.7.5
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 7
|
30
|
+
- 5
|
29
31
|
version: 1.7.5
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: faraday
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.8.4
|
38
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: faraday
|
39
36
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 8
|
44
|
+
- 4
|
45
45
|
version: 0.8.4
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rspec
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 2.11.0
|
54
46
|
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
55
50
|
prerelease: false
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 2
|
57
|
+
- 11
|
58
|
+
- 0
|
61
59
|
version: 2.11.0
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec-expectations
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.11.3
|
70
60
|
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec-expectations
|
71
64
|
prerelease: false
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 2
|
71
|
+
- 11
|
72
|
+
- 3
|
77
73
|
version: 2.11.3
|
78
|
-
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
79
77
|
name: rake
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
78
|
prerelease: false
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
name: rspec
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
102
86
|
type: :development
|
87
|
+
version_requirements: *id005
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: rspec
|
103
90
|
prerelease: false
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
91
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id006
|
100
|
+
description: Command-line Framework to run functional tests against a web application (API, Website, etc)
|
112
101
|
email: me@joseairosa.com
|
113
102
|
executables: []
|
103
|
+
|
114
104
|
extensions: []
|
105
|
+
|
115
106
|
extra_rdoc_files: []
|
116
|
-
|
107
|
+
|
108
|
+
files:
|
117
109
|
- lib/app-tester/checker.rb
|
118
110
|
- lib/app-tester/connection.rb
|
119
111
|
- lib/app-tester/core.rb
|
@@ -131,32 +123,35 @@ files:
|
|
131
123
|
- spec/app-tester_spec.rb
|
132
124
|
- spec/spec.opts
|
133
125
|
- spec/spec_helper.rb
|
134
|
-
|
135
|
-
- test/test_helper.rb
|
126
|
+
has_rdoc: true
|
136
127
|
homepage: https://github.com/joseairosa/app-tester
|
137
|
-
licenses:
|
128
|
+
licenses:
|
138
129
|
- MIT
|
139
|
-
post_install_message:
|
130
|
+
post_install_message: "\e[0;32mThanks for installing! You're awesome! ^_^\e[0m"
|
140
131
|
rdoc_options: []
|
141
|
-
|
132
|
+
|
133
|
+
require_paths:
|
142
134
|
- lib
|
143
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
requirements:
|
152
|
-
- -
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
version: "0"
|
155
149
|
requirements: []
|
150
|
+
|
156
151
|
rubyforge_project: app-tester
|
157
|
-
rubygems_version: 1.
|
152
|
+
rubygems_version: 1.3.6
|
158
153
|
signing_key:
|
159
154
|
specification_version: 3
|
160
155
|
summary: Application Tester Framework
|
161
|
-
test_files:
|
156
|
+
test_files:
|
162
157
|
- spec/app-tester_spec.rb
|
data/test/test_app-tester.rb
DELETED
data/test/test_helper.rb
DELETED