rails_magic_renamer 2.0.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +6 -0
  5. data/CHANGELOG +4 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +173 -0
  8. data/Guardfile +11 -0
  9. data/Manifest +8 -0
  10. data/README.md +59 -0
  11. data/ROADMAP.md +60 -0
  12. data/Rakefile +2 -0
  13. data/lib/rails_magic_renamer.rb +343 -0
  14. data/lib/rails_magic_renamer/exceptions.rb +35 -0
  15. data/lib/rails_magic_renamer/version.rb +3 -0
  16. data/rails_magic_renamer.gemspec +36 -0
  17. data/spec/rails_helper.rb +26 -0
  18. data/spec/rails_magic_renamer_spec.rb +22 -0
  19. data/spec/spec_helper.rb +17 -0
  20. data/spec/support/sample_app_rails_4/.gitignore +19 -0
  21. data/spec/support/sample_app_rails_4/.rspec +2 -0
  22. data/spec/support/sample_app_rails_4/Gemfile +58 -0
  23. data/spec/support/sample_app_rails_4/Gemfile.lock +249 -0
  24. data/spec/support/sample_app_rails_4/Guardfile +53 -0
  25. data/spec/support/sample_app_rails_4/LICENSE +21 -0
  26. data/spec/support/sample_app_rails_4/README.md +25 -0
  27. data/spec/support/sample_app_rails_4/README.nitrous.md +20 -0
  28. data/spec/support/sample_app_rails_4/Rakefile +6 -0
  29. data/spec/support/sample_app_rails_4/app/assets/images/rails.png +0 -0
  30. data/spec/support/sample_app_rails_4/app/assets/javascripts/application.js +17 -0
  31. data/spec/support/sample_app_rails_4/app/assets/javascripts/sessions.js.coffee +3 -0
  32. data/spec/support/sample_app_rails_4/app/assets/javascripts/static_pages.js.coffee +3 -0
  33. data/spec/support/sample_app_rails_4/app/assets/javascripts/users.js.coffee +3 -0
  34. data/spec/support/sample_app_rails_4/app/assets/stylesheets/application.css +13 -0
  35. data/spec/support/sample_app_rails_4/app/assets/stylesheets/custom.css.scss +246 -0
  36. data/spec/support/sample_app_rails_4/app/assets/stylesheets/sessions.css.scss +3 -0
  37. data/spec/support/sample_app_rails_4/app/assets/stylesheets/static_pages.css.scss +3 -0
  38. data/spec/support/sample_app_rails_4/app/assets/stylesheets/users.css.scss +3 -0
  39. data/spec/support/sample_app_rails_4/app/controllers/application_controller.rb +6 -0
  40. data/spec/support/sample_app_rails_4/app/controllers/concerns/.keep +0 -0
  41. data/spec/support/sample_app_rails_4/app/controllers/microposts_controller.rb +31 -0
  42. data/spec/support/sample_app_rails_4/app/controllers/relationships_controller.rb +21 -0
  43. data/spec/support/sample_app_rails_4/app/controllers/sessions_controller.rb +21 -0
  44. data/spec/support/sample_app_rails_4/app/controllers/static_pages_controller.rb +18 -0
  45. data/spec/support/sample_app_rails_4/app/controllers/users_controller.rb +80 -0
  46. data/spec/support/sample_app_rails_4/app/helpers/application_helper.rb +12 -0
  47. data/spec/support/sample_app_rails_4/app/helpers/sessions_helper.rb +49 -0
  48. data/spec/support/sample_app_rails_4/app/helpers/static_pages_helper.rb +2 -0
  49. data/spec/support/sample_app_rails_4/app/helpers/users_helper.rb +10 -0
  50. data/spec/support/sample_app_rails_4/app/mailers/.keep +0 -0
  51. data/spec/support/sample_app_rails_4/app/models/.keep +0 -0
  52. data/spec/support/sample_app_rails_4/app/models/comment.rb +5 -0
  53. data/spec/support/sample_app_rails_4/app/models/concerns/.keep +0 -0
  54. data/spec/support/sample_app_rails_4/app/models/micropost.rb +14 -0
  55. data/spec/support/sample_app_rails_4/app/models/organisation.rb +3 -0
  56. data/spec/support/sample_app_rails_4/app/models/relationship.rb +6 -0
  57. data/spec/support/sample_app_rails_4/app/models/user.rb +57 -0
  58. data/spec/support/sample_app_rails_4/app/models/user_comment.rb +5 -0
  59. data/spec/support/sample_app_rails_4/app/views/layouts/_footer.html.erb +13 -0
  60. data/spec/support/sample_app_rails_4/app/views/layouts/_header.html.erb +31 -0
  61. data/spec/support/sample_app_rails_4/app/views/layouts/_shim.html.erb +3 -0
  62. data/spec/support/sample_app_rails_4/app/views/layouts/application.html.erb +22 -0
  63. data/spec/support/sample_app_rails_4/app/views/microposts/_micropost.html.erb +11 -0
  64. data/spec/support/sample_app_rails_4/app/views/relationships/create.js.erb +2 -0
  65. data/spec/support/sample_app_rails_4/app/views/relationships/destroy.js.erb +2 -0
  66. data/spec/support/sample_app_rails_4/app/views/sessions/new.html.erb +19 -0
  67. data/spec/support/sample_app_rails_4/app/views/shared/_error_messages.html.erb +12 -0
  68. data/spec/support/sample_app_rails_4/app/views/shared/_feed.html.erb +6 -0
  69. data/spec/support/sample_app_rails_4/app/views/shared/_feed_item.html.erb +15 -0
  70. data/spec/support/sample_app_rails_4/app/views/shared/_micropost_form.html.erb +7 -0
  71. data/spec/support/sample_app_rails_4/app/views/shared/_stats.html.erb +15 -0
  72. data/spec/support/sample_app_rails_4/app/views/shared/_user_info.html.erb +12 -0
  73. data/spec/support/sample_app_rails_4/app/views/static_pages/about.html.erb +8 -0
  74. data/spec/support/sample_app_rails_4/app/views/static_pages/contact.html.erb +6 -0
  75. data/spec/support/sample_app_rails_4/app/views/static_pages/help.html.erb +8 -0
  76. data/spec/support/sample_app_rails_4/app/views/static_pages/home.html.erb +34 -0
  77. data/spec/support/sample_app_rails_4/app/views/static_pages/show.html.erb +0 -0
  78. data/spec/support/sample_app_rails_4/app/views/users/_follow.html.erb +5 -0
  79. data/spec/support/sample_app_rails_4/app/views/users/_follow_form.html.erb +9 -0
  80. data/spec/support/sample_app_rails_4/app/views/users/_unfollow.html.erb +5 -0
  81. data/spec/support/sample_app_rails_4/app/views/users/_user.html.erb +8 -0
  82. data/spec/support/sample_app_rails_4/app/views/users/edit.html.erb +27 -0
  83. data/spec/support/sample_app_rails_4/app/views/users/index.html.erb +10 -0
  84. data/spec/support/sample_app_rails_4/app/views/users/new.html.erb +24 -0
  85. data/spec/support/sample_app_rails_4/app/views/users/show.html.erb +24 -0
  86. data/spec/support/sample_app_rails_4/app/views/users/show_follow.html.erb +30 -0
  87. data/spec/support/sample_app_rails_4/bin/bundle +3 -0
  88. data/spec/support/sample_app_rails_4/bin/rails +4 -0
  89. data/spec/support/sample_app_rails_4/bin/rake +4 -0
  90. data/spec/support/sample_app_rails_4/config.ru +4 -0
  91. data/spec/support/sample_app_rails_4/config/application.rb +31 -0
  92. data/spec/support/sample_app_rails_4/config/boot.rb +4 -0
  93. data/spec/support/sample_app_rails_4/config/cucumber.yml +8 -0
  94. data/spec/support/sample_app_rails_4/config/database.yml +12 -0
  95. data/spec/support/sample_app_rails_4/config/environment.rb +7 -0
  96. data/spec/support/sample_app_rails_4/config/environments/development.rb +27 -0
  97. data/spec/support/sample_app_rails_4/config/environments/production.rb +79 -0
  98. data/spec/support/sample_app_rails_4/config/environments/test.rb +39 -0
  99. data/spec/support/sample_app_rails_4/config/initializers/backtrace_silencers.rb +7 -0
  100. data/spec/support/sample_app_rails_4/config/initializers/filter_parameter_logging.rb +4 -0
  101. data/spec/support/sample_app_rails_4/config/initializers/inflections.rb +16 -0
  102. data/spec/support/sample_app_rails_4/config/initializers/mime_types.rb +5 -0
  103. data/spec/support/sample_app_rails_4/config/initializers/secret_token.rb +22 -0
  104. data/spec/support/sample_app_rails_4/config/initializers/session_store.rb +3 -0
  105. data/spec/support/sample_app_rails_4/config/initializers/wrap_parameters.rb +14 -0
  106. data/spec/support/sample_app_rails_4/config/locales/en.yml +23 -0
  107. data/spec/support/sample_app_rails_4/config/routes.rb +17 -0
  108. data/spec/support/sample_app_rails_4/db/development.sqlite3 +0 -0
  109. data/spec/support/sample_app_rails_4/db/migrate/20130311191400_create_users.rb +10 -0
  110. data/spec/support/sample_app_rails_4/db/migrate/20130311194153_add_index_to_users_email.rb +5 -0
  111. data/spec/support/sample_app_rails_4/db/migrate/20130311201841_add_password_digest_to_users.rb +5 -0
  112. data/spec/support/sample_app_rails_4/db/migrate/20130314184954_add_remember_token_to_users.rb +6 -0
  113. data/spec/support/sample_app_rails_4/db/migrate/20130315015932_add_admin_to_users.rb +5 -0
  114. data/spec/support/sample_app_rails_4/db/migrate/20130315175534_create_microposts.rb +11 -0
  115. data/spec/support/sample_app_rails_4/db/migrate/20130315230445_create_relationships.rb +13 -0
  116. data/spec/support/sample_app_rails_4/db/migrate/20160424113439_create_comments.rb +8 -0
  117. data/spec/support/sample_app_rails_4/db/migrate/20160424113451_create_user_comments.rb +8 -0
  118. data/spec/support/sample_app_rails_4/db/migrate/20160424114701_create_organisations.rb +8 -0
  119. data/spec/support/sample_app_rails_4/db/migrate/20160424114727_add_organisation_id_to_users.rb +5 -0
  120. data/spec/support/sample_app_rails_4/db/schema.rb +67 -0
  121. data/spec/support/sample_app_rails_4/db/seeds.rb +7 -0
  122. data/spec/support/sample_app_rails_4/db/test.sqlite3 +0 -0
  123. data/spec/support/sample_app_rails_4/factory_girl.rb +7 -0
  124. data/spec/support/sample_app_rails_4/features/signing_in.feature +13 -0
  125. data/spec/support/sample_app_rails_4/features/step_definitions/authentication_steps.rb +30 -0
  126. data/spec/support/sample_app_rails_4/features/support/env.rb +59 -0
  127. data/spec/support/sample_app_rails_4/lib/assets/.keep +0 -0
  128. data/spec/support/sample_app_rails_4/lib/tasks/.keep +0 -0
  129. data/spec/support/sample_app_rails_4/lib/tasks/cucumber.rake +65 -0
  130. data/spec/support/sample_app_rails_4/lib/tasks/sample_data.rake +42 -0
  131. data/spec/support/sample_app_rails_4/log/.keep +0 -0
  132. data/spec/support/sample_app_rails_4/public/404.html +27 -0
  133. data/spec/support/sample_app_rails_4/public/422.html +26 -0
  134. data/spec/support/sample_app_rails_4/public/500.html +26 -0
  135. data/spec/support/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css +5091 -0
  136. data/spec/support/sample_app_rails_4/public/assets/application-4962059d8f80f9bb096692bacc29c4e8.css.gz +0 -0
  137. data/spec/support/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js +12952 -0
  138. data/spec/support/sample_app_rails_4/public/assets/application-eeb856e3fe2c8f879c91d0e81d59cb40.js.gz +0 -0
  139. data/spec/support/sample_app_rails_4/public/assets/glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png +0 -0
  140. data/spec/support/sample_app_rails_4/public/assets/glyphicons-halflings-white-62b67d9edee3db90d18833087f848d6e.png +0 -0
  141. data/spec/support/sample_app_rails_4/public/assets/manifest-802de9eb1c853769101852422b620883.json +1 -0
  142. data/spec/support/sample_app_rails_4/public/assets/rails-231a680f23887d9dd70710ea5efd3c62.png +0 -0
  143. data/spec/support/sample_app_rails_4/public/favicon.ico +0 -0
  144. data/spec/support/sample_app_rails_4/public/robots.txt +5 -0
  145. data/spec/support/sample_app_rails_4/script/cucumber +10 -0
  146. data/spec/support/sample_app_rails_4/spec/controllers/relationships_controller_spec.rb +42 -0
  147. data/spec/support/sample_app_rails_4/spec/factories.rb +17 -0
  148. data/spec/support/sample_app_rails_4/spec/features/authentication_pages_spec.rb +155 -0
  149. data/spec/support/sample_app_rails_4/spec/features/micropost_pages_spec.rb +45 -0
  150. data/spec/support/sample_app_rails_4/spec/features/static_pages_spec.rb +64 -0
  151. data/spec/support/sample_app_rails_4/spec/features/user_pages_spec.rb +239 -0
  152. data/spec/support/sample_app_rails_4/spec/helpers/application_helper_spec.rb +18 -0
  153. data/spec/support/sample_app_rails_4/spec/models/comments_spec.rb +5 -0
  154. data/spec/support/sample_app_rails_4/spec/models/micropost_spec.rb +30 -0
  155. data/spec/support/sample_app_rails_4/spec/models/organisation_spec.rb +5 -0
  156. data/spec/support/sample_app_rails_4/spec/models/relationship_spec.rb +36 -0
  157. data/spec/support/sample_app_rails_4/spec/models/user_comments_spec.rb +5 -0
  158. data/spec/support/sample_app_rails_4/spec/models/user_spec.rb +108 -0
  159. data/spec/support/sample_app_rails_4/spec/spec_helper.rb +57 -0
  160. data/spec/support/sample_app_rails_4/spec/support/utilities.rb +21 -0
  161. data/spec/support/sample_app_rails_4/vendor/assets/javascripts/.keep +0 -0
  162. data/spec/support/sample_app_rails_4/vendor/assets/stylesheets/.keep +0 -0
  163. data/tasks/rspec.rake +4 -0
  164. metadata +534 -0
