popolo 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/Rakefile +13 -4
  4. data/app/models/popolo/area.rb +3 -3
  5. data/app/models/popolo/contact_detail.rb +4 -0
  6. data/app/models/popolo/motion.rb +3 -1
  7. data/app/models/popolo/organization.rb +8 -4
  8. data/app/models/popolo/other_name.rb +12 -0
  9. data/app/models/popolo/person.rb +3 -3
  10. data/app/models/popolo/post.rb +2 -0
  11. data/app/models/popolo/vote_event.rb +1 -1
  12. data/lib/popolo/version.rb +1 -1
  13. data/spec/controllers/popolo/memberships_controller_spec.rb +13 -11
  14. data/spec/controllers/popolo/organizations_controller_spec.rb +18 -17
  15. data/spec/controllers/popolo/people_controller_spec.rb +13 -11
  16. data/spec/controllers/popolo/posts_controller_spec.rb +13 -11
  17. data/spec/dummy/README.rdoc +28 -0
  18. data/spec/dummy/Rakefile +1 -2
  19. data/spec/dummy/app/assets/javascripts/application.js +3 -3
  20. data/spec/dummy/app/assets/stylesheets/application.css +5 -4
  21. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  22. data/spec/dummy/app/views/layouts/application.html.erb +2 -4
  23. data/spec/dummy/bin/bundle +3 -0
  24. data/spec/dummy/bin/rails +4 -0
  25. data/spec/dummy/bin/rake +4 -0
  26. data/spec/dummy/config/application.rb +1 -38
  27. data/spec/dummy/config/boot.rb +4 -9
  28. data/spec/dummy/config/environment.rb +3 -3
  29. data/spec/dummy/config/environments/development.rb +19 -19
  30. data/spec/dummy/config/environments/production.rb +44 -28
  31. data/spec/dummy/config/environments/test.rb +17 -15
  32. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  34. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  35. data/spec/dummy/config/initializers/inflections.rb +16 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  37. data/spec/dummy/config/initializers/session_store.rb +1 -6
  38. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  39. data/spec/dummy/config/locales/en.yml +20 -2
  40. data/spec/dummy/config/mongoid.yml +21 -20
  41. data/spec/dummy/config/secrets.yml +22 -0
  42. data/spec/dummy/config.ru +1 -1
  43. data/spec/dummy/log/development.log +0 -0
  44. data/spec/dummy/log/test.log +4423 -0
  45. data/spec/dummy/public/404.html +54 -13
  46. data/spec/dummy/public/422.html +54 -13
  47. data/spec/dummy/public/500.html +53 -12
  48. data/spec/helpers/popolo_helper_spec.rb +2 -2
  49. data/spec/models/popolo/area_spec.rb +4 -2
  50. data/spec/models/popolo/contact_detail_spec.rb +6 -4
  51. data/spec/models/popolo/count_spec.rb +6 -4
  52. data/spec/models/popolo/date_string_spec.rb +92 -90
  53. data/spec/models/popolo/group_result_spec.rb +6 -4
  54. data/spec/models/popolo/identifier_spec.rb +5 -3
  55. data/spec/models/popolo/link_spec.rb +5 -3
  56. data/spec/models/popolo/membership_spec.rb +9 -7
  57. data/spec/models/popolo/motion_spec.rb +5 -3
  58. data/spec/models/popolo/organization_spec.rb +6 -4
  59. data/spec/models/popolo/other_name_spec.rb +7 -5
  60. data/spec/models/popolo/person_spec.rb +22 -20
  61. data/spec/models/popolo/post_spec.rb +5 -3
  62. data/spec/models/popolo/vote_event_spec.rb +4 -2
  63. data/spec/models/popolo/vote_spec.rb +4 -2
  64. data/spec/popolo_spec.rb +15 -15
  65. data/spec/rails_helper.rb +68 -0
  66. data/spec/routing/popolo/memberships_routing_spec.rb +8 -6
  67. data/spec/routing/popolo/organizations_routing_spec.rb +11 -9
  68. data/spec/routing/popolo/people_routing_spec.rb +8 -6
  69. data/spec/routing/popolo/posts_routing_spec.rb +8 -6
  70. data/spec/spec_helper.rb +70 -80
  71. data/spec/support/{shared_examples.rb → shared_examples/date.rb} +1 -1
  72. metadata +52 -89
  73. data/spec/controllers/popolo_controller_spec.rb +0 -4
  74. data/spec/dummy/config/initializers/secret_token.rb +0 -7
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/404.html -->
21
59
  <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/422.html -->
21
59
  <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,24 +2,65 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/500.html -->
21
59
  <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
23
64
  </div>
24
65
  </body>
25
66
  </html>
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe PopoloHelper do
3
+ RSpec.describe PopoloHelper do
4
4
  end
