resubject 0.2.2 → 0.3.0

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
- SHA1:
3
- metadata.gz: 5af4c75bfa632e18875bdb64492fa3a7454020d5
4
- data.tar.gz: baa37ace997ee7b47ab2cdd1ebb6fcace4c049c5
2
+ SHA256:
3
+ metadata.gz: 063e070b83031364701371c5c908f0c096723d8315e05e6f2f8e75274079fcaa
4
+ data.tar.gz: 8c7554fbb0cf572f0376b8cc72e9ecf21a3ad2f99ac3b4662a9468e3089256fe
5
5
  SHA512:
6
- metadata.gz: 0ded2dd3031e370ed25f9d67c5b3512eba510d0bbcd3da2b77a277860d2d3556afc9cf8d68a0a66892ed392035572e2d0025e781e74ef538783c012e9787e7c5
7
- data.tar.gz: 5f169109e23e0169dfbc514eccc5abe8dd545833271f693b3a2bf1bc86deb2b621e5fb2add954063e45629cae5f2adb3c76cf87d75c8a3a87fede2b9b9d11665
6
+ metadata.gz: 6f4f4586bac272a00799f005f47b0c4e9c7ca8e9d41742be33ab01c0c137a0c9e2c94412a54c19a42372b12b1953e5a05417dbbe04bf8be704cd5b8a426da0c8
7
+ data.tar.gz: 26c712b739607e0c501087f4979d442d4cad3fbcf4cd1e62ffb1ac7ef24c46168a6dc4c05b86b2e6c8c3abd3fc696a3c57ffb2d59fa6db0255b72e58bd510576
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
+
4
5
  rvm:
5
- - 1.9.3
6
- - 2.0.0
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
7
9
  env:
8
- - rails=3.2
9
- - rails=4.0
10
+ - rails=4
11
+ - rails=5
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- ENV['rails'] ||= '3.2'
1
+ ENV['rails'] ||= '4'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
@@ -6,7 +6,6 @@ rails_version = ENV['rails']
6
6
  gem 'actionpack', "~> #{rails_version}"
7
7
 
8
8
  gem 'nokogiri', '~> 1.8'
9
- gem 'rake', '< 11.0'
10
9
  gem 'redcarpet'
11
10
  gem 'rubocop'
12
11
  # Specify your gem's dependencies in resubject.gemspec
data/README.md CHANGED
@@ -11,7 +11,7 @@ Uber simple presenters using Ruby's SimpleDelegator.
11
11
  Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'resubject', '~> 0.2.2'