@@ -0,0 +1 @@
1
+ {"files":{"rails-231a680f23887d9dd70710ea5efd3c62.png":{"logical_path":"rails.png","mtime":"2013-03-06T18:36:31-08:00","size":6646,"digest":"231a680f23887d9dd70710ea5efd3c62"},"application-eeb856e3fe2c8f879c91d0e81d59cb40.js":{"logical_path":"application.js","mtime":"2013-09-06T09:23:56-07:00","size":363970,"digest":"eeb856e3fe2c8f879c91d0e81d59cb40"},"application-4962059d8f80f9bb096692bacc29c4e8.css":{"logical_path":"application.css","mtime":"2013-09-06T13:20:19-07:00","size":134254,"digest":"4962059d8f80f9bb096692bacc29c4e8"},"glyphicons-halflings-white-62b67d9edee3db90d18833087f848d6e.png":{"logical_path":"glyphicons-halflings-white.png","mtime":"2013-06-24T16:40:09-07:00","size":8777,"digest":"62b67d9edee3db90d18833087f848d6e"},"glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png":{"logical_path":"glyphicons-halflings.png","mtime":"2013-06-24T16:40:09-07:00","size":12799,"digest":"c806376f05e4ccabe2c5315a8e95667c"}},"assets":{"rails.png":"rails-231a680f23887d9dd70710ea5efd3c62.png","application.js":"application-eeb856e3fe2c8f879c91d0e81d59cb40.js","application.css":"application-4962059d8f80f9bb096692bacc29c4e8.css","glyphicons-halflings-white.png":"glyphicons-halflings-white-62b67d9edee3db90d18833087f848d6e.png","glyphicons-halflings.png":"glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png"}}
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
4
+ if vendored_cucumber_bin
5
+ load File.expand_path(vendored_cucumber_bin)
6
+ else
7
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
8
+ require 'cucumber'
9
+ load Cucumber::BINARY
10
+ end
@@ -0,0 +1,42 @@
1
+ require 'rails_helper'
2
+
3
+ describe RelationshipsController do
4
+
5
+ # let(:user) { FactoryGirl.create(:user) }
6
+ # let(:other_user) { FactoryGirl.create(:user) }
7
+
8
+ # before { sign_in user, no_capybara: true }
9
+
10
+ # describe "creating a relationship with Ajax" do
11
+
12
+ # it "should increment the Relationship count" do
13
+ # expect do
14
+ # xhr :post, :create, relationship: { followed_id: other_user.id }
15
+ # end.to change(Relationship, :count).by(1)
16
+ # end
17
+
18
+ # it "should respond with success" do
19
+ # xhr :post, :create, relationship: { followed_id: other_user.id }
20
+ # expect(response).to be_success
21
+ # end
22
+ # end
23
+
24
+ # describe "destroying a relationship with Ajax" do
25
+
26
+ # before { user.follow!(other_user) }
27
+ # let(:relationship) do
28
+ # user.relationships.find_by(followed_id: other_user.id)
29
+ # end
30
+
31
+ # it "should decrement the Relationship count" do
32
+ # expect do
33
+ # xhr :delete, :destroy, id: relationship.id
34
+ # end.to change(Relationship, :count).by(-1)
35
+ # end
36
+
37
+ # it "should respond with success" do
38
+ # xhr :delete, :destroy, id: relationship.id
39
+ # expect(response).to be_success
40
+ # end
41
+ # end
42
+ end
@@ -0,0 +1,17 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ sequence(:name) { |n| "Person #{n}" }
4
+ email { "person_#{rand(10000)}@example.com"}
5
+ password "foobar"
6
+ password_confirmation "foobar"
7
+
8
+ factory :admin do
9
+ admin true
10
+ end
11
+ end
12
+
13
+ factory :micropost do
14
+ content "Lorem ipsum"
15
+ user
16
+ end
17
+ end
@@ -0,0 +1,155 @@
1
+ require 'rails_helper'
2
+
3
+ describe "Authentication" do
4
+
5
+ # subject { page }
6
+
7
+ # describe "signin page" do
8
+ # before { visit signin_path }
9
+
10
+ # it { should have_content('Sign in') }
11
+ # it { should have_title('Sign in') }
12
+ # end
13
+
14
+ # describe "signin" do
15
+ # before { visit signin_path }
16
+
17
+ # describe "with invalid information" do
18
+ # before { click_button "Sign in" }
19
+
20
+ # it { should have_title('Sign in') }
21
+ # it { should have_error_message('Invalid') }
22
+
23
+ # describe "after visiting another page" do
24
+ # before { click_link "Home" }
25
+ # it { should_not have_selector('div.alert.alert-error') }
26
+ # end
27
+ # end
28
+
29
+ # describe "with valid information" do
30
+ # let(:user) { FactoryGirl.create(:user) }
31
+ # before do
32
+ # fill_in "Email", with: user.email.upcase
33
+ # fill_in "Password", with: user.password
34
+ # click_button "Sign in"
35
+ # end
36
+
37
+ # it { should have_title(user.name) }
38
+ # it { should have_link('Users', href: users_path) }
39
+ # it { should have_link('Profile', href: user_path(user)) }
40
+ # it { should have_link('Settings', href: edit_user_path(user)) }
41
+ # it { should have_link('Sign out', href: signout_path) }
42
+ # it { should_not have_link('Sign in', href: signin_path) }
43
+
44
+ # describe "followed by signout" do
45
+ # before { click_link "Sign out" }
46
+ # it { should have_link('Sign in') }
47
+ # end
48
+ # end
49
+ # end
50
+
51
+ # describe "authorization" do
52
+
53
+ # describe "for non-signed-in users" do
54
+ # let(:user) { FactoryGirl.create(:user) }
55
+
56
+ # describe "when attempting to visit a protected page" do
57
+ # before do
58
+ # visit edit_user_path(user)
59
+ # fill_in "Email", with: user.email
60
+ # fill_in "Password", with: user.password
61
+ # click_button "Sign in"
62
+ # end
63
+
64
+ # describe "after signing in" do
65
+
66
+ # it "should render the desired protected page" do
67
+ # expect(page).to have_title('Edit user')
68
+ # end
69
+ # end
70
+ # end
71
+
72
+ # describe "in the Users controller" do
73
+
74
+ # describe "visiting the edit page" do
75
+ # before { visit edit_user_path(user) }
76
+ # it { should have_title('Sign in') }
77
+ # end
78
+
79
+ # describe "submitting to the update action" do
80
+ # before { patch user_path(user) }
81
+ # specify { expect(response).to redirect_to(signin_path) }
82
+ # end
83
+
84
+ # describe "visiting the user index" do
85
+ # before { visit users_path }
86
+ # it { should have_title('Sign in') }
87
+ # end
88
+
89
+ # describe "visiting the following page" do
90
+ # before { visit following_user_path(user) }
91
+ # it { should have_title('Sign in') }
92
+ # end
93
+
94
+ # describe "visiting the followers page" do
95
+ # before { visit followers_user_path(user) }
96
+ # it { should have_title('Sign in') }
97
+ # end
98
+ # end
99
+
100
+ # describe "in the Microposts controller" do
101
+
102
+ # describe "submitting to the create action" do
103
+ # before { post microposts_path }
104
+ # specify { expect(response).to redirect_to(signin_path) }
105
+ # end
106
+
107
+ # describe "submitting to the destroy action" do
108
+ # before { delete micropost_path(FactoryGirl.create(:micropost)) }
109
+ # specify { expect(response).to redirect_to(signin_path) }
110
+ # end
111
+ # end
112
+
113
+ # describe "in the Relationships controller" do
114
+ # describe "submitting to the create action" do
115
+ # before { post relationships_path }
116
+ # specify { expect(response).to redirect_to(signin_path) }
117
+ # end
118
+
119
+ # describe "submitting to the destroy action" do
120
+ # before { delete relationship_path(1) }
121
+ # specify { expect(response).to redirect_to(signin_path) }
122
+ # end
123
+ # end
124
+ # end
125
+
126
+ # describe "as wrong user" do
127
+ # let(:user) { FactoryGirl.create(:user) }
128
+ # let(:wrong_user) { FactoryGirl.create(:user, email: "wrong@example.com") }
129
+ # before { sign_in user, no_capybara: true }
130
+
131
+ # describe "submitting a GET request to the Users#edit action" do
132
+ # before { get edit_user_path(wrong_user) }
133
+ # specify { expect(response.body).not_to match(full_title('Edit user')) }
134
+ # specify { expect(response).to redirect_to(root_url) }
135
+ # end
136
+
137
+ # describe "submitting a PATCH request to the Users#update action" do
138
+ # before { patch user_path(wrong_user) }
139
+ # specify { expect(response).to redirect_to(root_url) }
140
+ # end
141
+ # end
142
+
143
+ # describe "as non-admin user" do
144
+ # let(:user) { FactoryGirl.create(:user) }
145
+ # let(:non_admin) { FactoryGirl.create(:user) }
146
+
147
+ # before { sign_in non_admin, no_capybara: true }
148
+
149
+ # describe "submitting a DELETE request to the Users#destroy action" do
150
+ # before { delete user_path(user) }
151
+ # specify { expect(response).to redirect_to(root_url) }
152
+ # end
153
+ # end
154
+ # end
155
+ end
@@ -0,0 +1,45 @@
1
+ require 'rails_helper'
2
+
3
+ describe "Micropost pages" do
4
+
5
+ # subject { page }
6
+
7
+ # let(:user) { FactoryGirl.create(:user) }
8
+ # before { sign_in user }
9
+
10
+ # describe "micropost creation" do
11
+ # before { visit root_path }
12
+
13
+ # describe "with invalid information" do
14
+
15
+ # it "should not create a micropost" do
16
+ # expect { click_button "Post" }.not_to change(Micropost, :count)
17
+ # end
18
+
19
+ # describe "error messages" do
20
+ # before { click_button "Post" }
21
+ # it { should have_content('error') }
22
+ # end
23
+ # end
24
+
25
+ # describe "with valid information" do
26
+
27
+ # before { fill_in 'micropost_content', with: "Lorem ipsum" }
28
+ # it "should create a micropost" do
29
+ # expect { click_button "Post" }.to change(Micropost, :count).by(1)
30
+ # end
31
+ # end
32
+ # end
33
+
34
+ # describe "micropost destruction" do
35
+ # before { FactoryGirl.create(:micropost, user: user) }
36
+
37
+ # describe "as correct user" do
38
+ # before { visit root_path }
39
+
40
+ # it "should delete a micropost" do
41
+ # expect { click_link "delete" }.to change(Micropost, :count).by(-1)
42
+ # end
43
+ # end
44
+ # end
45
+ end
@@ -0,0 +1,64 @@
1
+ require 'rails_helper'
2
+
3
+ describe "Static pages" do
4
+
5
+ # subject { page }
6
+
7
+ # describe "Home page" do
8
+ # before { visit root_path }
9
+
10
+ # it { should have_content('Sample App') }
11
+ # it { should have_title(full_title('')) }
12
+ # it { should_not have_title('| Home') }
13
+
14
+ # describe "for signed-in users" do
15
+ # let(:user) { FactoryGirl.create(:user) }
16
+ # before do
17
+ # FactoryGirl.create(:micropost, user: user, content: "Lorem")
18
+ # FactoryGirl.create(:micropost, user: user, content: "Ipsum")
19
+ # sign_in user
20
+ # visit root_path
21
+ # end
22
+
23
+ # it "should render the user's feed" do
24
+ # user.feed.each do |item|
25
+ # expect(page).to have_selector("li##{item.id}", text: item.content)
26
+ # end
27
+ # end
28
+
29
+ # describe "follower/following counts" do
30
+ # let(:other_user) { FactoryGirl.create(:user) }
31
+ # before do
32
+ # other_user.follow!(user)
33
+ # visit root_path
34
+ # end
35
+
36
+ # it { should have_link("0 following", href: following_user_path(user)) }
37
+ # it { should have_link("1 followers", href: followers_user_path(user)) }
38
+ # end
39
+ # end
40
+ # end
41
+
42
+ # describe "Help page" do
43
+ # before { visit help_path }
44
+
45
+ # it { should have_content('Help') }
46
+ # it { should have_title(full_title('Help')) }
47
+ # end
48
+
49
+ # describe "About page" do
50
+ # before { visit about_path }
51
+
52
+ # it { should have_content('About') }
53
+ # it { should have_title(full_title('About Us')) }
54
+ # end
55
+
56
+ # describe "Contact page" do
57
+ # before { visit contact_path }
58
+
59
+ # it { should have_selector('h1', text: 'Contact') }
60
+ # it { should have_title(full_title('Contact')) }
61
+ # end
62
+
63
+
64
+ end
@@ -0,0 +1,239 @@
1
+ require 'rails_helper'
2
+
3
+ describe "User pages" do
4
+
5
+ # subject { page }
6
+
7
+ # describe "index" do
8
+ # let(:user) { FactoryGirl.create(:user) }
9
+ # before(:each) do
10
+ # sign_in user
11
+ # visit users_path
12
+ # end
13
+
14
+ # it { should have_title('All users') }
15
+ # it { should have_content('All users') }
16
+
17
+ # describe "pagination" do
18
+
19
+ # before(:all) { 30.times { FactoryGirl.create(:user) } }
20
+ # after(:all) { User.delete_all }
21
+
22
+ # it { should have_selector('div.pagination') }
23
+
24
+ # it "should list each user" do
25
+ # User.paginate(page: 1).each do |user|
26
+ # expect(page).to have_selector('li', text: user.name)
27
+ # end
28
+ # end
29
+ # end
30
+
31
+ # describe "delete links" do
32
+
33
+ # it { should_not have_link('delete') }
34
+
35
+ # describe "as an admin user" do
36
+ # let(:admin) { FactoryGirl.create(:admin) }
37
+ # before do
38
+ # sign_in admin
39
+ # visit users_path
40
+ # end
41
+
42
+ # it { should have_link('delete', href: user_path(User.first)) }
43
+ # it "should be able to delete another user" do
44
+ # expect do
45
+ # click_link('delete', match: :first)
46
+ # end.to change(User, :count).by(-1)
47
+ # end
48
+ # it { should_not have_link('delete', href: user_path(admin)) }
49
+ # end
50
+ # end
51
+ # end
52
+
53
+ # describe "profile page" do
54
+ # let(:user) { FactoryGirl.create(:user) }
55
+ # let!(:m1) { FactoryGirl.create(:micropost, user: user, content: "Foo") }
56
+ # let!(:m2) { FactoryGirl.create(:micropost, user: user, content: "Bar") }
57
+
58
+ # before { visit user_path(user) }
59
+
60
+ # it { should have_content(user.name) }
61
+ # it { should have_title(user.name) }
62
+
63
+ # describe "microposts" do
64
+ # it { should have_content(m1.content) }
65
+ # it { should have_content(m2.content) }
66
+ # it { should have_content(user.microposts.count) }
67
+ # end
68
+
69
+ # describe "follow/unfollow buttons" do
70
+ # let(:other_user) { FactoryGirl.create(:user) }
71
+ # before { sign_in user }
72
+
73
+ # describe "following a user" do
74
+ # before { visit user_path(other_user) }
75
+
76
+ # it "should increment the followed user count" do
77
+ # expect do
78
+ # click_button "Follow"
79
+ # end.to change(user.followed_users, :count).by(1)
80
+ # end
81
+
82
+ # it "should increment the other user's followers count" do
83
+ # expect do
84
+ # click_button "Follow"
85
+ # end.to change(other_user.followers, :count).by(1)
86
+ # end
87
+
88
+ # describe "toggling the button" do
89
+ # before { click_button "Follow" }
90
+ # it { should have_xpath("//input[@value='Unfollow']") }
91
+ # end
92
+ # end
93
+
94
+ # describe "unfollowing a user" do
95
+ # before do
96
+ # user.follow!(other_user)
97
+ # visit user_path(other_user)
98
+ # end
99
+
100
+ # it "should decrement the followed user count" do
101
+ # expect do
102
+ # click_button "Unfollow"
103
+ # end.to change(user.followed_users, :count).by(-1)
104
+ # end
105
+
106
+ # it "should decrement the other user's followers count" do
107
+ # expect do
108
+ # click_button "Unfollow"
109
+ # end.to change(other_user.followers, :count).by(-1)
110
+ # end
111
+
112
+ # describe "toggling the button" do
113
+ # before { click_button "Unfollow" }
114
+ # it { should have_xpath("//input[@value='Follow']") }
115
+ # end
116
+ # end
117
+ # end
118
+ # end
119
+
120
+ # describe "signup page" do
121
+ # before { visit signup_path }
122
+
123
+ # it { should have_content('Sign up') }
124
+ # it { should have_title(full_title('Sign up')) }
125
+ # end
126
+
127
+ # describe "signup" do
128
+
129
+ # before { visit signup_path }
130
+
131
+ # let(:submit) { "Create my account" }
132
+
133
+ # describe "with invalid information" do
134
+ # it "should not create a user" do
135
+ # expect { click_button submit }.not_to change(User, :count)
136
+ # end
137
+ # end
138
+
139
+ # describe "with valid information" do
140
+ # before do
141
+ # fill_in "Name", with: "Example User"
142
+ # fill_in "Email", with: "user@example.com"
143
+ # fill_in "Password", with: "foobar"
144
+ # fill_in "Confirmation", with: "foobar"
145
+ # end
146
+
147
+ # it "should create a user" do
148
+ # expect { click_button submit }.to change(User, :count).by(1)
149
+ # end
150
+
151
+ # describe "after saving the user" do
152
+ # before { click_button submit }
153
+ # let(:user) { User.find_by(email: 'user@example.com') }
154
+
155
+ # it { should have_link('Sign out') }
156
+ # it { should have_title(user.name) }
157
+ # it { should have_selector('div.alert.alert-success', text: 'Welcome') }
158
+ # end
159
+ # end
160
+ # end
161
+
162
+ # describe "edit" do
163
+ # let(:user) { FactoryGirl.create(:user) }
164
+ # before do
165
+ # sign_in user
166
+ # visit edit_user_path(user)
167
+ # end
168
+
169
+ # describe "page" do
170
+ # it { should have_content("Update your profile") }
171
+ # it { should have_title("Edit user") }
172
+ # it { should have_link('change', href: 'http://gravatar.com/emails') }
173
+ # end
174
+
175
+ # describe "with invalid information" do
176
+ # before { click_button "Save changes" }
177
+
178
+ # it { should have_content('error') }
179
+ # end
180
+
181
+ # describe "with valid information" do
182
+ # let(:new_name) { "New Name" }
183
+ # let(:new_email) { "new@example.com" }
184
+ # before do
185
+ # fill_in "Name", with: new_name
186
+ # fill_in "Email", with: new_email
187
+ # fill_in "Password", with: user.password
188
+ # fill_in "Confirm Password", with: user.password
189
+ # click_button "Save changes"
190
+ # end
191
+
192
+ # it { should have_title(new_name) }
193
+ # it { should have_selector('div.alert.alert-success') }
194
+ # it { should have_link('Sign out', href: signout_path) }
195
+ # specify { expect(user.reload.name).to eq new_name }
196
+ # specify { expect(user.reload.email).to eq new_email }
197
+ # end
198
+
199
+ # describe "forbidden attributes" do
200
+ # let(:params) do
201
+ # { user: { admin: true, password: user.password,
202
+ # password_confirmation: user.password } }
203
+ # end
204
+ # before do
205
+ # sign_in user, no_capybara: true
206
+ # patch user_path(user), params
207
+ # end
208
+ # specify { expect(user.reload).not_to be_admin }
209
+ # end
210
+ # end
211
+
212
+ # describe "following/followers" do
213
+ # let(:user) { FactoryGirl.create(:user) }
214
+ # let(:other_user) { FactoryGirl.create(:user) }
215
+ # before { user.follow!(other_user) }
216
+
217
+ # describe "followed users" do
218
+ # before do
219
+ # sign_in user
220
+ # visit following_user_path(user)
221
+ # end
222
+
223
+ # it { should have_title(full_title('Following')) }
224
+ # it { should have_selector('h3', text: 'Following') }
225
+ # it { should have_link(other_user.name, href: user_path(other_user)) }
226
+ # end
227
+
228
+ # describe "followers" do
229
+ # before do
230
+ # sign_in other_user
231
+ # visit followers_user_path(other_user)
232
+ # end
233
+
234
+ # it { should have_title(full_title('Followers')) }
235
+ # it { should have_selector('h3', text: 'Followers') }
236
+ # it { should have_link(user.name, href: user_path(user)) }
237
+ # end
238
+ # end
239
+ end