Sha256: bcea3b58b6d84a8c970bedb554fc765a3ea2496086129c665359e097f3ff7fd5

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

# 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
    clone_site
    YAML.load_file('site/config/site.yml').should == {
      'name'      =>'locomotive',
      'locales'   =>['en', 'es'],
      'subdomain' =>'sample',
      'domains'   =>['sample.example.com']
    }
  end
  
  it "pulls the expected data" do
    clone_site
    es = YAML.load_file('site/app/views/pages/products.es.liquid')
    es["seo_title"].should == "Productos SEO"
    es["meta_description"].should == "DescripciĆ³n molona de los productos"
    es["meta_keywords"].should == "palabras, clave, productos"
    en = YAML.load_file('site/app/views/pages/products.liquid')
    en["seo_title"].should == "Search friendly products"
    en["meta_description"].should == "Fancy products description"
    en["meta_keywords"].should == "fancy, products, keywords"
  end

  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}
    VCR.use_cassette('push') do
      Locomotive::Wagon.push('site', { host: 'sample.example.com: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
  
  describe "push with unrecognized resources" do
    subject do
      lambda do
        clone_site
        VCR.use_cassette('push') do
          Locomotive::Wagon.push('site', { host: 'sample.example.com:3000', email: 'admin@locomotivecms.com', password: 'locomotive' }, {resources: ['all']})
        end
      end
    end
    
    it { should raise_exception(ArgumentError, /'all' resource not recognized/) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms_wagon-1.2.2 spec/integration/sites_spec.rb
locomotivecms_wagon-1.2.1 spec/integration/sites_spec.rb
locomotivecms_wagon-1.2.0 spec/integration/sites_spec.rb
locomotivecms_wagon-1.1.0 spec/integration/sites_spec.rb