@@ -1,4 +1,6 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Area do
3
+ module Popolo
4
+ RSpec.describe Area do
5
+ end
4
6
  end
@@ -1,7 +1,9 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::ContactDetail do
4
- [:type, :value].each do |attribute|
5
- it {should validate_presence_of attribute}
3
+ module Popolo
4
+ RSpec.describe ContactDetail do
5
+ [:type, :value].each do |attribute|
6
+ it {should validate_presence_of attribute}
7
+ end
6
8
  end
7
9
  end
@@ -1,7 +1,9 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Count do
4
- [:option, :value].each do |attribute|
5
- it {should validate_presence_of attribute}
3
+ module Popolo
4
+ RSpec.describe Count do
5
+ [:option, :value].each do |attribute|
6
+ it {should validate_presence_of attribute}
7
+ end
6
8
  end
7
9
  end
@@ -1,121 +1,123 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::DateString do
4
- let :date do
5
- Date.new(2011, 2, 3)
6
- end
7
-
8
- let :date_string_year_month_day do
9
- Popolo::DateString.new('2011-02-03')
10
- end
11
-
12
- let :date_string_year_month do
13
- Popolo::DateString.new('2011-02')
14
- end
15
-
16
- let :date_string_year do
17
- Popolo::DateString.new('2011')
18
- end
19
-
20
- let :date_string_empty do
21
- Popolo::DateString.new('')
22
- end
23
-
24
- let :year_month_day do
25
- '2011-02-03'
26
- end
27
-
28
- let :year_month do
29
- '2011-02'
30
- end
31
-
32
- let :year do
33
- '2011'
34
- end
35
-
36
- let :empty do
37
- ''
38
- end
39
-
40
- describe '#mongoize' do
41
- it 'returns a string' do
42
- date_string_year_month_day.mongoize.should == year_month_day
3
+ module Popolo
4
+ RSpec.describe DateString do
5
+ let :date do
6
+ Date.new(2011, 2, 3)
43
7
  end
44
8
 
45
- it 'returns a string if day truncated' do
46
- date_string_year_month.mongoize.should == year_month
9
+ let :date_string_year_month_day do
10
+ Popolo::DateString.new('2011-02-03')
47
11
  end
48
12
 
49
- it 'returns a string if month and day truncated' do
50
- date_string_year.mongoize.should == year
13
+ let :date_string_year_month do
14
+ Popolo::DateString.new('2011-02')
51
15
  end
52
16
 
53
- it 'returns nil if empty string' do
54
- date_string_empty.mongoize.should == nil
17
+ let :date_string_year do
18
+ Popolo::DateString.new('2011')
55
19
  end
56
- end
57
20
 
58
- describe '.demongoize' do
59
- it 'returns a date' do
60
- Popolo::DateString.demongoize(year_month_day).mongoize.should == date
21
+ let :date_string_empty do
22
+ Popolo::DateString.new('')
61
23
  end
62
24
 
63
- it 'returns a string if day truncated' do
64
- Popolo::DateString.demongoize(year_month).mongoize.should == year_month
25
+ let :year_month_day do
26
+ '2011-02-03'
65
27
  end
66
28
 
67
- it 'returns a string if month and day truncated' do
68
- Popolo::DateString.demongoize(year).mongoize.should == year
29
+ let :year_month do
30
+ '2011-02'
69
31
  end
70
32
 
71
- it 'returns nil if empty string' do
72
- Popolo::DateString.demongoize(empty).mongoize.should == nil
33
+ let :year do
34
+ '2011'
73
35
  end
74
- end
75
36
 
76
- describe '.mongoize' do
77
- it 'returns a string when given a date' do
78
- Popolo::DateString.mongoize(date).should == year_month_day
37
+ let :empty do
38
+ ''
79
39
  end
80
40
 
81
- it 'returns a string when given a date string' do
82
- Popolo::DateString.mongoize(date_string_year_month_day).should == year_month_day
83
- Popolo::DateString.mongoize(date_string_year_month).should == year_month
84
- Popolo::DateString.mongoize(date_string_year).should == year
85
- end
41
+ describe '#mongoize' do
42
+ it 'returns a string' do
43
+ expect(date_string_year_month_day.mongoize).to eq(year_month_day)
44
+ end
86
45
 
87
- it 'returns a string when given a string' do
88
- Popolo::DateString.mongoize(year_month_day).should == year_month_day
89
- Popolo::DateString.mongoize(year_month).should == year_month
90
- Popolo::DateString.mongoize(year).should == year
91
- end
46
+ it 'returns a string if day truncated' do
47
+ expect(date_string_year_month.mongoize).to eq(year_month)
48
+ end
92
49
 
