polygallery 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/polygallery/acts_as_polyphoto.rb +48 -0
  3. data/app/models/polygallery/gallery.rb +1 -20
  4. data/app/models/polygallery/photo.rb +1 -24
  5. data/app/views/polygallery/galleries/_simple_fields_for.html.haml +3 -3
  6. data/lib/polygallery/has_polygallery.rb +7 -11
  7. data/lib/polygallery/has_polyphotos.rb +52 -9
  8. data/lib/polygallery/version.rb +1 -1
  9. data/test/dummy/app/assets/javascripts/application.js +1 -0
  10. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  11. data/test/dummy/app/controllers/events_controller.rb +3 -2
  12. data/test/dummy/app/models/custom_gallery.rb +13 -6
  13. data/test/dummy/app/models/event.rb +5 -4
  14. data/test/dummy/app/views/layouts/application.html.haml +7 -2
  15. data/test/dummy/config/application.rb +2 -1
  16. data/test/dummy/config/initializers/simple_form_fileinput.rb +9 -7
  17. data/test/dummy/config/routes.rb +1 -0
  18. data/test/dummy/db/migrate/20150320165705_create_polygalleries.rb +22 -0
  19. data/test/dummy/db/schema.rb +3 -3
  20. data/test/dummy/log/development.log +6400 -0
  21. data/test/dummy/log/test.log +8949 -0
  22. data/test/dummy/public/system/polygallery/photos/photos/000/000/002/medium/logo_placeholder_medium.png +0 -0
  23. data/test/dummy/public/system/polygallery/photos/photos/000/000/002/original/logo_placeholder_medium.png +0 -0
  24. data/test/dummy/public/system/polygallery/photos/photos/000/000/002/thumb/logo_placeholder_medium.png +0 -0
  25. data/test/dummy/public/system/polygallery/photos/photos/000/000/003/medium/logo_placeholder_medium.png +0 -0
  26. data/test/dummy/public/system/polygallery/photos/photos/000/000/003/original/logo_placeholder_medium.png +0 -0
  27. data/test/dummy/public/system/polygallery/photos/photos/000/000/003/thumb/logo_placeholder_medium.png +0 -0
  28. data/test/dummy/public/system/polygallery/photos/photos/000/000/004/medium/logo_placeholder_medium.png +0 -0
  29. data/test/dummy/public/system/polygallery/photos/photos/000/000/004/original/logo_placeholder_medium.png +0 -0
  30. data/test/dummy/public/system/polygallery/photos/photos/000/000/004/thumb/logo_placeholder_medium.png +0 -0
  31. data/test/dummy/spec/factories/events.rb +7 -0
  32. data/test/dummy/spec/factories/polygallery/photos.rb +7 -0
  33. data/test/dummy/spec/features/events_spec.rb +60 -0
  34. data/test/dummy/spec/rails_helper.rb +50 -0
  35. data/test/dummy/spec/spec_helper.rb +138 -0
  36. data/test/dummy/spec/upload_files/logo_placeholder_medium.png +0 -0
  37. data/test/dummy/tmp/cache/assets/development/sass/d58d4fb9eedfbbaea362e7eed4f4b120ecc36459/enhancements.css.scssc +0 -0
  38. data/test/dummy/tmp/cache/assets/development/sprockets/138f3adae029720184284e5af56ba6ee +0 -0
  39. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  40. data/test/dummy/tmp/cache/assets/development/sprockets/165fa1b3eb4e30266c9cd78ba25a6879 +0 -0
  41. data/test/dummy/tmp/cache/assets/development/sprockets/1b48b24452c10fa45f34ec79aa2ca587 +0 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/1c9faaf28d05409b88ad3113374d613c +0 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/1d61d3cd6f59fc3758908d3ea27aaf0b +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/1e1c73f8892119a4dbc6ead7718b4472 +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/20537eac47b88a0b70cf0fec72c5c957 +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/23a02f793bdc3b6a6cbd015f184c6f6c +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/24670b1af8e69df61aafc78f7817bcee +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/2757fae967a52701ef3724ae5a76c4a8 +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/2822de3b22c28bd5e718c9bf500457b2 +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/29e4552fca58a1885579b3932b6a9603 +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/2b731b63fb1d665043d920a05b591cdc +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/30e3552cad42917377b8675173b87d6d +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/3285c3b5fd63e6e64ad469b8d96aae8f +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/366b734bd9d2050f91efe4fa45bd1f60 +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/3f657ddfc843294ed3fc8242f82e7a97 +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/40fc2f3d2a468a00e463f1d313cb1683 +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/4838bd0bcba2e22c3c7aef8feb88db17 +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/49e036553e32b5ecddd9e7de7a25ccea +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/4a98a84c5ce12f2b9646335623b4e224 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/4daff1d5b8e6da6d2ed55886db193ef2 +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/4ea33e825e6e38bd22dccab488a0255b +0 -0
  64. data/test/dummy/tmp/cache/assets/development/sprockets/5ef83a7011cee8efacb9afc7173fe765 +0 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/65dccf676de4439612547abc6451ba65 +0 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/69bda14eaa1d8ad1ea1235abb619e366 +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/7b45798a1475deb0d6739c888f060c96 +0 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/7be9086c960bb4384c9d23a52e489f29 +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/7c5867dbaa2d85cd5508dc339972e314 +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/86f909bf5baee50515afadaa3ce2df8f +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/8c81470cda06da3ee9ec2181fe7743b0 +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/8e3f978ef00686e7a7cad1a57185f90a +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/8e5a9738e9bc15478e026d98335454f9 +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/8f29e45e02d0321a6250df9b5ca050fe +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/8f8936f164170e095c5ca2d0c2ae6127 +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/9b9c0e78635195bcb386a8b6e9ee1e97 +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/a49b0e8a393070d4a440d78743af3460 +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/a995a3b95e4a7b0e5b9fa7c49efd6b74 +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/a9f028f7a492b5907ed80268be8f50f4 +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/abfcce22636ec4371a92e6ceb1077a54 +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/b2e3c54b17f3d7fc54aab42082c470f8 +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/b878faf942403e313a5b103e5d80488e +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/b9b29a56a8585a110f306871e8938d2b +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/ba56eb60d599a0ca3d2f6b67772774c2 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/c502e11bd52b854e6af9627c3da0616a +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/cebfc296bf824dfc0f567874a00522d4 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/cf29797a4195344bac977b8ebfca7fff +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/e33b68bc0cecc21d45c44c8d2fd46c76 +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/e4b5a49edafa42a1ffe8f10535156b1b +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/edbef6e0d0a4742346cf479f2c522eb0 +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/f1ea202e87b3ffc6964c9b0358531976 +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/f209bca5b11567d04157eefee66c6a48 +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/f5d86e31abec9b44e777e3f639187d5a +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/f644fd75cbead0e58c847aa16546e2a8 +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/f844ec54464006be394ce9de15eb0814 +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/f950876669f7719a544d0de445843b08 +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sass/d58d4fb9eedfbbaea362e7eed4f4b120ecc36459/enhancements.css.scssc +0 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/138f3adae029720184284e5af56ba6ee +0 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/165fa1b3eb4e30266c9cd78ba25a6879 +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/1b48b24452c10fa45f34ec79aa2ca587 +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/1c9faaf28d05409b88ad3113374d613c +0 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/1e1c73f8892119a4dbc6ead7718b4472 +0 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/20537eac47b88a0b70cf0fec72c5c957 +0 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/23a02f793bdc3b6a6cbd015f184c6f6c +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/2757fae967a52701ef3724ae5a76c4a8 +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/29e4552fca58a1885579b3932b6a9603 +0 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/2b731b63fb1d665043d920a05b591cdc +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/3f657ddfc843294ed3fc8242f82e7a97 +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/40fc2f3d2a468a00e463f1d313cb1683 +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/4838bd0bcba2e22c3c7aef8feb88db17 +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/4a98a84c5ce12f2b9646335623b4e224 +0 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/4ea33e825e6e38bd22dccab488a0255b +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/65dccf676de4439612547abc6451ba65 +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/69bda14eaa1d8ad1ea1235abb619e366 +0 -0
  121. data/test/dummy/tmp/cache/assets/test/sprockets/7b45798a1475deb0d6739c888f060c96 +0 -0
  122. data/test/dummy/tmp/cache/assets/test/sprockets/7be9086c960bb4384c9d23a52e489f29 +0 -0
  123. data/test/dummy/tmp/cache/assets/test/sprockets/86f909bf5baee50515afadaa3ce2df8f +0 -0
  124. data/test/dummy/tmp/cache/assets/test/sprockets/8c81470cda06da3ee9ec2181fe7743b0 +0 -0
  125. data/test/dummy/tmp/cache/assets/test/sprockets/8e3f978ef00686e7a7cad1a57185f90a +0 -0
  126. data/test/dummy/tmp/cache/assets/test/sprockets/8e5a9738e9bc15478e026d98335454f9 +0 -0
  127. data/test/dummy/tmp/cache/assets/test/sprockets/8f29e45e02d0321a6250df9b5ca050fe +0 -0
  128. data/test/dummy/tmp/cache/assets/test/sprockets/9b9c0e78635195bcb386a8b6e9ee1e97 +0 -0
  129. data/test/dummy/tmp/cache/assets/test/sprockets/a49b0e8a393070d4a440d78743af3460 +0 -0
  130. data/test/dummy/tmp/cache/assets/test/sprockets/abfcce22636ec4371a92e6ceb1077a54 +0 -0
  131. data/test/dummy/tmp/cache/assets/test/sprockets/b878faf942403e313a5b103e5d80488e +0 -0
  132. data/test/dummy/tmp/cache/assets/test/sprockets/b9b29a56a8585a110f306871e8938d2b +0 -0
  133. data/test/dummy/tmp/cache/assets/test/sprockets/cebfc296bf824dfc0f567874a00522d4 +0 -0
  134. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  135. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  136. data/test/dummy/tmp/cache/assets/test/sprockets/e33b68bc0cecc21d45c44c8d2fd46c76 +0 -0
  137. data/test/dummy/tmp/cache/assets/test/sprockets/e4b5a49edafa42a1ffe8f10535156b1b +0 -0
  138. data/test/dummy/tmp/cache/assets/test/sprockets/edbef6e0d0a4742346cf479f2c522eb0 +0 -0
  139. data/test/dummy/tmp/cache/assets/test/sprockets/f1ea202e87b3ffc6964c9b0358531976 +0 -0
  140. data/test/dummy/tmp/cache/assets/test/sprockets/f209bca5b11567d04157eefee66c6a48 +0 -0
  141. data/test/dummy/tmp/cache/assets/test/sprockets/f5d86e31abec9b44e777e3f639187d5a +0 -0
  142. data/test/dummy/tmp/cache/assets/test/sprockets/f644fd75cbead0e58c847aa16546e2a8 +0 -0
  143. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  144. data/test/dummy/tmp/cache/assets/test/sprockets/f950876669f7719a544d0de445843b08 +0 -0
  145. data/test/dummy/tmp/pids/server.pid +1 -0
  146. metadata +299 -2
