spryte 0.0.2 → 0.1.0

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: 8e848659c51f10b362f7d2f7b78e77a009d5b7dd
4
- data.tar.gz: be3064a31f4d4aff2d8180ecb2516063334b362f
3
+ metadata.gz: f7bb35b33ff3d5f925bffa877a6be3313c861c0a
4
+ data.tar.gz: 34614a67677f2f019581a32dc5588317a6afd539
5
5
  SHA512:
6
- metadata.gz: 74d3e2d2884cf52dc11af12b86a56c8a0aefb5d4df8c5d847105c03978d7c285ef8c82316e19128df075bb44dcd64e1deb67328f5fefdc25fe477f090baf3e8a
7
- data.tar.gz: 8e56fe3e7a0d1df76cae8698480035d5405397b677d4744fe4a8209b7c0c150feee1ff2b98043a0555881f0fbe971c1a9c31f8c9b76f5b700e5a10160566e632
6
+ metadata.gz: 3bfe24370945b8043d99b8eef1e81d1b81bb0bcee01a5880c690f372ab1c371858f28624405a2f9799684d7fce7ffe75ee509fa1af160783fd8affbca281e3b5
7
+ data.tar.gz: 106c1fd151f36275010d747615e24a09a4ecb9769e032c6a0a1266f2da7551be6afdec71215f295d8e319114389a82bd7cf50b1e8c2525233639b02ea519475d
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require helper
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0
4
+ - (Deprecation) Favour `#through` rather than `#method` in request spec DSL
5
+
3
6
  ## 0.0.2
4
7
  - (Bug) Raise exception on invalid HTTP verbs [@dgmstuart](https://github.com/dgmstuart)
5
8
 
@@ -26,9 +26,15 @@ module Spryte
26
26
  }
27
27
  end
28
28
 
29
- def method(verb)
29
+ def through(verb)
30
30
  raise InvalidHTTPVerb, invalid_http_verb_message(verb) unless valid_http_verb?(verb)
31
- let(:method) { verb.to_sym }
31
+ let(:through) { verb.to_sym }
32
+ let(:method) { through }
33
+ end
34
+
35
+ def method(verb)
36
+ warn "#{ Kernel.caller.first }: `#method' is deprecated due to a collision with Object#method in ruby core, please use `#through' instead."
37
+ through(verb)
32
38
  end
33
39
 
34
40
  def path(name)
@@ -1,6 +1,6 @@
1
1
  module Spryte
2
2
  MAJOR = "0"
3
- MINOR = "0"
4
- PATCH = "2"
3
+ MINOR = "1"
4
+ PATCH = "0"
5
5
  VERSION = [ MAJOR, MINOR, PATCH ].join(".")
6
6
  end
@@ -0,0 +1,41 @@
1
+ require "pry"
2
+
3
+ RSpec.configure do |config|
4
+
5
+ config.expect_with :rspec do |expectations|
6
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
7
+ end
8
+
9
+ config.mock_with :rspec do |mocks|
10
+ mocks.verify_partial_doubles = true
11
+ end
12
+
13
+ config.filter_run :focus
14
+ config.run_all_when_everything_filtered = true
15
+ config.disable_monkey_patching!
16
+
17
+ config.warnings = true
18
+ config.default_formatter = "doc" if config.files_to_run.one?
19
+ config.profile_examples = 10
20
+ config.order = :random
21
+
22
+ Kernel.srand config.seed
23
+
24
+ $original_stderr = $stderr
25
+ $original_stdout = $stdout
26
+
27
+ def disable_output(&blk)
28
+ $stderr = File.open(File::NULL, "w")
29
+ $stdout = File.open(File::NULL, "w")
30
+ if block_given?
31
+ yield
32
+ enable_output
33
+ end
34
+ end
35
+
36
+ def enable_output
37
+ $stderr = $original_stderr
38
+ $stdout = $original_stdout
39
+ end
40
+
41
+ end
@@ -0,0 +1,50 @@
1
+ require "spryte/rspec"
2
+
3
+ class RSpecContextMock
4
+ include Spryte::RSpec::Macros
5
+ def let(*args)
6
+ end
7
+ end
8
+
9
+ RSpec.describe Spryte::RSpec do
10
+
11
+ describe Spryte::RSpec::Macros do
12
+
13
+ subject(:rspec) { RSpecContextMock.new }
14
+
15
+ shared_examples "setting http method verbs for rspec request specs" do |method_name|
16
+ it "sets the right let variables" do
17
+ disable_output do
18
+ expect(rspec).to receive(:let).with(:method).once
19
+ expect(rspec).to receive(:let).with(:through).once
20
+ rspec.public_send(method_name, Spryte::RSpec::Macros::VALID_HTTP_VERBS.sample)
21
+ end
22
+ end
23
+ it "raise exception when using an incorrect http verb" do
24
+ disable_output do
25
+ expect { rspec.public_send(method_name, :poo) }.to raise_exception(Spryte::RSpec::Macros::InvalidHTTPVerb)
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "#method" do
31
+ it_behaves_like "setting http method verbs for rspec request specs", :method
32
+ it "shows a deprecation warning pointing to using #through" do
33
+ expect { rspec.method(:get) }.to output(/#through/).to_stderr
34
+ end
35
+ context "when the major version of spryte is greater than 0" do
36
+ it "does not respond to #method since it was deprecated" do
37
+ if Integer(Spryte::MAJOR) > 0
38
+ expect(Spryte::RSpec::Macros.instance_methods).to_not include :method
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "#through" do
45
+ it_behaves_like "setting http method verbs for rspec request specs", :through
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -25,5 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.6"
27
27
  spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "rspec"
29
+ spec.add_development_dependency "pry"
28
30
 
29
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spryte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
11
+ date: 2015-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: API builder tools for Ruby on Rails
42
70
  email:
43
71
  - philip@chatspry.com
@@ -46,6 +74,7 @@ extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
48
76
  - ".gitignore"
77
+ - ".rspec"
49
78
  - CHANGELOG.md
50
79
  - Gemfile
51
80
  - LICENSE.txt
@@ -60,6 +89,8 @@ files:
60
89
  - lib/spryte/rspec/macros.rb
61
90
  - lib/spryte/rspec/matchers.rb
62
91
  - lib/spryte/version.rb
92
+ - spec/helper.rb
93
+ - spec/spryte/rspec_spec.rb
63
94
  - spryte.gemspec
64
95
  homepage: https://github.com/chatspry/spryte
65
96
  licenses:
@@ -85,4 +116,6 @@ rubygems_version: 2.4.5
85
116
  signing_key:
86
117
  specification_version: 4
87
118
  summary: API builder tools for Ruby on Rails
88
- test_files: []
119
+ test_files:
120
+ - spec/helper.rb
121
+ - spec/spryte/rspec_spec.rb