Sha256: de49292ae99f18daf69b0ca94b9c6f1aed12e2ac3f24b4059661601164d484f6

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

require 'spec_helper'

describe Taza::PageGenerator do
  include Helpers::Taza

  before(:each) do
    capture(:stdout) { Taza::SiteGenerator.new(['foo_site']).site }
  end

  context "taza page home foo_site" do
    context "creates" do

      let(:subject) { Taza::PageGenerator.new(['home', 'foo_site']) }
      let(:output) { capture(:stdout) { subject.page  }}

      it 'creates a checkout_page.rb' do
        expect(output).to include('lib/sites/foo_site/pages/home_page.rb')
        expect(File.exists?('lib/sites/foo_site/pages/home_page.rb')).to be_true
      end
      it 'creates a checkout_page_spec.rb' do
        expect(output).to include('spec/isolation/home_page_spec.rb')
        expect(File.exists?('spec/isolation/home_page_spec.rb')).to be_true
      end

      it 'gives message if site does not exist' do
        bar_page = capture(:stdout) { Taza::PageGenerator.new(['checkout', 'bar_site']).page }
        expect(bar_page).to include("No such site bar_site exists")
      end

      it 'generates a page that can be required' do
        output
        page_spec = 'spec/isolation/home_page_spec.rb'
        expect(system("ruby -c #{page_spec} > #{null_device}")).to be_true
      end

      xit "should be able to access the generated page from the site" do
        run_generator('page', [@page_name, @site_class.to_s], generator_sources)
        stub_settings
        stub_browser
        @site_class.new.check_out_page
      end

      xit "should be able to access the generated page for its site" do
        stub_browser
        stub_settings
        new_site_class = generate_site('Pag')
        run_generator('page', [@page_name, @site_class.to_s], generator_sources)
        run_generator('page', [@page_name, new_site_class.to_s], generator_sources)
        new_site_class.new.check_out_page.class.should_not eql(@site_class.new.check_out_page.class)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
taza-0.9.2.1 spec/generators/page_generator_spec.rb
taza-0.9.2.0 spec/generators/page_generator_spec.rb