cartoset 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +11 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +195 -0
  5. data/LICENSE +27 -0
  6. data/README.markdown +66 -0
  7. data/Rakefile +1 -0
  8. data/app/assets/fonts/museosans_500-webfont.eot +0 -0
  9. data/app/assets/fonts/museosans_500-webfont.svg +247 -0
  10. data/app/assets/fonts/museosans_500-webfont.ttf +0 -0
  11. data/app/assets/fonts/museosans_500-webfont.woff +0 -0
  12. data/app/assets/images/backgrounds/bottom_blue.png +0 -0
  13. data/app/assets/images/backgrounds/bubble_bottom.png +0 -0
  14. data/app/assets/images/backgrounds/bubble_top.png +0 -0
  15. data/app/assets/images/backgrounds/mid_blue.png +0 -0
  16. data/app/assets/images/backgrounds/top_blue.png +0 -0
  17. data/app/assets/images/bg_content_box.png +0 -0
  18. data/app/assets/images/bg_input.png +0 -0
  19. data/app/assets/images/globe.png +0 -0
  20. data/app/assets/images/globe_with_clouds.png +0 -0
  21. data/app/assets/images/next_steps_diagram.png +0 -0
  22. data/app/assets/images/rails.png +0 -0
  23. data/app/assets/images/select.png +0 -0
  24. data/app/assets/images/sprites/admin.png +0 -0
  25. data/app/assets/images/sprites/htmlArea.png +0 -0
  26. data/app/assets/images/sprites/setup.png +0 -0
  27. data/app/assets/javascripts/admin/dashboard/index.js +82 -0
  28. data/app/assets/javascripts/admin/features/new.js +47 -0
  29. data/app/assets/javascripts/admin/pages/new.js +44 -0
  30. data/app/assets/javascripts/features/index.js +33 -0
  31. data/app/assets/javascripts/fileuploader.js +1247 -0
  32. data/app/assets/javascripts/jHtmlArea-0.7.0.min.js +8 -0
  33. data/app/assets/javascripts/jquery.jscrollpane.min.js +11 -0
  34. data/app/assets/javascripts/jquery.mousewheel.js +78 -0
  35. data/app/assets/javascripts/jquery.scrollTo-1.4.2.js +11 -0
  36. data/app/assets/javascripts/prettyfile.js +51 -0
  37. data/app/assets/javascripts/setup/step1.js +37 -0
  38. data/app/assets/javascripts/setup/step2.js +19 -0
  39. data/app/assets/javascripts/setup/step3.js +111 -0
  40. data/app/assets/javascripts/spin.js +306 -0
  41. data/app/assets/javascripts/utils.js +6 -0
  42. data/app/assets/stylesheets/_admin.colors.scss +45 -0
  43. data/app/assets/stylesheets/_admin.vars.scss +1 -0
  44. data/app/assets/stylesheets/_main.fonts.scss +10 -0
  45. data/app/assets/stylesheets/_main.mixins.scss +7 -0
  46. data/app/assets/stylesheets/_main.vars.scss +1 -0
  47. data/app/assets/stylesheets/_mixins.css3.scss +24 -0
  48. data/app/assets/stylesheets/admin.css.scss +434 -0
  49. data/app/assets/stylesheets/admin/_mixins.scss +3 -0
  50. data/app/assets/stylesheets/admin/dashboard/index.css.scss +303 -0
  51. data/app/assets/stylesheets/admin/features/index.css.scss +4 -0
  52. data/app/assets/stylesheets/admin/pages/form.css.scss +209 -0
  53. data/app/assets/stylesheets/admin/pages/htmlArea.css.scss +13 -0
  54. data/app/assets/stylesheets/cartoset.css.scss +25 -0
  55. data/app/assets/stylesheets/features/index.css.scss +6 -0
  56. data/app/assets/stylesheets/jscrollpane.css.scss +120 -0
  57. data/app/assets/stylesheets/reset.css +44 -0
  58. data/app/assets/stylesheets/sessions/_sessions.colors.scss +9 -0
  59. data/app/assets/stylesheets/sessions/new.css.scss +94 -0
  60. data/app/assets/stylesheets/setup/_setup.colors.scss +32 -0
  61. data/app/assets/stylesheets/setup/_setup.vars.scss +0 -0
  62. data/app/assets/stylesheets/setup/index.css.scss +138 -0
  63. data/app/assets/stylesheets/setup/step0.css.scss +21 -0
  64. data/app/assets/stylesheets/setup/step1.css.scss +57 -0
  65. data/app/assets/stylesheets/setup/step2.css.scss +39 -0
  66. data/app/assets/stylesheets/setup/step3.css.scss +199 -0
  67. data/app/assets/stylesheets/setup/step4.css.scss +48 -0
  68. data/app/controllers/admin/admin_controller.rb +16 -0
  69. data/app/controllers/admin/dashboard_controller.rb +38 -0
  70. data/app/controllers/admin/features_controller.rb +39 -0
  71. data/app/controllers/admin/pages_controller.rb +46 -0
  72. data/app/controllers/admin/settings_controller.rb +14 -0
  73. data/app/controllers/features_controller.rb +16 -0
  74. data/app/controllers/home_controller.rb +7 -0
  75. data/app/controllers/prototypes_controller.rb +3 -0
  76. data/app/controllers/sessions_controller.rb +32 -0
  77. data/app/controllers/setup_controller.rb +72 -0
  78. data/app/helpers/admin/admin_helper.rb +25 -0
  79. data/app/helpers/application_helper.rb +22 -0
  80. data/app/helpers/features_helper.rb +2 -0
  81. data/app/models/feature.rb +7 -0
  82. data/app/views/admin/dashboard/index.html.erb +113 -0
  83. data/app/views/admin/features/new.html.erb +26 -0
  84. data/app/views/admin/features/show.html.erb +30 -0
  85. data/app/views/admin/pages/_form.html.erb +28 -0
  86. data/app/views/admin/pages/edit.html.erb +9 -0
  87. data/app/views/admin/pages/new.html.erb +15 -0
  88. data/app/views/admin/pages/show.html.erb +38 -0
  89. data/app/views/admin/shared/_footer.html.erb +3 -0
  90. data/app/views/admin/shared/_header.html.erb +13 -0
  91. data/app/views/features/index.html.erb +20 -0
  92. data/app/views/features/show.html.erb +8 -0
  93. data/app/views/home/index.html.erb +6 -0
  94. data/app/views/layouts/admin.html.erb +17 -0
  95. data/app/views/layouts/application.html.erb +25 -0
  96. data/app/views/layouts/setup.html.erb +16 -0
  97. data/app/views/prototypes/prueba.html.erb +33 -0
  98. data/app/views/sessions/_help.html.erb +1 -0
  99. data/app/views/sessions/new.html.erb +10 -0
  100. data/app/views/setup/_help.html.erb +1 -0
  101. data/app/views/setup/_step_indicator.erb +14 -0
  102. data/app/views/setup/features_table_data.html.erb +22 -0
  103. data/app/views/setup/step0.html.erb +10 -0
  104. data/app/views/setup/step1.html.erb +36 -0
  105. data/app/views/setup/step2.html.erb +19 -0
  106. data/app/views/setup/step3.html.erb +43 -0
  107. data/app/views/setup/step4.html.erb +31 -0
  108. data/cartoset.gemspec +26 -0
  109. data/config/cartoset_config.yml.sample +9 -0
  110. data/config/initializers/cartoset_config.rb +7 -0
  111. data/config/initializers/extra_cartoset_libs.rb +1 -0
  112. data/config/initializers/float.rb +13 -0
  113. data/config/initializers/string.rb +102 -0
  114. data/config/locales/en.cartoset.yml +132 -0
  115. data/config/routes.rb +28 -0
  116. data/lib/application_controller.rb +63 -0
  117. data/lib/cartoset.rb +9 -0
  118. data/lib/cartoset/auth/omniauth_cartodb_authentication.rb +42 -0
  119. data/lib/cartoset/auth/warden_strategies.rb +20 -0
  120. data/lib/cartoset/config.rb +104 -0
  121. data/lib/cartoset/constants.rb +5 -0
  122. data/lib/cartoset/features_data_importer.rb +20 -0
  123. data/lib/cartoset/version.rb +3 -0
  124. data/lib/engine.rb +36 -0
  125. data/lib/helpers/feature_getter_helper.rb +8 -0
  126. data/lib/tasks/.gitkeep +0 -0
  127. data/lib/tasks/cartoset.rake +72 -0
  128. data/public/404.html +26 -0
  129. data/public/422.html +26 -0
  130. data/public/500.html +26 -0
  131. data/public/favicon.ico +0 -0
  132. data/public/new_pages.html +60 -0
  133. data/public/robots.txt +5 -0
  134. data/spec/acceptance/acceptance_helper.rb +38 -0
  135. data/spec/acceptance/admin/dashboard_spec.rb +43 -0
  136. data/spec/acceptance/manage_sessions_spec.rb +16 -0
  137. data/spec/acceptance/setup_spec.rb +74 -0
  138. data/spec/acceptance/support/helpers.rb +11 -0
  139. data/spec/acceptance/support/paths.rb +13 -0
  140. data/spec/controllers/features_controller_spec.rb +5 -0
  141. data/spec/controllers/prototypes_controller_spec.rb +5 -0
  142. data/spec/controllers/sessions_controller_spec.rb +5 -0
  143. data/spec/helpers/prototypes_helper_spec.rb +15 -0
  144. data/spec/helpers/sessions_helper_spec.rb +15 -0
  145. data/spec/lib/cartoset/config_spec.rb +24 -0
  146. data/spec/models/feature_spec.rb +5 -0
  147. data/spec/spec_helper.rb +27 -0
  148. data/spec/support/factories.rb +10 -0
  149. data/spec/support/factories/features.rb +32 -0
  150. data/spec/support/string_extension.rb +13 -0
  151. metadata +316 -0
