rspec_api_helpers 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a1e17e79bc6ff152ec742c852f3b699248b3d5b
4
- data.tar.gz: fce990dba050f13b70183888fe77eb7950f97409
3
+ metadata.gz: d0545b4b9fc7f6295a51d1c0a4e35d85acd3213d
4
+ data.tar.gz: 63acfdacf7717344fff318b309553ef7c5883c98
5
5
  SHA512:
6
- metadata.gz: 6f51ba9ae42ee63916870d3413140778080e9712145c3811ed1046ceb889747c414bf2ec4cea07bb80527d1fd222a0f80a0ac4ad61ba757d4320a0329030a11f
7
- data.tar.gz: be1e3b6a07782c7b031fddef2963faff3d29b025b2708824bd429038ebe8632aaeefaf3d82a19ecefb989458d6db0cd8cab24d5eb2a6e8b935a34a2d42272597
6
+ metadata.gz: 63eb1124c984688a19c540d2260f70e987ea3d70dd60e2b3aea791c0547cdc9c61b304fff8ceb9fb9dd8bf79ffdb1f614b489cf851fa3d0a35d42dc67b2ef60d
7
+ data.tar.gz: 049e264a5d123b02cbf78799bc9c602f93e2087abe7a5b47d4e781fd2752a09c0703bec2993d1048e48a1866749937f2048e7d5841b0a07f94b264bbf64c4bd9
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  RspecApiHelpers
2
2
  ===============
