specserv 0.0.4 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 516d53e1d7bd8d43a0db2c0ced42ce83e2d0af29
4
- data.tar.gz: a7306a55aa3e190646f3ffaa2ad0bd56f4ca36bb
3
+ metadata.gz: 65518c16eb7ab88107a6c421b073934aab5f462b
4
+ data.tar.gz: e7db4103d43441983af48c64d44e5ef2bccddf87
5
5
  SHA512:
6
- metadata.gz: 49c675dacd2dbdda0e575572c66889400c58cf991ee23f78a7e5e12dd18e2ad47f980d5439106bcb43d06fafc3286ff00b5c7e7bf4b2cb9101bd8310dac465a9
7
- data.tar.gz: b6864442603e6ca9b923a2ee2abdc6fb25f1cae32ffdc483eca374999201cbea280f36945de9cd757335086f3edc247e8abbf12fd249856887cfbd849cf3d300
6
+ metadata.gz: aeca8fbe122e9a009fa438df67875b42201ceeba8b9d3fa8c0f2b579a31aedcce20086f34df5f70e9247085b3a0f6c1e114a4620ecf21b659722d32839603935
7
+ data.tar.gz: 17111447c04cad7fe8b35c49ec1009dad575cfb9f0802db90f6bd4ff07ae44439d3659c6a4076b7138bc63960e2e04315e8e84035e12f7fe03245ecc6c96252c
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/README.md CHANGED
@@ -1,32 +1,34 @@
1
1
  SpecServ
2
2
  ========
3
3
 
4
- Serve HTML test results from any directory to a web browser via HTTP.
4
+ Serves dynamically updated RSpec results from any directory as HTML
5
5
 
6
- Currently uses RSpec, but aims to become platform-agnostic.
6
+ ## Installation ##
7
7
 
8
- ## Installation
8
+ Just run:
9
9
 
10
- Add this line to your application's Gemfile:
10
+ $ gem install specserv
11
11
 
12
- ```ruby
13
- gem 'specserv'
14
- ```
12
+ ## Usage ##
15
13
 
16
- And then execute:
14
+ `cd` into your spec directory, run `specserv` and make a note of the port.
17
15
 
18
- $ bundle
16
+ Then visit http://localhost:port/relative/path/to/spec_file (without the .rb extension).
19
17
 
20
- Or install it yourself as:
18
+ ## Dependencies ##
21
19
 
22
- $ gem install specserv
20
+ Requires RSpec and Sinatra
23
21
 
24
- ## Usage
22
+ ## Roadmap ##
25
23
 
26
- cd into any directory and run ```specserv```
27
- visit http://localhost:port/[spec_file_name_without_extension]
24
+ - Become platform-agnostic, not RSpec specific.
25
+ - Overhaul aesthetics
26
+ - Navigable test-case index pages
27
+ - Support for custom formatters
28
+ - Authentication for sensitive results
29
+ - Make Rack compatible for use with any webserver
28
30
 
29
- ## Contributing
31
+ ## Contributing ##
30
32
 
