allport 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,17 +6,29 @@ module Allport
6
6
  @user = User.new
7
7
  @contact = Allport::Contact.find(1)
8
8
  end
9
- test "Can add user to contact" do
9
+ test "Can add :user to Contact" do
10
10
  @contact.contactable = @user
11
11
  @contact.save
12
- assert_equal @user.contact, @contact,
13
- "User is assigned the right contact"
12
+ assert_equal @contact.contactable, @user,
13
+ ":user is assigned to the right Contact"
14
14
  end
15
- test "Can add contact to user" do
15
+ test "Can add :contact to User" do
16
16
  @user.contact = @contact
17
17
  @user.contact.save
18
18
  assert_equal @user.contact, @contact,
19
- "Contact is assigned the right user"
19
+ ":contact is assigned to the right User"
20
+ end
21
+ test "Add new :contact to User if User has no :contact upon init" do
22
+ @user.contact.save
23
+ assert_equal @user.contact.class.name, 'Allport::Contact',
24
+ "User is assigned a new :contact"
25
+ end
26
+ test "Do not change User's :contact if User has one already" do
27
+ @user.contact = @contact
28
+ @user.save()
29
+ user = User.first()
30
+ assert_equal user.contact.id, 1,
31
+ "User is not assigned a new :contact"
20
32
  end
21
33
  end
22
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Brandolino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.5.2
19
+ version: 4.2.5
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
- version: 4.2.5.2
26
+ version: 4.2.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,6 @@ files:
49
49
  - Rakefile
50
50
  - app/assets/javascripts/allport/application.js
51
51
  - app/assets/stylesheets/allport/application.css
52
- - app/controllers/allport/application_controller.rb
53
52
  - app/helpers/allport/application_helper.rb
54
53
  - app/models/allport/concerns/contactable.rb
55
54
  - app/models/allport/contact.rb
@@ -58,7 +57,6 @@ files:
58
57
  - db/migrate/20160310002533_create_allport_contacts.rb
59
58
  - db/migrate/20160310012110_add_contactable_to_contact.rb
60
59
  - lib/allport.rb
61
- - lib/allport/contactable.rb
62
60
  - lib/allport/engine.rb
63
61
  - lib/allport/version.rb
64
62
  - lib/tasks/allport_tasks.rake
@@ -1,4 +0,0 @@
1
- module Allport
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
@@ -1,7 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module Allport
4
- module Contactable
5
- extend ActiveSupport::Concern
6
- end
7
- end