93
- it 'returns nil when given an empty string' do
94
- Popolo::DateString.mongoize(date_string_empty).should == nil
95
- Popolo::DateString.mongoize(empty).should == nil
96
- end
97
- end
50
+ it 'returns a string if month and day truncated' do
51
+ expect(date_string_year.mongoize).to eq(year)
52
+ end
98
53
 
99
- describe '.evolve' do
100
- it 'returns a string when given a date' do
101
- Popolo::DateString.evolve(date).should == year_month_day
54
+ it 'returns nil if empty string' do
55
+ expect(date_string_empty.mongoize).to eq(nil)
56
+ end
102
57
  end
103
58
 
104
- it 'returns a string when given a date string' do
105
- Popolo::DateString.evolve(date_string_year_month_day).should == year_month_day
106
- Popolo::DateString.evolve(date_string_year_month).should == year_month
107
- Popolo::DateString.evolve(date_string_year).should == year
59
+ describe '.demongoize' do
60
+ it 'returns a date' do
61
+ expect(Popolo::DateString.demongoize(year_month_day).mongoize).to eq(date)
62
+ end
63
+
64
+ it 'returns a string if day truncated' do
65
+ expect(Popolo::DateString.demongoize(year_month).mongoize).to eq(year_month)
66
+ end
67
+
68
+ it 'returns a string if month and day truncated' do
69
+ expect(Popolo::DateString.demongoize(year).mongoize).to eq(year)
70
+ end
71
+
72
+ it 'returns nil if empty string' do
73
+ expect(Popolo::DateString.demongoize(empty).mongoize).to eq(nil)
74
+ end
108
75
  end
109
76
 
110
- it 'returns a string when given a string' do
111
- Popolo::DateString.evolve(year_month_day).should == year_month_day
112
- Popolo::DateString.evolve(year_month).should == year_month
113
- Popolo::DateString.evolve(year).should == year
77
+ describe '.mongoize' do
78
+ it 'returns a string when given a date' do
79
+ expect(Popolo::DateString.mongoize(date)).to eq(year_month_day)
80
+ end
81
+
82
+ it 'returns a string when given a date string' do
83
+ expect(Popolo::DateString.mongoize(date_string_year_month_day)).to eq(year_month_day)
84
+ expect(Popolo::DateString.mongoize(date_string_year_month)).to eq(year_month)
85
+ expect(Popolo::DateString.mongoize(date_string_year)).to eq(year)
86
+ end
87
+
88
+ it 'returns a string when given a string' do
89
+ expect(Popolo::DateString.mongoize(year_month_day)).to eq(year_month_day)
90
+ expect(Popolo::DateString.mongoize(year_month)).to eq(year_month)
91
+ expect(Popolo::DateString.mongoize(year)).to eq(year)
92
+ end
93
+
94
+ it 'returns nil when given an empty string' do
95
+ expect(Popolo::DateString.mongoize(date_string_empty)).to eq(nil)
96
+ expect(Popolo::DateString.mongoize(empty)).to eq(nil)
97
+ end
114
98
  end
115
99
 
116
- it 'returns nil when given an empty string' do
117
- Popolo::DateString.evolve(date_string_empty).should == nil
118
- Popolo::DateString.evolve(empty).should == nil
100
+ describe '.evolve' do
101
+ it 'returns a string when given a date' do
102
+ expect(Popolo::DateString.evolve(date)).to eq(year_month_day)
103
+ end
104
+
105
+ it 'returns a string when given a date string' do
106
+ expect(Popolo::DateString.evolve(date_string_year_month_day)).to eq(year_month_day)
107
+ expect(Popolo::DateString.evolve(date_string_year_month)).to eq(year_month)
108
+ expect(Popolo::DateString.evolve(date_string_year)).to eq(year)
109
+ end
110
+
111
+ it 'returns a string when given a string' do
112
+ expect(Popolo::DateString.evolve(year_month_day)).to eq(year_month_day)
113
+ expect(Popolo::DateString.evolve(year_month)).to eq(year_month)
114
+ expect(Popolo::DateString.evolve(year)).to eq(year)
115
+ end
116
+
117
+ it 'returns nil when given an empty string' do
118
+ expect(Popolo::DateString.evolve(date_string_empty)).to eq(nil)
119
+ expect(Popolo::DateString.evolve(empty)).to eq(nil)
120
+ end
119
121
  end
120
122
  end
121
123
  end
@@ -1,7 +1,9 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::GroupResult do
4
- [:group, :result].each do |attribute|
5
- it {should validate_presence_of attribute}
3
+ module Popolo
4
+ RSpec.describe GroupResult do
5
+ [:group, :result].each do |attribute|
6
+ it {should validate_presence_of attribute}
7
+ end
6
8
  end
7
9
  end
