soaspec 0.1.13 → 0.1.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85a80e81b02c106032a9d6843aec406708137ea7
4
- data.tar.gz: 1f50e802564fdc610ecf72ca8bbdb33a63ddff95
3
+ metadata.gz: 25d471f51cb613b7903ebc60c33980fbce658743
4
+ data.tar.gz: d35f4bc6a2ce7c6dceb65bba0ab4c5cf48867b37
5
5
  SHA512:
6
- metadata.gz: 0e72ef672e17b4fbf87078fd950c173fd09610b480c8b40b26cdbe00a0e8e878fd87a81d5a21a2bdd416a2edfa5ee336d0b3f2c3ba218584d1ab90a682666ba4
7
- data.tar.gz: 534d5ceb6f6888a29ce223f7f00bae1722f9f75ef8ca63cf1cd011356f279a61a953c31fc3956b97b65256cc09b61ddc4d652a13cb010b18fbac7660f246c693
6
+ metadata.gz: 6887184fda54087d7f880e2171b1826d2d684f4647e2a327da7289cfbf2bc8dec2135620ec2f311b1030dc6c82b5d24122f92fae91b16036fa9f7f1fdb618adb
7
+ data.tar.gz: 47299bc24373adb1adfea94e498f9ac905e680dda346eecbb93b50d9fdae29e64dfbfa1473b7ac411068b53ab8d462238bb727c3f324455ec98d4b921a8b58f0
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.1.14
2
+ * Enhancements
3
+ * Got `rest` soaspec new working
4
+
1
5
  Version 0.1.13
2
6
  * Enhancements
3
7
  * Cleaned up comments (mainly OAuth2 related)
data/README.md CHANGED
@@ -24,14 +24,14 @@ Or install it yourself as:
24
24
 
25
25
  ## Getting Started
26
26
 
27
- To create a new test suite using this you can use the 'soaspec' binary.
27
+ To create a new test suite using this you can use the `soaspec` binary.
28
28
 
29
29
  Example:
30
30
 
31
31
  ```
32
32
  mkdir 'api_test'
33
33
  cd 'api_test'
34
- soaspec new
34
+ soaspec new [rest/soap]
35
35
  bundle install
36
36
  ```
37
37
 
data/Todo.md CHANGED
@@ -1,10 +1,10 @@
1
+ * Get initial `soaspec new` working with TODOs as placeholders for how to get started
1
2
  * Unit tests
2
3
  * OAuth class, etc
3
4
  * Request method from within exchange
4
5
  * Use this in tests
5
6
  * Basic service generator
6
7
  * Give examples and convenience methods for building classes for each SOAP or REST operation
7
- * For SOAP give example of basic_auth
8
8
  * Potentially have in built use of 'vcr' and 'http_stub' gems
9
9
  * Handle proxies to record traffic for MiddleWare testing
10
10
  * Get wsdl generator working for non complex gems (Put on hold til new Savon version)
@@ -28,22 +28,17 @@ module Soaspec
28
28
  option :virtual, type: :boolean, default: true, banner: 'Whether to set things up for a virtual server'
29
29
  def new(type = 'initial')
30
30
  @virtual = options[:virtual]
31
+ @type = type
31
32
  puts "Creating files for soaspec. options are #{options}"
32
33
  create_file(filename: 'Gemfile')
33
34
  create_file(filename: 'Rakefile')
34
35
  create_file(filename: '.rspec')
35
36
  create_file(filename: 'README.md')
36
37
  create_file(filename: '.travis.yml') if options[:ci] == 'travis'
37
- if type == 'soap'
38
- create_file filename: 'lib/blz_service.rb'
39
- create_file filename: 'lib/shared_example.rb'
40
- end
41
- create_file(filename: 'config/data/default.yml')
38
+ create_folder 'lib'
39
+ create_files_for type
40
+ create_file(filename: 'config/data/default.yml') # Example of data file
42
41
  create_file(filename: 'spec/spec_helper.rb')
43
- create_file(filename: 'spec/soap_spec.rb') if type == 'soap'
44
- create_file(filename: 'template/soap_template.xml', erb: false) if type == 'soap'
45
- create_folder 'logs'
46
-
47
42
  puts "Run 'bundle install' to install necessary gems"
48
43
  puts "Run 'rake spec' to run the tests"
49
44
  end
@@ -4,6 +4,23 @@ module Soaspec
4
4
  # Help with tasks common to soaspec executables
5
5
  module ExeHelpers
6
6
 
7
+ # Create files in project depending on type of project
8
+ # @param [String] type Type of project to create, e.g., 'soap', 'rest'
9
+ def create_files_for(type)
10
+ case type
11
+ when 'soap'
12
+ create_file filename: 'lib/blz_service.rb'
13
+ create_file filename: 'lib/shared_example.rb'
14
+ create_file(filename: 'template/soap_template.xml', erb: false)
15
+ create_file(filename: 'spec/soap_spec.rb')
16
+ when 'rest'
17
+ create_file(filename: 'spec/rest_spec.rb')
18
+ create_file(filename: 'lib/package_service.rb')
19
+ else
20
+ # TODO: This needs to have placeholders explaining what to fill in
21
+ end
22
+ end
23
+
7
24
  # Spec task string depending upon whether virtual is used
8
25
  def spec_task
9
26
  task_name = options[:virtual] ? 'spec: :start_test_server' : ':spec'
@@ -1,2 +1,3 @@
1
+ # Example of storing data in YAML file to be used in test
1
2
  small_id:
2
3
  blz: 100
@@ -0,0 +1,3 @@
1
+ class PackageService < Soaspec::RestHandler
2
+ base_url 'http://localhost:4999/packages'
3
+ end
@@ -0,0 +1,9 @@
1
+ context PackageService.new('Test extract id') do
2
+ describe get 'Negative', suburl: '4/40' do
3
+ its(['success']) { is_expected.to eq 'false' }
4
+ end
5
+
6
+ describe get 'Positive', suburl: '4/41' do
7
+ its(['success']) { is_expected.to eq 'true' }
8
+ end
9
+ end
@@ -5,6 +5,9 @@ require_all 'lib'
5
5
  require 'data_magic'
6
6
 
7
7
  include DataMagic # Used as example of loading data smartly. Use 'data_for' method to load yml data
8
+ <% if @type == 'rest' %>
9
+ include Soaspec::RestMethods
10
+ <% end %>
8
11
 
9
12
  RSpec.configure do |config|
10
13
  # This will make backtrace much shorter by removing many lines from rspec failure message
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.1.13'.freeze
2
+ VERSION = '0.1.14'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
@@ -361,8 +361,10 @@ files:
361
361
  - lib/soaspec/generator/config/data/default.yml.erb
362
362
  - lib/soaspec/generator/lib/blz_service.rb.erb
363
363
  - lib/soaspec/generator/lib/dynamic_class_content.rb.erb
364
+ - lib/soaspec/generator/lib/package_service.rb.erb
364
365
  - lib/soaspec/generator/lib/shared_example.rb.erb
365
366
  - lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb
367
+ - lib/soaspec/generator/spec/rest_spec.rb.erb
366
368
  - lib/soaspec/generator/spec/soap_spec.rb.erb
367
369
  - lib/soaspec/generator/spec/spec_helper.rb.erb
368
370
  - lib/soaspec/generator/template/soap_template.xml