fooltip 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/fooltip/containers.js +6 -0
  3. data/app/assets/stylesheets/fooltip/containers.css.sass +5 -1
  4. data/app/controllers/fooltip/application_controller.rb +0 -1
  5. data/app/models/fooltip/container.rb +7 -1
  6. data/app/models/fooltip/link.rb +1 -1
  7. data/app/models/fooltip/popup.rb +3 -1
  8. data/app/uploaders/fooltip/image_uploader.rb +7 -5
  9. data/app/views/fooltip/containers/_container.html.haml +6 -3
  10. data/app/views/layouts/fooltip/application.html.haml +12 -0
  11. data/lib/fooltip/version.rb +1 -1
  12. data/spec/controllers/fooltip/containers_controller_spec.rb +15 -0
  13. data/spec/data/logo.gif +0 -0
  14. data/spec/data/models.rb +6 -0
  15. data/spec/data/schema.rb +10 -0
  16. data/spec/dummy/README.rdoc +261 -0
  17. data/spec/dummy/Rakefile +7 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  20. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  21. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  22. data/spec/dummy/app/views/layouts/application.html.haml +12 -0
  23. data/spec/dummy/config/application.rb +66 -0
  24. data/spec/dummy/config/boot.rb +10 -0
  25. data/spec/dummy/config/database.yml +25 -0
  26. data/spec/dummy/config/environment.rb +5 -0
  27. data/spec/dummy/config/environments/development.rb +37 -0
  28. data/spec/dummy/config/environments/production.rb +67 -0
  29. data/spec/dummy/config/environments/test.rb +37 -0
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/spec/dummy/config/initializers/inflections.rb +15 -0
  32. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  33. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  34. data/spec/dummy/config/initializers/session_store.rb +8 -0
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/spec/dummy/config/locales/en.yml +5 -0
  37. data/spec/dummy/config/routes.rb +3 -0
  38. data/spec/dummy/config.ru +4 -0
  39. data/spec/dummy/db/development.sqlite3 +0 -0
  40. data/spec/dummy/db/schema.rb +78 -0
  41. data/spec/dummy/db/test.sqlite3 +0 -0
  42. data/spec/dummy/log/development.log +185 -0
  43. data/spec/dummy/log/test.log +2045 -0
  44. data/spec/dummy/public/404.html +26 -0
  45. data/spec/dummy/public/422.html +26 -0
  46. data/spec/dummy/public/500.html +25 -0
  47. data/spec/dummy/public/favicon.ico +0 -0
  48. data/spec/dummy/public/uploads/fooltip/container/image/1/test_small.png +0 -0
  49. data/spec/dummy/public/uploads/fooltip/container/image/2/test_small.png +0 -0
  50. data/spec/dummy/script/rails +6 -0
  51. data/spec/dummy/tmp/cache/assets/C12/540/sprockets%2Fe422409b4963557190ca3040c56224d4 +0 -0
  52. data/spec/dummy/tmp/cache/assets/C79/930/sprockets%2Fa861857146e1fa262607477ba63f1c11 +0 -0
  53. data/spec/dummy/tmp/cache/assets/C7F/650/sprockets%2F3de8c7412fcd74f3312447a314241996 +0 -0
  54. data/spec/dummy/tmp/cache/assets/C84/410/sprockets%2F42ce1bfac21ec9611479472375848076 +0 -0
  55. data/spec/dummy/tmp/cache/assets/C89/3D0/sprockets%2Fa512a3e92488d8934374b378fb24c661 +0 -0
  56. data/spec/dummy/tmp/cache/assets/C98/310/sprockets%2Faecb14440227a14ead43126938621c90 +0 -0
  57. data/spec/dummy/tmp/cache/assets/CA5/070/sprockets%2F48d7b46452832d4e3c50c046ca73343a +0 -0
  58. data/spec/dummy/tmp/cache/assets/CB8/B60/sprockets%2F4768e955671fc74af259c134d5110c4e +0 -0
  59. data/spec/dummy/tmp/cache/assets/CBD/D00/sprockets%2Fb849096bf7cd430d3700e5759049d7f3 +0 -0
  60. data/spec/dummy/tmp/cache/assets/CDF/290/sprockets%2Ffa27582045d91bbc326d5562bf8a7373 +0 -0
  61. data/spec/dummy/tmp/cache/assets/CE3/7B0/sprockets%2F71092d61418cb58524fed3b9c074e94b +0 -0
  62. data/spec/dummy/tmp/cache/assets/CE5/E40/sprockets%2Fa795bdff77229a1315b860808b6730de +0 -0
  63. data/spec/dummy/tmp/cache/assets/CF0/DF0/sprockets%2F0c483472874e202fbef178f8464ea6e9 +0 -0
  64. data/spec/dummy/tmp/cache/assets/CF2/4B0/sprockets%2F42258a65f48286a3d8f8db4e196192fd +0 -0
  65. data/spec/dummy/tmp/cache/assets/CF3/CA0/sprockets%2F6474384eabec6e9079a5c7761486bd36 +0 -0
  66. data/spec/dummy/tmp/cache/assets/CFF/E40/sprockets%2F56f3043dbd5f13183feab1a87f072320 +0 -0
  67. data/spec/dummy/tmp/cache/assets/D09/5C0/sprockets%2Fa39c464abd94230a0e8be429304f67d4 +0 -0
  68. data/spec/dummy/tmp/cache/assets/D13/6B0/sprockets%2F584dd69de5c4afc42b6f1055b2778034 +0 -0
  69. data/spec/dummy/tmp/cache/assets/D15/9C0/sprockets%2F88bb29d5e96a3b8b76dd6f15061a2129 +0 -0
  70. data/spec/dummy/tmp/cache/assets/D1F/AF0/sprockets%2Fb5b10ab08e5ce010be8004ab7f722661 +0 -0
  71. data/spec/dummy/tmp/cache/assets/D21/7E0/sprockets%2F6547fdc4d7de9ab888b1d47834c12825 +0 -0
  72. data/spec/dummy/tmp/cache/assets/D24/3F0/sprockets%2F6fdf659d2ac27d36a91a78b814d25889 +0 -0
  73. data/spec/dummy/tmp/cache/assets/D24/5D0/sprockets%2Fb8180b99b5595c2ef880e77b8edf4430 +0 -0
  74. data/spec/dummy/tmp/cache/assets/D30/860/sprockets%2F33d83f499569ca6dd83c5d85e55b387f +0 -0
  75. data/spec/dummy/tmp/cache/assets/D33/9D0/sprockets%2F9ad41c00a47c157c591a507afc3ed493 +0 -0
  76. data/spec/dummy/tmp/cache/assets/D34/0E0/sprockets%2F12f74b83c9905a0a2eccbdb4d7427127 +0 -0
  77. data/spec/dummy/tmp/cache/assets/D36/E50/sprockets%2Fca333e38e361e5c848a44052a58bcfb2 +0 -0
  78. data/spec/dummy/tmp/cache/assets/D38/810/sprockets%2F0655ac6dcfb25a6313b99e15bcd31936 +0 -0
  79. data/spec/dummy/tmp/cache/assets/D4A/070/sprockets%2F693f1f55237e8ddbaa4e83784e4810be +0 -0
  80. data/spec/dummy/tmp/cache/assets/D58/700/sprockets%2Fb0d7a4813afa6c1e2c3c24b116668dc1 +0 -0
  81. data/spec/dummy/tmp/cache/assets/D5C/EC0/sprockets%2Fc83ee051397beae62ea012bd8c20e171 +0 -0
  82. data/spec/dummy/tmp/cache/assets/D5E/8F0/sprockets%2F58bf1fcb9dd93c6c09928e083a99d957 +0 -0
  83. data/spec/dummy/tmp/cache/assets/D63/060/sprockets%2Fe43c7422ad2991a737c506a6cfbaca08 +0 -0
  84. data/spec/dummy/tmp/cache/assets/D66/0B0/sprockets%2F599a0905bec5dff2ba5a03ba3524909d +0 -0
  85. data/spec/dummy/tmp/cache/assets/D66/920/sprockets%2F882924b1d1a0f7223cb2f1ee3dcb578d +0 -0
  86. data/spec/dummy/tmp/cache/assets/D66/960/sprockets%2F4bd5ea023e4ae3e19b0971a78684cab4 +0 -0
  87. data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F84c3e32721189b020cdb2ccaff7cc785 +0 -0
  88. data/spec/dummy/tmp/cache/assets/D6B/DD0/sprockets%2F7db3efa083c4a38597a1dadd835b0528 +0 -0
  89. data/spec/dummy/tmp/cache/assets/D6C/540/sprockets%2Fe23ba0d755bb180a2961d478e4a9dff4 +0 -0
  90. data/spec/dummy/tmp/cache/assets/D71/F80/sprockets%2F82e84d453d4341c77efdc557aabea318 +0 -0
  91. data/spec/dummy/tmp/cache/assets/D76/F30/sprockets%2Fe6cb8503cd99180bae3e862cb7f9d144 +0 -0
  92. data/spec/dummy/tmp/cache/assets/D93/6F0/sprockets%2F22b6e10f919d331bff2e6fa53cb55e2a +0 -0
  93. data/spec/dummy/tmp/cache/assets/D97/1A0/sprockets%2F8f4efba1871fb62583020cb1c6afdf35 +0 -0
  94. data/spec/dummy/tmp/cache/assets/D9D/710/sprockets%2F0250dfadb4c8d56a5c2701ed688c8a9d +0 -0
  95. data/spec/dummy/tmp/cache/assets/D9E/E70/sprockets%2F4b9ec8cdf5dbb2a621373b2667c68c4a +0 -0
  96. data/spec/dummy/tmp/cache/assets/DCB/A30/sprockets%2Fa7a93a5918614b7bfd4ede5a0f63c2db +0 -0
  97. data/spec/dummy/tmp/cache/assets/DCB/B70/sprockets%2F2c844f6fbf82ba0cbe7e8730c21ad64f +0 -0
  98. data/spec/dummy/tmp/cache/assets/DD2/810/sprockets%2F8e12ead9fea63a8ff44db33c62f4f505 +0 -0
  99. data/spec/dummy/tmp/cache/assets/DD8/610/sprockets%2Fd1976891ce3b0e86cfdd6dde213eda56 +0 -0
  100. data/spec/dummy/tmp/cache/assets/DF6/500/sprockets%2Fcef2687afea3a5f96ad213b11b9abf52 +0 -0
  101. data/spec/dummy/tmp/cache/assets/E55/040/sprockets%2F4e9fdbdfcaf848e4cee03db1c4005ba4 +0 -0
  102. data/spec/dummy/tmp/cache/sass/05c61e3b86f6e79287c8b349be7825cc5217eb30/application.css.sassc +0 -0
  103. data/spec/dummy/tmp/cache/sass/05c61e3b86f6e79287c8b349be7825cc5217eb30/containers.css.sassc +0 -0
  104. data/spec/dummy/tmp/cache/sass/b95cdf227345c18646630d554608b9276b4e1657/bootstrap.scssc +0 -0
  105. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_accordion.scssc +0 -0
  106. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_alerts.scssc +0 -0
  107. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_breadcrumbs.scssc +0 -0
  108. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_button-groups.scssc +0 -0
  109. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_buttons.scssc +0 -0
  110. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_carousel.scssc +0 -0
  111. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_close.scssc +0 -0
  112. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_code.scssc +0 -0
  113. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_component-animations.scssc +0 -0
  114. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_dropdowns.scssc +0 -0
  115. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_forms.scssc +0 -0
  116. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_grid.scssc +0 -0
  117. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_hero-unit.scssc +0 -0
  118. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_labels-badges.scssc +0 -0
  119. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_layouts.scssc +0 -0
  120. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_media.scssc +0 -0
  121. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_mixins.scssc +0 -0
  122. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_modals.scssc +0 -0
  123. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_navbar.scssc +0 -0
  124. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_navs.scssc +0 -0
  125. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_pager.scssc +0 -0
  126. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_pagination.scssc +0 -0
  127. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_popovers.scssc +0 -0
  128. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_progress-bars.scssc +0 -0
  129. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_reset.scssc +0 -0
  130. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_scaffolding.scssc +0 -0
  131. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_sprites.scssc +0 -0
  132. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_tables.scssc +0 -0
  133. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_thumbnails.scssc +0 -0
  134. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_tooltip.scssc +0 -0
  135. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_type.scssc +0 -0
  136. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_utilities.scssc +0 -0
  137. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_variables.scssc +0 -0
  138. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/_wells.scssc +0 -0
  139. data/spec/dummy/tmp/cache/sass/c42e1695c1e1b1c6ff23323f220608a8738467c8/bootstrap.scssc +0 -0
  140. data/spec/factories/fooltip/containers.rb +6 -0
  141. data/spec/factories/fooltip/links.rb +10 -0
  142. data/spec/factories/fooltip/popups.rb +7 -0
  143. data/spec/factories_spec.rb +10 -0
  144. data/spec/fooltip_spec.rb +40 -0
  145. data/spec/helpers/fooltip/containers_helper_spec.rb +17 -0
  146. data/spec/models/fooltip/association_spec.rb +25 -0
  147. data/spec/models/fooltip/container_spec.rb +16 -0
  148. data/spec/models/fooltip/link_spec.rb +34 -0
  149. data/spec/models/fooltip/popup_spec.rb +17 -0
  150. data/spec/spec_helper.rb +82 -0
  151. data/spec/uploaders/image_uploader_spec.rb +45 -0
  152. metadata +298 -3
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
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; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <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>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
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; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <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>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
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; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :container, class: 'Fooltip::Container' do
3
+ title "MyString"
4
+ description "MyText"
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :link, class: 'Fooltip::Link' do
3
+ container
4
+ popup
5
+ x 1
6
+ y 1
7
+ placement 1
8
+ trigger 1
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :popup, class: 'Fooltip::Popup' do
3
+ identifier "MyString"
4
+ title "MyString"
5
+ content "MyText"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ FactoryGirl.factories.map(&:name).each do |factory_name|
4
+ describe "The #{factory_name} factory" do
5
+ it 'should be valid' do
6
+ instance = FactoryGirl.build(factory_name)
7
+ instance.valid?.should be_true, instance.errors.full_messages.to_sentence
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Fooltip" do
4
+
5
+ context "ActiveRecord::Base" do
6
+ it "should respond to :has_fooltips" do
7
+ ActiveRecord::Base.should respond_to :has_fooltips
8
+ end
9
+ end
10
+
11
+ context "an instance of an ActiveRecord class calling 'has_fooltips'" do
12
+ let(:tf) { TestFooltip.new }
13
+ it "should respond to :fooltips" do
14
+ tf.should respond_to :fooltips
15
+ end
16
+ context "fooltips" do
17
+ before { tf.save }
18
+ let(:c) { FactoryGirl.create(:container) }
19
+ it "should have no records in fooltips before any have been added" do
20
+ tf.fooltips.should be_empty
21
+ end
22
+ it "should have have a record in fooltips if one has been added" do
23
+ tf.fooltips << c
24
+ tf.fooltips.count.should == 1
25
+ end
26
+ it "should add an Association when adding a container to fooltips" do
27
+ -> { tf.fooltips << c }.should change(Fooltip::Association, :count).by(1)
28
+ end
29
+ it "should remove an Association when deleting a container from fooltips" do
30
+ tf.fooltips << c
31
+ -> { tf.fooltips.last.destroy }.should change(Fooltip::Association, :count).by(-1)
32
+ end
33
+ it "should remove an Association when deleting its owner" do
34
+ tf.fooltips << c
35
+ -> { tf.destroy }.should change(Fooltip::Association, :count).by(-1)
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ # Specs in this file have access to a helper object that includes
4
+ # the ContainersHelper. For example:
5
+ #
6
+ # describe ContainersHelper do
7
+ # describe "string concat" do
8
+ # it "concats two strings with spaces" do
9
+ # helper.concat_strings("this","that").should == "this that"
10
+ # end
11
+ # end
12
+ # end
13
+ module Fooltip
14
+ describe ContainersHelper do
15
+ pending "add some examples to (or delete) #{__FILE__}"
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ module Fooltip
4
+ describe Association do
5
+ it { should belong_to(:owner) }
6
+ it { should belong_to(:container) }
7
+
8
+ it { should validate_presence_of :owner_id }
9
+ it { should validate_presence_of :owner_type }
10
+ it { should validate_presence_of :container_id }
11
+
12
+ it { should validate_uniqueness_of(:owner_id).scoped_to(:owner_type, :container_id) }
13
+
14
+ context "an instance of an ActiveRecord class calling 'has_fooltips'" do
15
+ let(:tf) { TestFooltip.new }
16
+ it "should respond to :fooltips" do
17
+ tf.should respond_to :fooltips
18
+ end
19
+ it "should not have any fooltips before any have been added" do
20
+ tf.fooltips.should be_empty
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ module Fooltip
4
+ describe Container do
5
+ it { should have_many(:links) }
6
+ it { should have_many(:associations) }
7
+ it { should have_many(:popups).through(:links) }
8
+
9
+ it "should destroy all associated links when destroyed" do
10
+ c = FactoryGirl.create(:container)
11
+ p = FactoryGirl.create(:popup)
12
+ FactoryGirl.create(:link, container: c, popup: p)
13
+ -> { c.destroy }.should change(Link, :count).by(-1)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ module Fooltip
4
+ describe Link do
5
+ it { should belong_to :container }
6
+ it { should belong_to :popup }
7
+
8
+ it { should validate_presence_of :container }
9
+ it { should validate_presence_of :popup }
10
+ it { should validate_presence_of :x }
11
+ it { should validate_presence_of :y }
12
+ it { should validate_presence_of :placement }
13
+ it { should validate_presence_of :trigger }
14
+
15
+ context ".placment_string" do
16
+ { 1 => 'top', 2 => 'right', 3 => 'bottom', 4 => 'left' }.each do |key, value|
17
+ it "should return '#{value}' for #{key}" do
18
+ subject.placement = key
19
+ subject.placement_string.should == value
20
+ end
21
+ end
22
+ end
23
+
24
+ context ".trigger_string" do
25
+ { 1 => 'click', 2 => 'hover', 3 => 'focus', 4 => 'manual' }.each do |key, value|
26
+ it "should return '#{value}' for #{key}" do
27
+ subject.trigger = key
28
+ subject.trigger_string.should == value
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ module Fooltip
4
+ describe Popup do
5
+ it { should have_many(:links) }
6
+ it { should have_many(:containers).through(:links) }
7
+
8
+ it { should validate_presence_of(:identifier) }
9
+
10
+ it "should destroy all associated links when destroyed" do
11
+ p = FactoryGirl.create(:popup, title: 'Test Popup')
12
+ c = FactoryGirl.create(:container)
13
+ FactoryGirl.create(:link, container: c, popup: p)
14
+ -> { p.destroy }.should change(Link, :count).by(-1)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,82 @@
1
+ require 'rubygems'
2
+
3
+ require 'spork'
4
+ #uncomment the following line to use spork with the debugger
5
+ #require 'spork/ext/ruby-debug'
6
+
7
+ def load_coverage
8
+ # SimpleCov & Coveralls
9
+ unless ENV['DRB']
10
+ require 'simplecov'
11
+ require 'coveralls'
12
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
13
+ SimpleCov::Formatter::HTMLFormatter,
14
+ Coveralls::SimpleCov::Formatter
15
+ ]
16
+ SimpleCov.start 'rails'
17
+ #Coveralls.wear!('rails')
18
+ end
19
+ end
20
+
21
+ Spork.prefork do
22
+ # Loading more in this block will cause your tests to run faster. However,
23
+ # if you change any configuration or code from libraries loaded here, you'll
24
+ # need to restart spork for it take effect.
25
+
26
+ load_coverage
27
+
28
+ ENV["RAILS_ENV"] ||= 'test'
29
+ require File.expand_path("../dummy/config/environment", __FILE__)
30
+ require 'rspec/rails'
31
+ require 'rspec/autorun'
32
+ require 'shoulda/matchers/integrations/rspec'
33
+
34
+ # Requires supporting ruby files with custom matchers and macros, etc,
35
+ # in spec/support/ and its subdirectories.
36
+ Dir[Fooltip::Engine.root.join("spec/support/**/*.rb")].each { |f| require f }
37
+
38
+ require File.expand_path('../data/schema', __FILE__)
39
+ require File.expand_path('../data/models', __FILE__)
40
+
41
+ RSpec.configure do |config|
42
+ # ## Mock Framework
43
+ #
44
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
45
+ #
46
+ # config.mock_with :mocha
47
+ # config.mock_with :flexmock
48
+ # config.mock_with :rr
49
+
50
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
51
+ config.fixture_path = "#{::Fooltip::Engine.root}/spec/fixtures"
52
+
53
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
54
+ # examples within a transaction, remove the following line or assign false
55
+ # instead of true.
56
+ config.use_transactional_fixtures = true
57
+
58
+ # If true, the base class of anonymous controllers will be inferred
59
+ # automatically. This will be the default behavior in future versions of
60
+ # rspec-rails.
61
+ config.infer_base_class_for_anonymous_controllers = false
62
+
63
+ # Run specs in random order to surface order dependencies. If you find an
64
+ # order dependency and want to debug it, you can fix the order by providing
65
+ # the seed, which is printed after each run.
66
+ # --seed 1234
67
+ config.order = "random"
68
+ end
69
+
70
+ FactoryGirl.find_definitions
71
+
72
+ CarrierWave.configure do |config|
73
+ config.storage = :file
74
+ config.enable_processing = false
75
+ end
76
+ end
77
+
78
+ Spork.each_run do
79
+ # This code will be run each time you run your specs.
80
+
81
+ load_coverage
82
+ end