running rake rspec did not work

did committed Mar 31, 2013
commit e607a3f0690c0e2d47217fd38aab77086892ce8b
Showing 10 changed files with 93 additions and 77 deletions
.rspec +2 -0
@@ @@ -0,0 +1,2 @@
+ --colour
+ --backtrace
LICENSE.txt +1 -1
@@ @@ -1,4 +1,4 @@
- Copyright (c) 2012 Rodrigo Alvarez
+ Copyright (c) 2012 Didier Lafforgue
MIT License
Rakefile +19 -7
@@ @@ -21,26 +21,38 @@ Gem::PackageTask.new(gemspec) do |pkg|
end
desc 'build the gem and release it to rubygems.org'
- task :release => :gem do
- sh "gem push pkg/locomotivecms_wagon-#{gemspec.version}.gem"
+ task release: :gem do
+ sh 'gem push pkg/locomotivecms_wagon-#{gemspec.version}.gem'
end
namespace :development do
+ desc 'create vcr cassettes'
task :bootstrap do
VCR.configure do |c|
c.cassette_library_dir = File.expand_path(File.dirname(__FILE__) + '/spec/integration/cassettes')
c.hook_into :webmock # or :fakeweb
c.allow_http_connections_when_no_cassette = true
- # c.ignore_request do |request|
- # URI(request.uri).path =~ /translations/
- # end
end
FileUtils.rm_rf(File.join(File.dirname(__FILE__), 'site'))
VCR.use_cassette('pull') do
- exit unless Locomotive::Wagon.clone("site", {"host" => "http://locomotive.engine.dev:3000"}, "email" => "admin@locomotivecms.com", "password" => "locomotive")
+ exit unless Locomotive::Wagon.clone('site', {'host' => 'http://locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive')
end
- Locomotive::Wagon.push("site", {"host" => "http://locomotive.engine.dev:3000"}, "email" => "admin@locomotivecms.com", "password" => "locomotive", "force" => true, "data" => true)
+ Locomotive::Wagon.push('site', {'host' => 'http://locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive', 'force' => true, 'data' => true)
end
end
+
+
+ RSpec::Core::RakeTask.new('spec:unit') do |spec|
+ spec.pattern = 'spec/unit/**/*_spec.rb'
+
+ end
+
+ RSpec::Core::RakeTask.new('spec:integration') do |spec|
+ spec.pattern = 'spec/integration/**/*_spec.rb'
+ end
+
+ task spec: ['spec:integration']
+
+ task default: :spec
\ No newline at end of file
locomotivecms_wagon.gemspec +2 -2
@@ @@ -36,8 +36,8 @@ Gem::Specification.new do |gem|
gem.add_dependency 'faker', '~> 0.9.5'
- gem.add_development_dependency 'rake', '0.9.2'
- gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'rake', '~> 10.0.4'
+ gem.add_development_dependency 'rspec', '~> 2.6.0'
gem.add_development_dependency 'vcr'
gem.add_development_dependency 'webmock', '~> 1.8.0'
gem.add_development_dependency 'rack-test'
spec/integration/cassettes/pull.yml +14 -14
@@ @@ -40,7 +40,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"token":"jKkxPorzWo8uNYUxiiQC"}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -80,7 +80,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"id":"51010fd2c82cd17179000001","_id":"51010fd2c82cd17179000001","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T11:43:08+01:00","name":"locomotive","locales":["en","es"],"subdomain":"locomotive","domains":["locomotive.engine.dev"],"domains_without_subdomain":[],"domain_name":"engine.dev","memberships":[{"id":"51010fd2c82cd17179000005","_id":"51010fd2c82cd17179000005","role":"admin","role_name":"Administrator","can_update":false,"grant_admin":true,"account_id":"51010fd2c82cd17179000004","name":"Admin","email":"admin@locomotivecms.com"}]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -120,7 +120,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"id":"51010fd2c82cd17179000001","_id":"51010fd2c82cd17179000001","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T11:43:08+01:00","name":"locomotive","locales":["en","es"],"subdomain":"locomotive","domains":["locomotive.engine.dev"],"domains_without_subdomain":[],"domain_name":"engine.dev","memberships":[{"id":"51010fd2c82cd17179000005","_id":"51010fd2c82cd17179000005","role":"admin","role_name":"Administrador","can_update":false,"grant_admin":true,"account_id":"51010fd2c82cd17179000004","name":"Admin","email":"admin@locomotivecms.com"}]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -160,7 +160,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '[]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -200,7 +200,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '[]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -241,7 +241,7 @@ http_interactions:
encoding: US-ASCII
string: ! '[{"id":"5101101bc82cd12530000013","_id":"5101101bc82cd12530000013","created_at":"2013-01-24T11:42:35+01:00","updated_at":"2013-01-24T11:42:35+01:00","name":"Products","slug":"products","entries_custom_fields":[{"id":"5101101bc82cd12530000014","_id":"5101101bc82cd12530000014","name":"name","label":"name","type":"string","required":true,"localized":true,"position":0},{"id":"5101101bc82cd12530000015","_id":"5101101bc82cd12530000015","name":"available","label":"available","type":"boolean","required":false,"localized":false,"position":1}],"description":"My
products collection","label_field_name":"name","order_by":"created_at","order_direction":"asc","order_by_field_name":"created_at","public_submission_enabled":false,"public_submission_account_emails":[]}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -283,7 +283,7 @@ http_interactions:
string: ! '[{"id":"5101101bc82cd12530000016","_id":"5101101bc82cd12530000016","created_at":"2013-01-24T11:42:35+01:00","updated_at":"2013-01-24T11:43:08+01:00","_label":"Useless
stuff","_slug":"useless-stuff","_position":0,"content_type_slug":"products","translated_in":["en"],"name":"Useless
stuff","available":true}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:23 GMT
- request:
method: get
@@ @@ -325,7 +325,7 @@ http_interactions:
string: ! '{"id":"5101101bc82cd12530000016","_id":"5101101bc82cd12530000016","created_at":"2013-01-24T11:42:35+01:00","updated_at":"2013-01-24T11:43:08+01:00","_label":"Useless
stuff","_slug":"useless-stuff","_position":0,"content_type_slug":"products","translated_in":["en"],"name":"Useless
stuff","available":true}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: get
@@ @@ -377,7 +377,7 @@ http_interactions:
not found","slug":"404","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"404","localized_fullpaths":{"en":"404","es":"es/404"},"depth":0,"translated_in":["en","es"],"raw_template":"Content
of the 404 page","escaped_raw_template":"Content of the 404 page","editable_elements":[]},{"id":"5101101cc82cd12530000018","_id":"5101101cc82cd12530000018","created_at":"2013-01-24T11:42:36+01:00","updated_at":"2013-01-24T11:43:08+01:00","title":"Products","slug":"products","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"products","localized_fullpaths":{"en":"products","es":"es/products"},"depth":1,"translated_in":["en"],"raw_template":"{%
extends parent %}","escaped_raw_template":"{% extends parent %}","editable_elements":[]}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: get
@@ @@ -420,7 +420,7 @@ http_interactions:
de inicio","slug":"index","position":0,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"index","localized_fullpaths":{"en":"","es":"es"},"depth":0,"translated_in":["en","es"],"raw_template":"New
content of the home page\r\n","escaped_raw_template":"New content of the home
page\r\n","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: get
@@ @@ -462,7 +462,7 @@ http_interactions:
string: ! '{"id":"51010fd2c82cd17179000003","_id":"51010fd2c82cd17179000003","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T11:43:08+01:00","title":"P\u00e1gina
no encontrada","slug":"404","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"404","localized_fullpaths":{"en":"404","es":"es/404"},"depth":0,"translated_in":["en","es"],"raw_template":"Content
of the 404 page","escaped_raw_template":"Content of the 404 page","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: get
@@ @@ -502,7 +502,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '[]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: get
@@ @@ -543,7 +543,7 @@ http_interactions:
encoding: US-ASCII
string: ! '[{"id":"51011077c82cd1253000001d","_id":"51011077c82cd1253000001d","created_at":"2013-01-24T11:44:07+01:00","updated_at":"2013-01-24T11:44:07+01:00","key":"hello_world","values":{"en":"Hello
world!","es":"\u00a1Hola, Mundo!"}}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:24 GMT
- request:
method: post
@@ @@ -585,6 +585,6 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"token":"jKkxPorzWo8uNYUxiiQC"}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 10:44:51 GMT
recorded_with: VCR 2.3.0
spec/integration/cassettes/push.yml +18 -18
@@ @@ -40,7 +40,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"token":"jKkxPorzWo8uNYUxiiQC"}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: get
@@ @@ -80,7 +80,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"id":"51010fd2c82cd17179000001","_id":"51010fd2c82cd17179000001","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T12:09:43+01:00","name":"locomotive","locales":["en","es"],"subdomain":"locomotive","domains":["locomotive.engine.dev"],"domains_without_subdomain":[],"domain_name":"engine.dev","memberships":[{"id":"51010fd2c82cd17179000005","_id":"51010fd2c82cd17179000005","role":"admin","role_name":"Administrator","can_update":false,"grant_admin":true,"account_id":"51010fd2c82cd17179000004","name":"Admin","email":"admin@locomotivecms.com"}]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -126,7 +126,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"id":"51010fd2c82cd17179000001","_id":"51010fd2c82cd17179000001","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T12:09:53+01:00","name":"locomotive","locales":["en","es"],"subdomain":"locomotive","domains":["locomotive.engine.dev"],"domains_without_subdomain":[],"domain_name":"engine.dev","memberships":[{"id":"51010fd2c82cd17179000005","_id":"51010fd2c82cd17179000005","role":"admin","role_name":"Administrator","can_update":false,"grant_admin":true,"account_id":"51010fd2c82cd17179000004","name":"Admin","email":"admin@locomotivecms.com"}]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -172,7 +172,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"id":"51010fd2c82cd17179000001","_id":"51010fd2c82cd17179000001","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T12:09:53+01:00","name":"locomotive","locales":["en","es"],"subdomain":"locomotive","domains":["locomotive.engine.dev"],"domains_without_subdomain":[],"domain_name":"engine.dev","memberships":[{"id":"51010fd2c82cd17179000005","_id":"51010fd2c82cd17179000005","role":"admin","role_name":"Administrator","can_update":false,"grant_admin":true,"account_id":"51010fd2c82cd17179000004","name":"Admin","email":"admin@locomotivecms.com"}]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: get
@@ @@ -212,7 +212,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '[]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: get
@@ @@ -253,7 +253,7 @@ http_interactions:
encoding: US-ASCII
string: ! '[{"id":"5101101bc82cd12530000013","_id":"5101101bc82cd12530000013","created_at":"2013-01-24T11:42:35+01:00","updated_at":"2013-01-24T11:42:35+01:00","name":"Products","slug":"products","entries_custom_fields":[{"id":"5101101bc82cd12530000014","_id":"5101101bc82cd12530000014","name":"name","label":"name","type":"string","required":true,"localized":true,"position":0},{"id":"5101101bc82cd12530000015","_id":"5101101bc82cd12530000015","name":"available","label":"available","type":"boolean","required":false,"localized":false,"position":1}],"description":"My
products collection","label_field_name":"name","order_by":"created_at","order_direction":"asc","order_by_field_name":"created_at","public_submission_enabled":false,"public_submission_account_emails":[]}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -300,7 +300,7 @@ http_interactions:
encoding: US-ASCII
string: ! '{"id":"5101101bc82cd12530000013","_id":"5101101bc82cd12530000013","created_at":"2013-01-24T11:42:35+01:00","updated_at":"2013-01-24T11:42:35+01:00","name":"Products","slug":"products","entries_custom_fields":[{"id":"5101101bc82cd12530000014","_id":"5101101bc82cd12530000014","name":"name","label":"name","type":"string","required":true,"localized":true,"position":0},{"id":"5101101bc82cd12530000015","_id":"5101101bc82cd12530000015","name":"available","label":"available","type":"boolean","required":false,"localized":false,"position":1}],"description":"My
products collection","label_field_name":"name","order_by":"created_at","order_direction":"asc","order_by_field_name":"created_at","public_submission_enabled":false,"public_submission_account_emails":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: get
@@ @@ -352,7 +352,7 @@ http_interactions:
not found","slug":"404","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"404","localized_fullpaths":{"en":"404","es":"es/404"},"depth":0,"translated_in":["en","es"],"raw_template":"Content
of the 404 page","escaped_raw_template":"Content of the 404 page","editable_elements":[]},{"id":"5101101cc82cd12530000018","_id":"5101101cc82cd12530000018","created_at":"2013-01-24T11:42:36+01:00","updated_at":"2013-01-24T12:09:43+01:00","title":"Products","slug":"products","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"products","localized_fullpaths":{"en":"products","es":"es/products"},"depth":1,"translated_in":["en"],"raw_template":"{%
extends parent %}","escaped_raw_template":"{% extends parent %}","editable_elements":[]}]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -400,7 +400,7 @@ http_interactions:
string: ! '{"id":"51010fd2c82cd17179000003","_id":"51010fd2c82cd17179000003","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T12:09:53+01:00","title":"Page
not found","slug":"404","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"404","localized_fullpaths":{"en":"404","es":"es/404"},"depth":0,"translated_in":["en","es"],"raw_template":"Content
of the 404 page","escaped_raw_template":"Content of the 404 page","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -449,7 +449,7 @@ http_interactions:
page","slug":"index","position":0,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"index","localized_fullpaths":{"en":"","es":"es"},"depth":0,"template_changed":true,"translated_in":["en","es"],"raw_template":"{%
block content %}\r\n New content of the home page\r\n{% endblock %}\r\n\r\n","escaped_raw_template":"{%
block content %}\r\n New content of the home page\r\n{% endblock %}\r\n\r\n","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -497,7 +497,7 @@ http_interactions:
string: ! '{"id":"5101101cc82cd12530000017","_id":"5101101cc82cd12530000017","created_at":"2013-01-24T11:42:36+01:00","updated_at":"2013-01-24T12:09:53+01:00","title":"translated","slug":"translated","position":0,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"translated","localized_fullpaths":{"en":"translated","es":"es/translated"},"depth":1,"translated_in":["en"],"raw_template":"{{
''hello_world'' | translate}}","escaped_raw_template":"{{ 'hello_world'
| translate}}","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -544,7 +544,7 @@ http_interactions:
encoding: US-ASCII
string: ! '{"id":"5101101cc82cd12530000018","_id":"5101101cc82cd12530000018","created_at":"2013-01-24T11:42:36+01:00","updated_at":"2013-01-24T12:09:53+01:00","title":"Products","slug":"products","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"products","localized_fullpaths":{"en":"products","es":"es/products"},"depth":1,"translated_in":["en"],"raw_template":"{%
extends parent %}","escaped_raw_template":"{% extends parent %}","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -594,7 +594,7 @@ http_interactions:
is: {{ contents.products.last.name }}\r\n{% endblock %}","escaped_raw_template":"{%
extends parent %}\r\n{% block content %}\r\n The name of the latest product
is: {{ contents.products.last.name }}\r\n{% endblock %}","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -638,7 +638,7 @@ http_interactions:
string: ! '{"id":"51010fd2c82cd17179000003","_id":"51010fd2c82cd17179000003","created_at":"2013-01-24T11:41:22+01:00","updated_at":"2013-01-24T12:09:53+01:00","title":"P\u00e1gina
no encontrada","slug":"404","position":1,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"404","localized_fullpaths":{"en":"404","es":"es/404"},"depth":0,"translated_in":["en","es"],"raw_template":"Content
of the 404 page","escaped_raw_template":"Content of the 404 page","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -683,7 +683,7 @@ http_interactions:
de inicio","slug":"index","position":0,"response_type":"text/html","cache_strategy":"none","redirect":false,"redirect_type":301,"listed":true,"published":true,"templatized":false,"templatized_from_parent":false,"fullpath":"index","localized_fullpaths":{"en":"","es":"es"},"depth":0,"translated_in":["en","es"],"raw_template":"New
content of the home page\r\n","escaped_raw_template":"New content of the home
page\r\n","editable_elements":[]}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: get
@@ @@ -723,7 +723,7 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '[]'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:53 GMT
- request:
method: put
@@ @@ -770,7 +770,7 @@ http_interactions:
encoding: US-ASCII
string: ! '{"id":"51011077c82cd1253000001d","_id":"51011077c82cd1253000001d","created_at":"2013-01-24T11:44:07+01:00","updated_at":"2013-01-24T11:44:07+01:00","key":"hello_world","values":{"en":"Hello
world!","es":"\u00a1Hola, Mundo!"}}'
- http_version:
+ http_version:
recorded_at: Thu, 24 Jan 2013 11:09:54 GMT
- request:
method: get
@@ @@ -805,6 +805,6 @@ http_interactions:
body:
encoding: US-ASCII
string: ! '{"error":"Invalid authentication token."}'
- http_version:
+ http_version:
recorded_at: Wed, 27 Feb 2013 11:39:27 GMT
recorded_with: VCR 2.3.0
spec/integration/integration_helper.rb +3 -4
@@ @@ -1,3 +1,5 @@
+ # encoding: utf-8
+
require File.dirname(__FILE__) + '/../spec_helper'
require 'vcr'
require 'webmock/rspec'
@@ @@ -8,8 +10,5 @@ VCR.configure do |c|
c.cassette_library_dir = File.dirname(__FILE__) + '/cassettes'
c.hook_into :webmock
c.default_cassette_options = { record: :new_episodes }
- end
-
- RSpec.configure do |c|
- c.extend VCR::RSpec::Macros
+ c.configure_rspec_metadata!
end
\ No newline at end of file
spec/integration/server_spec.rb +16 -15
@@ @@ -1,37 +1,38 @@
# encoding: utf-8
- require File.dirname(__FILE__) + "/integration_helper"
- require "locomotive/wagon/server"
- require "rack/test"
+
+ require File.dirname(__FILE__) + '/integration_helper'
+ require 'locomotive/wagon/server'
+ require 'rack/test'
describe Locomotive::Wagon::Server do
include Rack::Test::Methods
-
+
def app
clone_site
reader = Locomotive::Mounter::Reader::FileSystem.instance
- reader.run!(path: "site")
+ reader.run!(path: 'site')
Locomotive::Wagon::Server.new(reader)
end
-
- it "shows the index page" do
+
+ it 'shows the index page' do
get '/'
last_response.body.should =~ /Content of the home page/
end
-
- it "shows the 404 page" do
+
+ it 'shows the 404 page' do
get '/void'
last_response.body.should =~ /Content of the 404 page/
end
-
- it "shows content" do
+
+ it 'shows content' do
get '/products/latest'
last_response.body.should =~ /The name of the latest product is: Useless stuff/
end
-
- it "translates strings" do
+
+ it 'translates strings' do
get '/en/translated'
- last_response.body.should =~ /Hello world!/
+ last_response.body.force_encoding('utf-8').should =~ /Hello world!/
get '/es/translated'
- last_response.body.should =~ /¡Hola, Mundo!/
+ last_response.body.force_encoding('utf-8').should =~ /¡Hola, Mundo!/
end
end
\ No newline at end of file
spec/integration/sites_spec.rb +16 -14
@@ @@ -1,27 +1,29 @@
- require File.dirname(__FILE__) + "/integration_helper"
+ # encoding: utf-8
+
+ require File.dirname(__FILE__) + '/integration_helper'
describe Locomotive::Wagon do
- it "imports" do
- File.exists?("site/config/site.yml").should be_false
+
+ it 'imports' do
+ File.exists?('site/config/site.yml').should be_false
clone_site
- YAML.load_file("site/config/site.yml").should == {
- "name"=>"locomotive",
- "locales"=>["en", "es"],
- "subdomain"=>"locomotive",
- "domains"=>["locomotive.engine.dev"]
+ YAML.load_file('site/config/site.yml').should == {
+ 'name' =>'locomotive',
+ 'locales' =>['en', 'es'],
+ 'subdomain' =>'locomotive',
+ 'domains' =>['locomotive.engine.dev']
}
end
-
- it "pushes" do
+
+ it 'pushes' do
clone_site
file_name = File.dirname(__FILE__) + '/../../site/app/views/pages/index.liquid'
text = File.read(file_name)
- text.gsub!(/Content of the home page/, "New content of the home page")
- File.open(file_name, "w") { |file| file.puts text}
+ text.gsub!(/Content of the home page/, 'New content of the home page')
+ File.open(file_name, 'w') { |file| file.puts text}
VCR.use_cassette('push') do
- Locomotive::Wagon.push("site", {"host" => "locomotive.engine.dev:3000"}, "email" => "admin@locomotivecms.com", "password" => "locomotive")
+ Locomotive::Wagon.push('site', {'host' => 'locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive')
end
-
WebMock.should have_requested(:put, /pages\/.+.json\?auth_token=.+/).with(:body => /page\[raw_template\]=New%20content%20of%20the%20home%20page/).once
end
end
\ No newline at end of file
spec/support/helpers.rb +2 -2
@@ @@ -3,10 +3,10 @@ module Spec
def reset!
FileUtils.rm_rf(File.expand_path('../../../site', __FILE__))
end
-
+
def clone_site
VCR.use_cassette('pull') do
- Locomotive::Wagon.clone("site", {"host" => "locomotive.engine.dev:3000"}, "email" => "admin@locomotivecms.com", "password" => "locomotive")
+ Locomotive::Wagon.clone('site', {'host' => 'locomotive.engine.dev:3000'}, 'email' => 'admin@locomotivecms.com', 'password' => 'locomotive')
end
end
end