14
+ gem 'resubject', '~> 0.3.0'
15
15
  ```
16
16
 
17
17
  And then execute:
@@ -226,7 +226,7 @@ require 'resubject/rspec'
226
226
  require 'presenters/my_presenter'
227
227
 
228
228
  describe UserPresenter do
229
- let(:object) { mock :user }
229
+ let(:object) { double :user }
230
230
 
231
231
  it 'has full name' do
232
232
  object.stub(first: 'User', last: 'Name')
@@ -1,3 +1,3 @@
1
1
  module Resubject
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -1,5 +1,4 @@
1
-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'resubject/version'
5
4
 
@@ -20,7 +19,7 @@ Gem::Specification.new do |gem|
20
19
 
21
20
  gem.add_dependency 'activesupport', '>= 3.2'
22
21
 
23
- gem.add_development_dependency 'rake'
24
- gem.add_development_dependency 'rspec', '~> 2.12.0'
22
+ gem.add_development_dependency 'rake', '~> 12.0'
23
+ gem.add_development_dependency 'rspec', '~> 3.0'
25
24
  gem.add_development_dependency 'yard', '~> 0.9'
26
25
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Resubject::Builder do
4
- let(:template) { stub }
4
+ let(:template) { double :template }
5
5
 
6
6
  before do
7
7
  stub_const 'Box', Class.new
@@ -26,7 +26,7 @@ describe Resubject::Builder do
26
26
  end
27
27
 
28
28
  it 'presents the object with multiple classes' do
29
- OtherBoxPresenter.should_receive(:new).twice
29
+ expect(OtherBoxPresenter).to receive(:new).twice
30
30
  presenters = [OtherBoxPresenter, OtherBoxPresenter]
31
31
  Resubject::Builder.present_one Box.new, template, *presenters
32
32
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'action_view'
3
3
 
4
4
  describe Resubject::Presenter, 'template methods' do
5
- let(:model) { mock :model }
5
+ let(:model) { double :model }
6
6
 
7
7
  let(:presenter) do
8
8
  Class.new(Resubject::Presenter) do
@@ -19,38 +19,38 @@ describe Resubject::Presenter, 'template methods' do
19
19
 
20
20
  describe '.currency' do
21
21
  it 'returns currency format' do
22
- model.should_receive(:price).and_return(10.0)
22
+ expect(model).to receive(:price).and_return(10.0)
23
23
  expect(subject.price).to eq '$10.00'
24
24
  end
25
25
  end
26
26
 
27
27
  describe '.time_ago' do
28
28
  it 'returns time ago in words' do
29
- model.stub(:posted_at).and_return(Time.now - 60 * 60)
29
+ allow(model).to receive(:posted_at).and_return(Time.now - 60 * 60)
30
30
  expect(subject.posted_at).to eq 'about 1 hour'
31
31
  end
32
32
 
33
33
  it 'returns nothing if value is nil' do
34
- model.stub(:posted_at).and_return(nil)
34
+ allow(model).to receive(:posted_at).and_return(nil)
35
35
  expect(subject.posted_at).to eq nil
36
36
  end
37
37
  end
38
38
 
39
39
  describe '.percentage' do
40
40
  it 'returns formatted percentage' do
41
- model.stub(:rating).and_return(95.123)
41
+ allow(model).to receive(:rating).and_return(95.123)
42
42
  expect(subject.rating).to eq '95%'
43
43
  end
44
44
  end
45
45
 
46
46
  describe '.date_format' do
47
47
  it 'returns formatted date' do
48
- model.stub(:created_at).and_return(Time.at(1_358_082_653).utc)
48
+ allow(model).to receive(:created_at).and_return(Time.at(1_358_082_653).utc)
49
49
  expect(subject.created_at).to eq '13 Jan 13:10'
50
50
  end
51
51
 
52
52
  it 'returns nothing if value is nil' do
53
- model.stub(:created_at).and_return(nil)
53
+ allow(model).to receive(:created_at).and_return(nil)
54
54
  expect(subject.created_at).to eq nil
55
55
  end
56
56
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Resubject::Presenter do
4
- let(:object) { mock :object }
4
+ let(:object) { double :object }
5
5
 
6
6
  subject { Resubject::Presenter.new(object) }
7
7
 
8
8
  it 'delegate methods to object' do
9
- object.should_receive(:pretty)
9
+ expect(object).to receive(:pretty)
10
10
  subject.pretty
11
11
  end
12
12
 
@@ -49,19 +49,19 @@ describe Resubject::Presenter do
49
49
  end
50
50
 
51
51
  it 'generates a method preseting the attribute' do
52
- box = stub :box, item: Item.new
52
+ box = double :box, item: Item.new
53
53
 
54
54
  expect(presenter.new(box).item).to be_a ItemPresenter
55
55
  end
56
56
 
57
57
  it 'does not attempt to find a class from nil' do
58
- box = stub :box, item: nil
58
+ box = double :box, item: nil
59
59
 
60
60
  expect(presenter.new(box).item).to be_nil
61
61
  end
62
62
 
63
63
  it 'presents the attributes with custom presenter' do
64
- box = stub :box, other_item: stub
64
+ box = double :box, other_item: double(:other)
65
65
 
66
66
  expect(presenter.new(box).other_item).to be_a ItemPresenter
67
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resubject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-31 00:00:00.000000000 Z
12
+ date: 2019-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -29,30 +29,30 @@ dependencies:
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '12.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '12.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.12.0
48
+ version: '3.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.12.0
55
+ version: '3.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: yard
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.6.12
126
+ rubygems_version: 2.7.6
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Uber simple presenters using Ruby's SimpleDelegator