3
- [![Gem Version](https://badge.fury.io/rb/rspec_api_helpers.svg)](http://badge.fury.io/rb/rspec_api_helpers) [![Build Status](https://travis-ci.org/sweatshirtio/rspec_api_helpers.svg?branch=master)](https://travis-ci.org/sweatshirtio/rspec_api_helpers) [![Code Climate](https://codeclimate.com/github/sweatshirtio/rspec_api_helpers/badges/gpa.svg)](https://codeclimate.com/github/sweatshirtio/rspec_api_helpers)
3
+ [![Gem Version](https://badge.fury.io/rb/rspec_api_helpers.svg)](http://badge.fury.io/rb/rspec_api_helpers)
4
+ [![Build Status](https://travis-ci.org/sweatshirtio/rspec_api_helpers.svg?branch=master)](https://travis-ci.org/sweatshirtio/rspec_api_helpers)
5
+ [![Code Climate](https://codeclimate.com/github/sweatshirtio/rspec_api_helpers/badges/gpa.svg)](https://codeclimate.com/github/sweatshirtio/rspec_api_helpers)
4
6
 
5
7
  This is a Gem to help you with all of you Rails API testing woes. The goal is
6
8
  to provide functionality to make testing APIs a breeze. I hope you like it!
@@ -0,0 +1,24 @@
1
+ require 'factory_girl'
2
+
3
+ module RspecApiHelpers
4
+ module Strategies
5
+ class LoginHashStrategy
6
+ def initialize
7
+ @strategy = FactoryGirl.strategy_by_name(:create).new
8
+ end
9
+
10
+ delegate :association, to: :@strategy
11
+
12
+ def result(evaluation)
13
+ user = @strategy.result(evaluation)
14
+
15
+ {
16
+ 'user' => {
17
+ 'email' => user.email,
18
+ 'password' => user.password
19
+ }
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module RspecApiHelpers
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -2,6 +2,7 @@ require 'rspec_api_helpers/version'
2
2
  require 'rspec_api_helpers/headers'
3
3
  require 'rspec_api_helpers/json'
4
4
  require 'rspec_api_helpers/strategies/json_strategy'
5
+ require 'rspec_api_helpers/strategies/login_hash_strategy'
5
6
 
6
7
  require 'active_support/core_ext/object/json'
7
8
  require 'active_support/core_ext/hash'
@@ -15,3 +16,4 @@ module RspecApiHelpers
15
16
  end
16
17
 
17
18
  FactoryGirl.register_strategy :json, RspecApiHelpers::Strategies::JsonStrategy
19
+ FactoryGirl.register_strategy :login_hash, RspecApiHelpers::Strategies::LoginHashStrategy
File without changes
@@ -0,0 +1,29 @@
1
+ describe RspecApiHelpers::Strategies::LoginHashStrategy do
2
+ before do
3
+ DummyUser = Class.new do
4
+ attr_accessor :email, :password
5
+
6
+ def save!
7
+ self
8
+ end
9
+ end
10
+
11
+ FactoryGirl.define do
12
+ factory :dummy_user do
13
+ email 'test@test.com'
14
+ password 'foobar123'
15
+ end
16
+ end
17
+ end
18
+
19
+ subject { FactoryGirl.login_hash :dummy_user }
20
+
21
+ it 'represents user in JSON format' do
22
+ expect(subject).to eq(
23
+ 'user' => {
24
+ 'email' => 'test@test.com',
25
+ 'password' => 'foobar123'
26
+ }
27
+ )
28
+ end
29
+ end
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtpLmtl
14
- cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
15
- Y29tMB4XDTE0MTIxOTA3MjMxOFoXDTE1MTIxOTA3MjMxOFowQjEUMBIGA1UEAwwL
16
- aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
17
- ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKVwZDJ78nh4
18
- 49fzhIhSG4hjXcMU2KWwEQIWXp1gESBSvj4NrcygsNvo+y+cbsxB021Fbtw4D1m/
19
- Lhqxs8l0MewdaDxwIARu57e+hSX9DpwuDSJzoOBfpWpvdj9QOT0ByeGARCD3Dz4P
20
- l4zsZW2HYK3/zWdWznwjh6Jlb/zQaWUgJBanMs15IODVpJ01IW2YqNxDgE1/aaiv
21
- kcEE04a3XlNXvRqz0EtDgg6EJdsArVFdtoxT8IGBEvgiltiXusNWfRdAFdtU+Phg
22
- Wt/zC43O+nMc8vKQIf7z8gY6ESFTLKYKZEKSAQMzK0EtN/QiTPrrUFLL9WZ4VACg
23
- lLmpPiOdIGsCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
24
- BBYEFE9Q3qbzppIUo0ihetWNmRiDLUV8MCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
25
- QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
26
- KoZIhvcNAQEFBQADggEBAHn26tJwdKaN5Rz8nI6weXyYhvdm9zH1RGD4/ksMPbvu
27
- nX16vDqnXHM5KHeC1NgS1ESRlQ0grI5VZlNstFjQXFqbsdAP+UfsnLGpZc4x4C2O
28
- gTyUm/TyRZpgGdauRjoR2arPc5M5RDp1xY2XsXKfdWyWlZt0CnKrTezSCyNriHZC
29
- 8lBhjW73DtD3kmT411PpnN2GMaQQ3svM03XFBQUdyw0gvrKFRv56nVCrGND+KSs3
30
- YGBeYMyEy7Q4wf7k4k5yyDUZyyaeg0DF/kNEN5llspJ9DHMP2cQqOiH+IQSNiUhR
31
- 32sJqaZRHeJLDhZPLi5yXItTsQnPy6uob2oyypwFYTM=
32
- -----END CERTIFICATE-----
33
- date: 2014-12-22 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2015-01-13 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: activesupport
@@ -134,12 +112,14 @@ files:
134
112
  - lib/rspec_api_helpers/headers.rb
135
113
  - lib/rspec_api_helpers/json.rb
136
114
  - lib/rspec_api_helpers/strategies/json_strategy.rb
115
+ - lib/rspec_api_helpers/strategies/login_hash_strategy.rb
137
116
  - lib/rspec_api_helpers/version.rb
138
117
  - rspec_api_helpers.gemspec
139
118
  - spec/headers_spec.rb
140
119
  - spec/json_spec.rb
120
+ - spec/json_strategy_spec.rb
121
+ - spec/login_hash_strategy_spec.rb
141
122
  - spec/spec_helper.rb
142
- - spec/strategies_spec.rb
143
123
  homepage: https://github.com/ianks/rspec_api_helpers
144
124
  licenses:
145
125
  - MIT
@@ -167,5 +147,6 @@ summary: Helpers for testing Rails APIs.
167
147
  test_files:
168
148
  - spec/headers_spec.rb
169
149
  - spec/json_spec.rb
150
+ - spec/json_strategy_spec.rb
151
+ - spec/login_hash_strategy_spec.rb
170
152
  - spec/spec_helper.rb
171
- - spec/strategies_spec.rb
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file