31
33
  1. Fork it ( https://github.com/andybrice/specserv/fork )
32
34
  2. Create your feature branch (`git checkout -b my-new-feature`)
data/bin/specserv CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'specserv/rspec_gateway'
3
+ require 'specserv/rspec_adapter'
4
4
  require 'specserv/custom_exceptions'
5
5
  require 'sinatra' # possibly overkill, maybe just use thin or something?
6
6
 
7
7
  set :run, true # not sure about this, apparently Sinatra needs it to automatically launch a server
8
8
 
9
9
  before do
10
- @tester = Specserv::RSpecGateway.new
10
+ @tester = Specserv::RSpecAdapter.new
11
11
 
12
12
  def set_spec_path (spec_path)
13
13
  @spec_path = "#{spec_path}.rb"
@@ -50,9 +50,9 @@ end
50
50
 
51
51
  ## Result Pages ##
52
52
 
53
- get "/:spec_path" do
53
+ get "/*" do |path|
54
54
 
55
- set_spec_path( params[:spec_path] )
55
+ set_spec_path( path )
56
56
 
57
57
  begin
58
58
  raise Specserv::NoSpecFileError unless spec_file_exists?
data/lib/specserv.rb CHANGED
@@ -1 +1 @@
1
- require 'specserv/version' # is this actually doing anything here?
1
+ # Cannot be required
@@ -0,0 +1,20 @@
1
+ require 'rspec'
2
+ require 'rspec/core/formatters/html_formatter'
3
+
4
+ module Specserv
5
+ class RSpecAdapter
6
+ def run( source_path )
7
+ RSpec.reset
8
+
9
+ # create a StringIO to capture output
10
+ errors = StringIO.new
11
+ output = StringIO.new
12
+
13
+ # run rspec
14
+ RSpec::Core::Runner.run([source_path, '--format', 'html'], errors, output)
15
+
16
+ # return the captured output
17
+ output.string
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Specserv
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,3 @@
1
+ describe Specserv::RSpecAdapter do
2
+ it 'should return HTML when run is called with a path'
3
+ end
@@ -0,0 +1,78 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # The settings below are suggested to provide a good initial experience
19
+ # with RSpec, but feel free to customize to your heart's content.
20
+ =begin
21
+ # These two settings work together to allow you to limit a spec run
22
+ # to individual examples or groups you care about by tagging them with
23
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
24
+ # get run.
25
+ config.filter_run :focus
26
+ config.run_all_when_everything_filtered = true
27
+
28
+ # Many RSpec users commonly either run the entire suite or an individual
29
+ # file, and it's useful to allow more verbose output when running an
30
+ # individual spec file.
31
+ if config.files_to_run.one?
32
+ # Use the documentation formatter for detailed output,
33
+ # unless a formatter has already been configured
34
+ # (e.g. via a command-line flag).
35
+ config.default_formatter = 'doc'
36
+ end
37
+
38
+ # Print the 10 slowest examples and example groups at the
39
+ # end of the spec run, to help surface which specs are running
40
+ # particularly slow.
41
+ config.profile_examples = 10
42
+
43
+ # Run specs in random order to surface order dependencies. If you find an
44
+ # order dependency and want to debug it, you can fix the order by providing
45
+ # the seed, which is printed after each run.
46
+ # --seed 1234
47
+ config.order = :random
48
+
49
+ # Seed global randomization in this process using the `--seed` CLI option.
50
+ # Setting this allows you to use `--seed` to deterministically reproduce
51
+ # test failures related to randomization by passing the same `--seed` value
52
+ # as the one that triggered the failure.
53
+ Kernel.srand config.seed
54
+
55
+ # rspec-expectations config goes here. You can use an alternate
56
+ # assertion/expectation library such as wrong or the stdlib/minitest
57
+ # assertions if you prefer.
58
+ config.expect_with :rspec do |expectations|
59
+ # Enable only the newer, non-monkey-patching expect syntax.
60
+ # For more details, see:
61
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
+ expectations.syntax = :expect
63
+ end
64
+
65
+ # rspec-mocks config goes here. You can use an alternate test double
66
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
67
+ config.mock_with :rspec do |mocks|
68
+ # Enable only the newer, non-monkey-patching expect syntax.
69
+ # For more details, see:
70
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71
+ mocks.syntax = :expect
72
+
73
+ # Prevents you from mocking or stubbing a method that does not exist on
74
+ # a real object. This is generally recommended.
75
+ mocks.verify_partial_doubles = true
76
+ end
77
+ =end
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specserv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Brice
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - ".rspec"
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
@@ -82,8 +83,10 @@ files:
82
83
  - bin/specserv
83
84
  - lib/specserv.rb
84
85
  - lib/specserv/custom_exceptions.rb
85
- - lib/specserv/rspec_gateway.rb
86
+ - lib/specserv/rspec_adapter.rb
86
87
  - lib/specserv/version.rb
88
+ - spec/rspec_adapter_spec.rb
89
+ - spec/spec_helper.rb
87
90
  - specserv.gemspec
88
91
  homepage: http://github.com/andybrice/specserv
89
92
  licenses:
@@ -109,4 +112,6 @@ rubygems_version: 2.2.2
109
112
  signing_key:
110
113
  specification_version: 4
111
114
  summary: Test result server
112
- test_files: []
115
+ test_files:
116
+ - spec/rspec_adapter_spec.rb
117
+ - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- module Specserv
2
- class RSpecGateway
3
- def run( source_path )
4
- `rspec --format html #{source_path}` # TODO run RSpec through RSpec::Core::Runner rather than through executable
5
- end
6
- end
7
- end