@@ -0,0 +1,7 @@
1
+ include ActionDispatch::TestProcess
2
+
3
+ FactoryGirl.define do
4
+ factory :event do
5
+ title { FFaker::BaconIpsum.words(3).join(' ').titleize }
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ include ActionDispatch::TestProcess
2
+
3
+ FactoryGirl.define do
4
+ factory :photo, :class => Polygallery::Photo do
5
+ caption { [nil, FFaker::BaconIpsum.paragraph].sample }
6
+ end
7
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Events:', :js => true do
4
+ def add_photo_to_form(attrs=nil)
5
+ # attrs ||= build :photo
6
+ last_tr = all('.polygallery-photos-table tr').last
7
+ if last_tr.find('input[id$="_photo"]').value.present?
8
+ page.execute_script <<-SCRIPT
9
+ $('.btn.add_fields[data-association="photo"]').click();
10
+ SCRIPT
11
+ last_tr = all('.polygallery-photos-table tr').last
12
+ end
13
+ within last_tr do
14
+ find('input[id$="_photo"]').set Rails.root.join('spec', 'upload_files',
15
+ 'logo_placeholder_medium.png')
16
+ find('input[id$="_caption"]').set('Test test test')
17
+ yield if block_given?
18
+ end
19
+ end
20
+
21
+ describe 'with SimpleForm' do
22
+ def complete_the_form(attrs=nil)
23
+ attrs ||= attributes_for :event
24
+ within 'form.simple_form.new_event' do
25
+ fill_in 'Title', :with => attrs[:title]
26
+ yield if block_given?
27
+ click_button 'Create Event'
28
+ end
29
+ end
30
+ def expect_success
31
+ expect(page).to have_content 'Your event has been saved!'
32
+ end
33
+ def expect_failure
34
+ expect(page).to have_content 'Your event could not be saved!'
35
+ end
36
+
37
+ it 'basically works' do
38
+ visit root_path
39
+ complete_the_form
40
+ expect_success
41
+ expect(Event.count).to eq 1
42
+ end
43
+
44
+ it 'works when an image is attached' do
45
+ visit root_path
46
+ complete_the_form { add_photo_to_form }
47
+ expect_success
48
+ expect(Event.count).to eq 1
49
+ e = Event.last
50
+ expect(e.custom_gallery_photos.count).to eq 1
51
+ photo = e.custom_gallery_photos.first
52
+ puts photo
53
+ expect(photo.photo.file?).to be true
54
+ end
55
+ end
56
+
57
+ describe 'without SimpleForm' do
58
+ it 'basically works'
59
+ end
60
+ end
@@ -0,0 +1,50 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require 'spec_helper'
4
+ require File.expand_path('../../config/environment', __FILE__)
5
+ require 'rspec/rails'
6
+ # Add additional requires below this line. Rails is not loaded until this point!
7
+
8
+ # Requires supporting ruby files with custom matchers and macros, etc, in
9
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
10
+ # run as spec files by default. This means that files in spec/support that end
11
+ # in _spec.rb will both be required and run as specs, causing the specs to be
12
+ # run twice. It is recommended that you do not name files matching this glob to
13
+ # end with _spec.rb. You can configure this pattern with the --pattern
14
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
15
+ #
16
+ # The following line is provided for convenience purposes. It has the downside
17
+ # of increasing the boot-up time by auto-requiring all files in the support
18
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
19
+ # require only the support files necessary.
20
+ #
21
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
22
+
23
+ # Checks for pending migrations before tests are run.
24
+ # If you are not using ActiveRecord, you can remove this line.
25
+ ActiveRecord::Migration.maintain_test_schema!
26
+
27
+ RSpec.configure do |config|
28
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
30
+
31
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
+ # examples within a transaction, remove the following line or assign false
33
+ # instead of true.
34
+ config.use_transactional_fixtures = true
35
+
36
+ # RSpec Rails can automatically mix in different behaviours to your tests
37
+ # based on their file location, for example enabling you to call `get` and
38
+ # `post` in specs under `spec/controllers`.
39
+ #
40
+ # You can disable this behaviour by removing the line below, and instead
41
+ # explicitly tag your specs with their type, e.g.:
42
+ #
43
+ # RSpec.describe UsersController, :type => :controller do
44
+ # # ...
45
+ # end
46
+ #
47
+ # The different available types are documented in the features, such as in
48
+ # https://relishapp.com/rspec/rspec-rails/docs
49
+ config.infer_spec_type_from_file_location!
50
+ end
@@ -0,0 +1,138 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ ENV["RAILS_ENV"] = 'test'
21
+ require File.expand_path("../../../dummy/config/environment", __FILE__)
22
+ require 'rspec/rails'
23
+ require 'selenium-webdriver'
24
+ require 'capybara/rails'
25
+ require 'capybara/dsl'
26
+ require 'factory_girl_rails'
27
+ require 'database_cleaner'
28
+ require 'ffaker'
29
+ require 'sass'
30
+
31
+ Capybara.app_host = 'http://localhost:3003'
32
+ Capybara.server_port = 3003
33
+ Capybara.default_wait_time = 15
34
+ Capybara.register_driver :chrome do |app|
35
+ Capybara::Selenium::Driver.new(app, :browser => :chrome)
36
+ end
37
+ Capybara.javascript_driver = :chrome # :poltergeist
38
+
39
+ # Requires supporting ruby files with custom matchers and macros, etc,
40
+ # in spec/support/ and its subdirectories.
41
+ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
42
+
43
+ # Checks for pending migrations before tests are run.
44
+ # If you are not using ActiveRecord, you can remove this line.
45
+ ActiveRecord::Migration.maintain_test_schema!
46
+
47
+ RSpec.configure do |config|
48
+ # rspec-expectations config goes here. You can use an alternate
49
+ # assertion/expectation library such as wrong or the stdlib/minitest
50
+ # assertions if you prefer.
51
+ config.expect_with :rspec do |expectations|
52
+ # This option will default to `true` in RSpec 4. It makes the `description`
53
+ # and `failure_message` of custom matchers include text for helper methods
54
+ # defined using `chain`, e.g.:
55
+ # be_bigger_than(2).and_smaller_than(4).description
56
+ # # => "be bigger than 2 and smaller than 4"
57
+ # ...rather than:
58
+ # # => "be bigger than 2"
59
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
60
+ end
61
+
62
+ # rspec-mocks config goes here. You can use an alternate test double
63
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
64
+ config.mock_with :rspec do |mocks|
65
+ # Prevents you from mocking or stubbing a method that does not exist on
66
+ # a real object. This is generally recommended, and will default to
67
+ # `true` in RSpec 4.
68
+ mocks.verify_partial_doubles = true
69
+ end
70
+
71
+ config.order = "random"
72
+
73
+ config.include FactoryGirl::Syntax::Methods
74
+
75
+ config.infer_spec_type_from_file_location!
76
+
77
+ config.use_transactional_fixtures = false
78
+
79
+ config.before :each do
80
+ ActionMailer::Base.deliveries = []
81
+ if Capybara.current_driver == :rack_test
82
+ DatabaseCleaner.strategy = :transaction
83
+ else
84
+ DatabaseCleaner.strategy = :truncation
85
+ end
86
+ DatabaseCleaner.start
87
+ end
88
+
89
+ config.after do
90
+ DatabaseCleaner.clean
91
+ end
92
+
93
+
94
+ # The settings below are suggested to provide a good initial experience
95
+ # with RSpec, but feel free to customize to your heart's content.
96
+ =begin
97
+ # These two settings work together to allow you to limit a spec run
98
+ # to individual examples or groups you care about by tagging them with
99
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
100
+ # get run.
101
+ config.filter_run :focus
102
+ config.run_all_when_everything_filtered = true
103
+
104
+ # Limits the available syntax to the non-monkey patched syntax that is
105
+ # recommended. For more details, see:
106
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
107
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
108
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
109
+ config.disable_monkey_patching!
110
+
111
+ # Many RSpec users commonly either run the entire suite or an individual
112
+ # file, and it's useful to allow more verbose output when running an
113
+ # individual spec file.
114
+ if config.files_to_run.one?
115
+ # Use the documentation formatter for detailed output,
116
+ # unless a formatter has already been configured
117
+ # (e.g. via a command-line flag).
118
+ config.default_formatter = 'doc'
119
+ end
120
+
121
+ # Print the 10 slowest examples and example groups at the
122
+ # end of the spec run, to help surface which specs are running
123
+ # particularly slow.
124
+ config.profile_examples = 10
125
+
126
+ # Run specs in random order to surface order dependencies. If you find an
127
+ # order dependency and want to debug it, you can fix the order by providing
128
+ # the seed, which is printed after each run.
129
+ # --seed 1234
130
+ config.order = :random
131
+
132
+ # Seed global randomization in this process using the `--seed` CLI option.
133
+ # Setting this allows you to use `--seed` to deterministically reproduce
134
+ # test failures related to randomization by passing the same `--seed` value
135
+ # as the one that triggered the failure.
136
+ Kernel.srand config.seed
137
+ =end
138
+ end
@@ -0,0 +1 @@
1
+ 55735