rosebud 0.1.0 → 0.1.1

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: da9a1f5d401c5384749f7052be48eb0e95838e25
4
- data.tar.gz: c79edafc75c00b50454731397d8ccdaa0a4605ac
3
+ metadata.gz: ab297fe74f495fb6587d24b79912ed5e5c55e89c
4
+ data.tar.gz: 216c46316192397d56703da3fc6670193cb5138c
5
5
  SHA512:
6
- metadata.gz: 079c027c7bec034a23c64d4fc3c10ddbae749da9bfd16ebd792a369047984e0668086b11e1685b22977e9eb54fe8f23cd7bf3c91552a6189a79428e371c16045
7
- data.tar.gz: 7666244fa192a67323daaf7d8fe02d56c2a4f16effde25be2c6785ef3785bc9caa2a4ab23beddfece452e9ae0f1d48bdd5e12023c32b355b65623e68ef13b8dd
6
+ metadata.gz: c13d579a7bfb5948ff671bdaa636af398950f72203921e0e8d229ac75ee481749c7404af77b5eafdf3146afb10baa3fcb43ee8a7976f990382f09c0f5c473bec
7
+ data.tar.gz: 18a81777026b1d339093634df9412ae246a7ad6ad54a9a0d4e9ba999ee8a9522261228c4776fc30aa49d97c35af689635812c6dea93f773dddc1a2b91b69bf22
@@ -2,7 +2,9 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
6
+ - 2.2.0
5
7
  - ruby-head
6
8
  - jruby-19mode
7
9
  - jruby-head
8
- - rbx
10
+ - rbx
data/Gemfile CHANGED
@@ -23,11 +23,9 @@ platforms :jruby do
23
23
  end
24
24
 
25
25
  platforms :rbx do
26
- gem 'racc'
27
- gem 'rubinius-coverage', github: 'rubinius/rubinius-coverage'
28
- gem 'rubysl'
26
+ gem 'psych'
29
27
  end
30
28
 
31
29
  group :development do
32
30
  gem 'coveralls', require: false
33
- end
31
+ end
@@ -17,9 +17,12 @@ end
17
17
  module Rosebud
18
18
  def self.included(base)
19
19
  base.extend(ClassMethods)
20
- base.send(:include, Errawr::Rails::Renderable.render_with(Errawr::Rails::Renderers::JSON))
20
+
21
+ unless base.ancestors.include?(Errawr::Rails)
22
+ base.send(:include, Errawr::Rails::Renderable.render_with(Errawr::Rails::Renderers::JSON))
23
+ end
21
24
  end
22
-
25
+
23
26
  module ClassMethods
24
27
  def params(action = :all, &block)
25
28
  action = action.to_s
@@ -1,3 +1,3 @@
1
1
  module Rosebud
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
@@ -5,33 +5,33 @@ describe Rosebud::ParamsScope do
5
5
  controller(ApplicationController) do
6
6
  include Rosebud
7
7
  extend(RSpec::Rails::ControllerExampleGroup::BypassRescue)
8
-
8
+
9
9
  params do
10
10
  optional :name, type: Integer, default: 1234
11
11
  end
12
-
12
+
13
13
  def index
14
14
  render nothing: true
15
15
  end
16
16
  end
17
-
17
+
18
18
  it 'should render 200 if a value is not provided' do
19
19
  get :index
20
- response.status.should == 200
20
+ expect(response.status).to eq(200)
21
21
  end
22
-
22
+
23
23
  it 'should render an error if validation fails' do
24
24
  get :index, name: 'A'
25
- response.status.should_not == 200
26
- response.body.should == {
25
+ expect(response.status).to_not eq(200)
26
+ expect(response.body).to eq({
27
27
  error: 'invalid_parameter',
28
28
  description: 'invalid parameter: name'
29
- }.to_json
29
+ }.to_json)
30
30
  end
31
-
31
+
32
32
  it 'should add a default value to the params' do
33
33
  get :index
34
- controller.params[:name].should == 1234
34
+ expect(controller.params[:name]).to eq(1234)
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -5,28 +5,28 @@ describe Rosebud::ParamsScope do
5
5
  controller(ApplicationController) do
6
6
  include Rosebud
7
7
  extend(RSpec::Rails::ControllerExampleGroup::BypassRescue)
8
-
8
+
9
9
  params do
10
10
  requires :name
11
11
  end
12
-
12
+
13
13
  def index
14
14
  render nothing: true
15
15
  end
16
16
  end
17
-
17
+
18
18
  it 'should render a missing parameter error' do
19
19
  get :index
20
- response.status.should == 400
21
- response.body.should == {
20
+ expect(response.status).to eq(400)
21
+ expect(response.body).to eq({
22
22
  error: 'missing_parameter',
23
23
  description: 'missing parameter: name'
24
- }.to_json
24
+ }.to_json)
25
25
  end
26
-
26
+
27
27
  it 'should render 200 if a paremeter is not missing' do
28
28
  get :index, name: 'Anthony'
29
- response.status.should == 200
29
+ expect(response.status).to eq(200)
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -20,7 +20,6 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| puts f; require f }
20
20
  #
21
21
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
22
  RSpec.configure do |config|
23
- config.treat_symbols_as_metadata_keys_with_true_values = true
24
23
  config.run_all_when_everything_filtered = true
25
24
  config.filter_run :focus
26
25
 
@@ -4,15 +4,15 @@ describe Rosebud::Validations do
4
4
  context 'register_validator!' do
5
5
  it 'should register a validator' do
6
6
  Rosebud::Validations.register_validator!(:dummy_validator, DummyValidator)
7
- Rosebud::Validations.validators[:dummy_validator].should == DummyValidator
7
+ expect(Rosebud::Validations.validators[:dummy_validator]).to eq(DummyValidator)
8
8
  end
9
-
9
+
10
10
  it 'should raise an error if validator subclass is not of type Rosebud::Validator' do
11
11
  expect { Rosebud::Validations.register_validator!(:dummy_validator, InvalidSubclassValidator) }.to raise_error(ArgumentError)
12
12
  end
13
-
13
+
14
14
  it 'should raise an error if validator does not implement validate_param' do
15
15
  expect { Rosebud::Validations.register_validator!(:dummy_validator, NotImplementedValidator) }.to raise_error(NotImplementedError)
16
16
  end
17
17
  end
18
- end
18
+ end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosebud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: errawr
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.1.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: errawr-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: Rails API parameter validation
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
107
  - Gemfile
108
108
  - LICENSE.txt
109
109
  - README.md
@@ -182,17 +182,17 @@ require_paths:
182
182
  - lib
183
183
  required_ruby_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '>='
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
- - - '>='
190
+ - - ">="
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
194
  rubyforge_project:
195
- rubygems_version: 2.0.3
195
+ rubygems_version: 2.4.5
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Finally! An easy way to validate your Rails API parameters.