Update dependencies, feature specs and sitemap

This commit is contained in:
2015-07-14 14:11:33 +02:00
parent 17bd340071
commit 42cc5afe6d
14 changed files with 123 additions and 112 deletions
-4
View File
@@ -1,4 +0,0 @@
require 'spec_helper'
# Put your acceptance spec helpers inside spec/acceptance/support
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
-9
View File
@@ -1,9 +0,0 @@
module NavigationHelpers
# Put helper methods related to the paths in your application here.
def homepage
"/"
end
end
RSpec.configuration.include NavigationHelpers, :type => :acceptance
+1 -1
View File
@@ -9,7 +9,7 @@ Dummy::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS
config.assets.compress = true
+1 -1
View File
@@ -8,7 +8,7 @@ Dummy::Application.configure do
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
+1 -1
View File
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
devise_for :users, :controllers => {:sessions => 'cmtool/sessions', :passwords => 'cmtool/passwords'}
mount Cmtool::Engine => "/cmtool"
get '/sitemap(.:format)' => 'test_pages#sitemap'
get '/sitemap(.:format)' => 'pages#sitemap'
get "/:name" => "pages#show"
scope '(/:locale)', constraints: {locale: /nl|be|de|fr|en/}, defaults: { locale: :nl } do
get "/:name" => "pages#show", constraints: {name: /.*/}, as: :page
@@ -1,11 +1,6 @@
require 'acceptance/acceptance_helper'
feature 'Pages index', %q{
In order have pages
As a user
I want to see pages
} do
require 'spec_helper'
feature 'Pages index' do
scenario 'visit root' do
visit '/cmtool'
page.current_path.should == '/users/sign_in'
+12
View File
@@ -0,0 +1,12 @@
require 'spec_helper'
feature 'sitemap.xml' do
scenario 'proper sitemap' do
p1 = Page.create name: 'nl-1', title: 'NL 1', locale: 'nl'
p1 = Page.create name: 'en-1', title: 'EN 1', locale: 'en'
visit "/sitemap.xml"
page.body.should include "<lastmod>#{Date.today.strftime('%Y-%m-%d')}</lastmod>"
page.body.should include "<loc>/en/en-1</loc>"
page.body.should include "<loc>/nl-1</loc>"
end
end
+3 -1
View File
@@ -3,7 +3,6 @@ ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl'
require 'capybara/rspec'
@@ -23,10 +22,13 @@ RSpec.configure do |config|
#config.include CompanyFactory
config.include Cmtool::Engine.routes.url_helpers
config.include Devise::TestHelpers, type: :controller
config.include FeatureHelpers, type: :feature
#config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = true
config.render_views = true
config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
config.before :each do
CouchPotato.couchrest_database.recreate!
@user = User.first || create(:user)
@@ -1,4 +1,4 @@
module HelperMethods
module FeatureHelpers
# Put helper methods you need to be available in all acceptance specs here.
def create_user(email, password='secret')
@user = User.find_by_email(email) || FactoryGirl.create(:user, email: email, password: password)
@@ -14,6 +14,8 @@ module HelperMethods
def submit_form
find("[type=submit]").click
end
end
RSpec.configuration.include HelperMethods, :type => :acceptance
def homepage
"/"
end
end