@@ -0,0 +1,5 @@
1
+ module Cartoset
2
+ module Constants
3
+ COMMON_FEATURES_FIELDS = %w(cartodb_id the_geom created_at updated_at )
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ class Cartoset::FeaturesDataImporter
2
+
3
+ DATA_FILE_PATH = Rails.root.join('tmp/features_data.csv').freeze
4
+
5
+ def self.start(data_stream)
6
+ table = {}
7
+ File.open(DATA_FILE_PATH, 'w+') do |file|
8
+ file.write(data_stream.read.force_encoding("UTF-8"))
9
+
10
+ @tables = CartoDB::Connection.tables || nil
11
+ CartoDB::Connection.drop_table('cartoset_features') if @tables && @tables.tables && @tables.tables.map{|t| t.name}.include?('cartoset_features')
12
+
13
+ require 'ruby-debug'; debugger
14
+ table = CartoDB::Connection.create_table 'cartoset_features', file
15
+ table = CartoDB::Connection.table table.name
16
+ end
17
+
18
+ table
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module Cartoset
2
+ VERSION = "0.0.1"
3
+ end
data/lib/engine.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'cartoset'
2
+ require 'rails'
3
+ require 'warden'
4
+ require 'rails_warden'
5
+
6
+ require 'cartoset/auth/omniauth_cartodb_authentication'
7
+ require 'cartoset/auth/warden_strategies'
8
+
9
+
10
+ module Cartoset
11
+ class Engine < Rails::Engine
12
+
13
+ initializer "static assets" do |app|
14
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
15
+ end
16
+
17
+ initializer "cartoset.add_middleware" do
18
+
19
+ config.app_middleware.use RailsWarden::Manager do |manager|
20
+ manager.default_strategies :cartodb_oauth
21
+ manager.failure_app = SessionsController if defined?(SessionsController)
22
+ end
23
+
24
+ host = oauth_key = oauth_secret = nil
25
+ if CartoDB.const_defined?('Settings')
26
+ host = CartoDB::Settings['host']
27
+ oauth_key = CartoDB::Settings['oauth_key']
28
+ oauth_secret = CartoDB::Settings['oauth_secret']
29
+ end
30
+ config.app_middleware.use OmniAuth::Strategies::Cartodb, host, oauth_key, oauth_secret
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+
@@ -0,0 +1,8 @@
1
+ module FeatureGetterHelper
2
+
3
+ def get_feature
4
+ @feature = CartoDB::Connection.row Cartoset::Config['features_table'], params[:id]
5
+ end
6
+ private :get_feature
7
+
8
+ end
File without changes
@@ -0,0 +1,72 @@
1
+
2
+ namespace :cartoset do
3
+ desc "Creates the cartodb schema"
4
+ task :create_schema => :environment do
5
+ errors = []
6
+
7
+ puts ''
8
+ puts 'Creating table features...'
9
+
10
+ begin
11
+ CartoDB::Connection.create_table 'features'
12
+ puts '... done!'
13
+ rescue CartoDB::CartoError => e
14
+ errors << e
15
+ end
16
+
17
+ print_errors(errors)
18
+ end
19
+
20
+ desc "Drops the cartodb schema"
21
+ task :drop_schema => :environment do
22
+ errors = []
23
+
24
+ puts ''
25
+ puts 'Droping table features...'
26
+
27
+ begin
28
+ table = CartoDB::Connection.table 'features'
29
+ CartoDB::Connection.drop_table table.id
30
+
31
+ puts '... done!'
32
+ rescue CartoDB::CartoError => e
33
+ errors << e
34
+ end
35
+
36
+ print_errors(errors)
37
+ end
38
+
39
+ desc "Creates random test data"
40
+ task :test_data => :environment do
41
+ CartoDB::Connection.table 'features'
42
+
43
+ 25.times do
44
+ CartoDB::Connection.insert_row 'features', {
45
+ 'name' => String.random(30),
46
+ 'description' => String.random(200),
47
+ 'latitude' => Float.random_latitude,
48
+ 'longitude' => Float.random_longitude
49
+ }
50
+ end
51
+ end
52
+
53
+ namespace :heroku do
54
+ task :config => :environment do
55
+ puts "Reading config/cartoset_config.yml and sending config vars to Heroku..."
56
+
57
+ [:staging, :production].each do |env|
58
+ system Cartoset::Config.settings.inject('heroku config:add'){|command, key_value| command << " #{key_value[0]}=#{key_value[1]}"} << " --remote #{env}"
59
+ end
60
+ end
61
+ end
62
+
63
+ def print_errors(errors)
64
+ unless errors.empty?
65
+ puts ''
66
+ puts 'Errors creating table features:'
67
+ errors.each do |error|
68
+ puts "- #{error}"
69
+ end
70
+ end
71
+ end
72
+ end
data/public/404.html ADDED
@@ -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>
data/public/422.html ADDED
@@ -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>
data/public/500.html ADDED
@@ -0,0 +1,26 @@
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
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Cartoset - Administration Panel</title>
5
+ <link href="/stylesheets/reset.css" media="screen" rel="stylesheet" type="text/css" />
6
+ <link href="/stylesheets/admin.css" media="screen" rel="stylesheet" type="text/css" />
7
+ <link href="/stylesheets/sass/admin/pages/new.scss" media="screen" rel="stylesheet" type="text/css" />
8
+ <link href="/stylesheets/admin/pages/new.css" media="screen" rel="stylesheet" type="text/css" />
9
+
10
+
11
+ <meta name="csrf-param" content="authenticity_token"/>
12
+ <meta name="csrf-token" content="ZexiE4WdZ0RHZ28pvI0jdpIAaIcXe64/3lVjySNg13U="/>
13
+ </head>
14
+ <body>
15
+ <header>
16
+ <div id="header_content">
17
+ <h1 id="logo">CartoSet</h1>
18
+ <nav>
19
+ <ul>
20
+ <li><a href="#" id="features_menu_link">Features</a></li>
21
+ <li><a href="#" id="pages_menu_link">Pages</a></li>
22
+ <li><a href="#" class="close_session">Close session</a></li>
23
+ </ul>
24
+ </nav>
25
+ </div>
26
+ </header>
27
+
28
+
29
+ <div id="main_content">
30
+ <div class="content_box table">
31
+ <h1>New Page</h1>
32
+
33
+ <label class="field_label" for="title">name<strong>*</strong></label>
34
+ <input class="string" id="name" name="name" type="text" value="About Methane Gas Hydrates" />
35
+
36
+ <label class="field_label" for="body">body<strong>*</strong></label>
37
+ <textarea id="txtDefaultHtmlArea"></textarea>
38
+
39
+ <label class="field_label permalink" for="permalink">permalink</label>
40
+ <input class="string" id="name" name="permalink" type="text" value="" />
41
+
42
+ <a href="/admin/dashboard" class="main_action">Save new page</a>
43
+
44
+ <div class="side_bar">
45
+ <a href="/admin/dashboard" class="back"><span></span>Back to dashboard</a>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+
51
+ <footer>
52
+ <div id="footer_content">POWERED BY <a href="">CARTOSET</a></div>
53
+ </footer>
54
+
55
+ <script src="/javascripts/jquery.min.js" type="text/javascript"></script>
56
+ <script src="/javascripts/jHtmlArea-0.7.0.min.js" type="text/javascript"></script>
57
+ <script src="/javascripts/admin/pages/new.js"></script>
58
+
59
+ </body>
60
+ </html>
data/public/robots.txt ADDED
@@ -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,38 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require "steak"
3
+ require "capybara/rails"
4
+ require "capybara/dsl"
5
+ require "selenium-webdriver"
6
+
7
+ # Put your acceptance spec helpers inside /spec/acceptance/support
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ Capybara.default_wait_time = 10
11
+ Capybara.server_port = 3333
12
+
13
+ RSpec.configure do |config|
14
+
15
+ config.include Warden::Test::Helpers
16
+ config.include Capybara, :type => :acceptance
17
+
18
+ config.before(:each) do
19
+ Rails.cache.clear
20
+ end
21
+
22
+ config.before(:each, :js => true) do
23
+ Capybara.current_driver = :selenium
24
+ end
25
+
26
+ config.after(:each, :type => :acceptance) do
27
+ case page.driver.class
28
+ when Capybara::Driver::RackTest
29
+ page.driver.rack_mock_session.clear_cookies
30
+ when Capybara::Driver::Culerity
31
+ page.driver.browser.clear_cookies
32
+ when Capybara::Driver::Selenium
33
+ page.driver.cleanup!
34
+ end
35
+ Capybara.use_default_driver
36
+ end
37
+
38
+ end
@@ -0,0 +1,43 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../acceptance_helper')
2
+
3
+ feature "Dashboard" do
4
+
5
+ scenario "main view" do
6
+ create_random_features
7
+
8
+ visit admin_dashboard
9
+
10
+ within('#features_list') do
11
+ page.should have_content('Your features')
12
+ within('#search') do
13
+ page.should have_css('label')
14
+ page.should have_css('input[type=text]')
15
+ page.should have_css('input[type=submit]')
16
+ end
17
+
18
+ page.should have_link('scroll_left')
19
+ page.should have_link('scroll_right')
20
+
21
+ within('.list') do
22
+ within('.header') do
23
+ page.should have_content('id.')
24
+ page.should have_content('name')
25
+ page.should have_content('description')
26
+ page.should have_content('latitude')
27
+ page.should have_content('longitude')
28
+ end
29
+
30
+ page.should have_css('tr.item', :count => 10)
31
+ page.should have_css('tr.item td.cartodb_id a', :text => '1')
32
+ page.should have_css('tr.item td.name', :text => 'Feature 0')
33
+ page.should have_css('tr.item td.description', :text => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')
34
+ page.should have_css('tr.item td.latitude', :text => '-16.506')
35
+ page.should have_css('tr.item td.longitude', :text => '-151.7531')
36
+ end
37
+
38
+ page.should have_link('Create new feature')
39
+ page.should have_link('or edit them in CartoDB')
40
+ page.should have_css('.pagination', :text => '1 2 3')
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
2
+
3
+ feature "Manage Sessions", %q{
4
+ In order to access to the wonderful features of Cartoset
5
+ As a user
6
+ I want to identify myself in the application
7
+ } do
8
+
9
+ scenario "Get authenticated" do
10
+ login_as({'uid' => 1, 'username' => 'admin', 'email' => 'admin@example.com'})
11
+
12
+ visit homepage
13
+
14
+ page.should have_content("Hi admin!")
15
+ end
16
+ end
@@ -0,0 +1,74 @@
1
+ # coding: UTF-8
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
4
+
5
+ feature 'cartoset setup', %q{
6
+ In order to create an awesome geo-powered app
7
+ as an astonishing developer
8
+ I want to setup my cartoset app
9
+ } do
10
+
11
+ scenario 'initial setup', :js => true do
12
+ visit homepage
13
+
14
+ current_path.should be == '/setup'
15
+
16
+ page.should have_content 'Congratulations!'
17
+ page.should have_content "CartosSet has been succesfully installed. It's time to adapt it to your needs."
18
+
19
+ click 'Start configuration'
20
+
21
+ current_path.should be == '/setup/steps/1'
22
+ page.should have_content 'Connect your app with CartoDB'
23
+ page.should have_content 'CartoSet stores its data in CartoDB, a powerful cloud-based database for geolocated data.'
24
+ page.should have_content 'To continue, introduce your OAUTH key and secrets from your account in CartoDB:'
25
+
26
+ fill_in 'Oauth key', :with => 'W3Ls49Adgv3g23MalqZbWpEUuMXrQI7nO8EwR8wm'
27
+ fill_in 'Oauth secret', :with => 'cKZFeKhRRA5SgSsyTqWHXgwH6rIadqQprAO6eW5P'
28
+
29
+ click 'Connect'
30
+
31
+ current_path.should be == "/setup/steps/2"
32
+ page.should have_content 'Name your app'
33
+ page.should have_content "Don't be afraid. You will be able to change it later."
34
+ fill_in "'Pandas in the world', 'Elvis sightings'...", :with => 'whs'
35
+
36
+ click 'Save and continue'
37
+
38
+ current_path.should be == "/setup/steps/3"
39
+
40
+ page.should have_content 'Import your data'
41
+ page.should have_content "Select which CartoDB table you want to use for this CartoSet. If you don't have tables created you will be able to create a new one."
42
+
43
+ click 'Select table'
44
+ click 'madrid_bars'
45
+
46
+ page.should have_css('table.data tr th', :text => 'cartodb_id')
47
+ page.should have_css('table.data tr th', :text => 'name')
48
+ page.should have_css('table.data tr th', :text => 'address')
49
+
50
+ page.should have_content 'Hawai'
51
+ page.should have_content 'El Estocolmo'
52
+ page.should have_content 'El Rey del Tallarín'
53
+
54
+ click 'Use this table'
55
+
56
+ current_path.should be == "/setup/steps/4"
57
+
58
+ page.should have_content 'Done!'
59
+ page.should have_content 'It looks like you have your CartoSet running in your server. Now...'
60
+
61
+ page.should have_content 'Manage your data'
62
+ page.should have_content 'Change and clean your data, geolocalize your features...'
63
+ page.should have_link 'CartoDB table'
64
+
65
+ page.should have_content 'Manage your site'
66
+ page.should have_content 'Add images and videos, create additional pages...'
67
+ page.should have_link 'CartoSet backoffice'
68
+
69
+ page.should have_content 'Go to your site'
70
+ page.should have_content 'Check how your users will see your site...'
71
+ page.should have_link 'Public site'
72
+
73
+ end
74
+ end