@@ -1,5 +1,7 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Identifier do
4
- it {should validate_presence_of :identifier}
3
+ module Popolo
4
+ RSpec.describe Identifier do
5
+ it {should validate_presence_of :identifier}
6
+ end
5
7
  end
@@ -1,5 +1,7 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Link do
4
- it {should validate_presence_of :url}
3
+ module Popolo
4
+ RSpec.describe Link do
5
+ it {should validate_presence_of :url}
6
+ end
5
7
  end
@@ -1,11 +1,13 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Membership do
4
- [:organization_id, :person_id].each do |attribute|
5
- it {should validate_presence_of attribute}
6
- end
3
+ module Popolo
4
+ RSpec.describe Membership do
5
+ [:organization_id, :person_id].each do |attribute|
6
+ it {should validate_presence_of attribute}
7
+ end
7
8
 
8
- [:start_date, :end_date].each do |attribute|
9
- it_should_behave_like 'a model with a date attribute', attribute
9
+ [:start_date, :end_date].each do |attribute|
10
+ it_behaves_like 'a model with a date attribute', attribute
11
+ end
10
12
  end
11
13
  end
@@ -1,5 +1,7 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Motion do
4
- it_should_behave_like 'a model with a date attribute', :date
3
+ module Popolo
4
+ RSpec.describe Motion do
5
+ it_behaves_like 'a model with a date attribute', :date
6
+ end
5
7
  end
@@ -1,7 +1,9 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Organization do
4
- [:founding_date, :dissolution_date].each do |attribute|
5
- it_should_behave_like 'a model with a date attribute', attribute
3
+ module Popolo
4
+ RSpec.describe Organization do
5
+ [:founding_date, :dissolution_date].each do |attribute|
6
+ it_behaves_like 'a model with a date attribute', attribute
7
+ end
6
8
  end
7
9
  end
@@ -1,9 +1,11 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::OtherName do
4
- it {should validate_presence_of :name}
3
+ module Popolo
4
+ RSpec.describe OtherName do
5
+ it {should validate_presence_of :name}
5
6
 
6
- [:start_date, :end_date].each do |attribute|
7
- it_should_behave_like 'a model with a date attribute', attribute
7
+ [:start_date, :end_date].each do |attribute|
8
+ it_behaves_like 'a model with a date attribute', attribute
9
+ end
8
10
  end
9
11
  end
@@ -1,29 +1,31 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe Popolo::Person do
4
- [:birth_date, :death_date].each do |attribute|
5
- it_should_behave_like 'a model with a date attribute', attribute
6
- end
7
-
8
- describe '#to_s' do
9
- it 'should return the name if the name, given name and family name are blank' do
10
- FactoryGirl.build(:person, name: nil).to_s.should == nil
3
+ module Popolo
4
+ RSpec.describe Person do
5
+ [:birth_date, :death_date].each do |attribute|
6
+ it_behaves_like 'a model with a date attribute', attribute
11
7
  end
12
8
 
13
- it 'should return the given name and family name if the name is blank' do
14
- FactoryGirl.build(:person, name: nil, given_name: 'John', family_name: 'Public').to_s.should == 'John Public'
15
- end
9
+ describe '#to_s' do
10
+ it 'should return the name if the name, given name and family name are blank' do
11
+ expect(FactoryGirl.build(:person, name: nil).to_s).to eq(nil)
12
+ end
16
13
 
17
- it 'should return the family name if the name and given name are blank' do
18
- FactoryGirl.build(:person, name: nil, family_name: 'Public').to_s.should == 'Public'
19
- end
14
+ it 'should return the given name and family name if the name is blank' do
15
+ expect(FactoryGirl.build(:person, name: nil, given_name: 'John', family_name: 'Public').to_s).to eq('John Public')
16
+ end
20
17
 
21
- it 'should return the given name if the name and family name are blank' do
22
- FactoryGirl.build(:person, name: nil, given_name: 'John').to_s.should == 'John'
23
- end
18
+ it 'should return the family name if the name and given name are blank' do
19
+ expect(FactoryGirl.build(:person, name: nil, family_name: 'Public').to_s).to eq('Public')
20
+ end
21
+
22
+ it 'should return the given name if the name and family name are blank' do
23
+ expect(FactoryGirl.build(:person, name: nil, given_name: 'John').to_s).to eq('John')
24
+ end
24
25
 
25
- it 'should return the name if present' do
26
- FactoryGirl.build(:person, given_name: 'John', family_name: 'Public').to_s.should == 'John Q. Public'
26
+ it 'should return the name if present' do
27
+ expect(FactoryGirl.build(:person, given_name: 'John', family_name: 'Public').to_s).to eq('John Q. Public')
28
+ end
27
29
  end
28
30
  end
29
31
  end