<commit_before>require 'ostruct'
require 'spec_helper'

module Alchemy
  describe PagesController do
    let(:default_language)      { Language.default }
    let(:default_language_root) { FactoryGirl.create(:language_root_page, language: default_language, name: 'Home', public: true) }
    let(:page) { FactoryGirl.create(:public_page, parent_id: default_language_root.id, page_layout: 'news', name: 'News', urlname: 'news', language: default_language, do_not_autogenerate: false) }

    before { controller.stub(:signup_required?).and_return(false) }

    context 'an author' do
      let(:unpublic) { create(:page, parent: default_language_root) }

      before { controller.stub(current_alchemy_user: author_user) }

      it "should be able to visit a unpublic page" do
        get :show, urlname: unpublic.urlname
        response.status.should == 200
      end
    end<commit_msg>Fixes spec for admin users visiting unpublished pages.<commit_after>require 'ostruct'
require 'spec_helper'

module Alchemy
  describe PagesController do
    let(:default_language)      { Language.default }
    let(:default_language_root) { FactoryGirl.create(:language_root_page, language: default_language, name: 'Home', public: true) }
    let(:page) { FactoryGirl.create(:public_page, parent_id: default_language_root.id, page_layout: 'news', name: 'News', urlname: 'news', language: default_language, do_not_autogenerate: false) }

    before { controller.stub(:signup_required?).and_return(false) }

    context 'an author' do
      let(:unpublic) { create(:page, parent: default_language_root) }

      before { controller.stub(current_alchemy_user: author_user) }

      it "should not be able to visit a unpublic page" do
        get :show, urlname: unpublic.urlname
        response.status.should == 404
      end
    end
{'fraction_non_alphanumeric': 0.10621904237754541, 'fraction_numerical': 0.003302146395156852, 'mean_word_length': 4.4431137724550895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3421261', 'n_tokens_mistral': 557, 'n_tokens_neox': 531, 'n_words': 135}