jbuilder_rspec_generator 1.0.1 → 1.0.2

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: d53c4dd57d06e4188cc9a8a3700608530bc814f2
4
- data.tar.gz: c2d5929868b8a00000e613bcd855ae5bb9cd4cf1
3
+ metadata.gz: 1a662cb905e03600a0010aef08655124bf8b1cb3
4
+ data.tar.gz: b5ed0af9c40de99ac130c59f62f5c06a70b4f935
5
5
  SHA512:
6
- metadata.gz: 42b8b5a749872ac958ed6d087bf258ec1f30a40ff131591f079c438d264649433ae50fbcbb3a4bd89bfc0545e53e24e2fa551796e4e0f4e7072e5a8b72c6bdd8
7
- data.tar.gz: 2d710f0db0618e1341cb1484ae6c4ec21ea505841011941479a22e75ebffda791a7dea88270d5d045b42f2d1e8a937063858f7e5a45f7d798f5d0148361dbab4
6
+ metadata.gz: dd106b0f2d7f70d0042914751178fbbf6cd0d243da4e764721ff39d5db34b101a46c199f674cc57ab8d2a39bd9489508cba3418ade30761ba8aebbd9d044a41b
7
+ data.tar.gz: e4c2d4ae3cea70f60077c40ac02edfcf6cb07e8f6660fd65e2825046d6fcf5c9f4ad5c7c5669a9422818bca017465cb423cd486f2314c9c7e969b2383ab85f6f
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
3
+
4
+ gem 'multi_json'
5
5
 
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: jbuilder_rspec_generator 1.0.1 ruby lib
5
+ # stub: jbuilder_rspec_generator 1.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "jbuilder_rspec_generator"
9
- s.version = "1.0.1"
9
+ s.version = "1.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Dmitri Koulikoff"]
14
- s.date = "2014-09-15"
14
+ s.date = "2014-09-17"
15
15
  s.description = "Generates RSpecs for jbuilder templates"
16
16
  s.email = "dima@koulikoff.ru"
17
17
  s.extra_rdoc_files = [
@@ -43,12 +43,14 @@ Gem::Specification.new do |s|
43
43
  s.specification_version = 4
44
44
 
45
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<multi_json>, [">= 0"])
46
47
  s.add_development_dependency(%q<rspec>, ["~> 3.1"])
47
48
  s.add_development_dependency(%q<rdoc>, ["~> 4.1"])
48
49
  s.add_development_dependency(%q<bundler>, ["~> 1.6"])
49
50
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
50
51
  s.add_development_dependency(%q<simplecov>, ["~> 0.0"])
51
52
  else
53
+ s.add_dependency(%q<multi_json>, [">= 0"])
52
54
  s.add_dependency(%q<rspec>, ["~> 3.1"])
53
55
  s.add_dependency(%q<rdoc>, ["~> 4.1"])
54
56
  s.add_dependency(%q<bundler>, ["~> 1.6"])
@@ -56,6 +58,7 @@ Gem::Specification.new do |s|
56
58
  s.add_dependency(%q<simplecov>, ["~> 0.0"])
57
59
  end
58
60
  else
61
+ s.add_dependency(%q<multi_json>, [">= 0"])
59
62
  s.add_dependency(%q<rspec>, ["~> 3.1"])
60
63
  s.add_dependency(%q<rdoc>, ["~> 4.1"])
61
64
  s.add_dependency(%q<bundler>, ["~> 1.6"])
@@ -24,18 +24,23 @@ describe "<%= ns_table_name %>/index.json.jbuilder", type: :view do
24
24
  <% for attribute in attributes -%>
25
25
  <%= attribute.name %>
26
26
  <% end -%>
27
+ created_at
28
+ updated_at
27
29
  url
28
30
  ]
29
31
 
30
32
  it "renders a list of <%= table_name %> as json with following attributes: #{attributes.join(', ')}" do
31
33
  render
32
34
 
33
- hash = JSON.parse(rendered)
35
+ hash = MultiJson.load rendered
34
36
  expect(hash.first).to eq(hash = hash.last)
35
37
  expect(hash.keys.sort).to eq attributes.sort
38
+ expected = MultiJson.load MultiJson.dump @user.attributes.slice *attributes
39
+ expected['url'] = <%= ns_file_name %>_url(@<%= ns_file_name %>, format: 'json')
40
+ expect(hash).to eq expected
36
41
  <% for attribute in attributes -%>
37
- expect(hash['<%= attribute.name %>']).to eq @<%= ns_file_name %>.<%= attribute.name %>.to_s
42
+ # expect(hash['<%= attribute.name %>']).to eq expected['<%= attribute.name %>']
38
43
  <% end -%>
39
- expect(hash['url']).to eq <%= ns_file_name %>_url(@<%= ns_file_name %>, format: 'json')
44
+ # expect(hash['url']).to eq <%= ns_file_name %>_url(@<%= ns_file_name %>, format: 'json')
40
45
  end
41
46
  end
@@ -32,10 +32,12 @@ describe "<%= ns_table_name %>/show.json.jbuilder", type: :view do
32
32
  it "renders the following attributes of <%= ns_file_name %>: #{attributes.join(', ')} as json" do
33
33
  render
34
34
 
35
- hash = JSON.parse(rendered)
35
+ hash = MultiJson.load rendered
36
36
  expect(hash.keys.sort).to eq attributes.sort
37
+ expected = MultiJson.load MultiJson.dump @user.attributes.slice *attributes
38
+ expect(hash).to eq expected
37
39
  <% for attribute in attributes -%>
38
- expect(hash['<%= attribute.name %>']).to eq @<%= ns_file_name %>.<%= attribute.name %>.to_s
40
+ # expect(hash['<%= attribute.name %>']).to eq expected['<%= attribute.name %>']
39
41
  <% end -%>
40
42
  end
41
43
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder_rspec_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-15 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement