Sha256: ea1f6a5d044fbc1e6ad50d5e74c00ab0c19f6a6702c450c6bba38378fcd5c9bd

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require File.expand_path('../../../../../helper', __FILE__)

describe 'Ramaze::Helper::Section' do
  behaves_like :capybara

  status_id = Sections::Model::SectionEntryStatus[:name => 'published'].id
  user_id   = Users::Model::User[:email => 'spec@domain.tld'].id
  section   = Sections::Model::Section.create(
    :name                    => 'Spec section',
    :comment_allow           => false,
    :comment_require_account => false,
    :comment_moderate        => false,
    :comment_format          => 'markdown'
  )

  entry = Sections::Model::SectionEntry.create(
    :title                   => 'Spec entry',
    :user_id                 => user_id,
    :section_entry_status_id => status_id,
    :section_id              => section.id
  )

  it 'Validate a valid section' do
    url = Sections::Controller::Sections.r(:edit, section.id).to_s

    visit(url)

    current_path.should == url
  end

  it 'Validate an invalid section' do
    url   = Sections::Controller::Sections.r(:edit, section.id + 1).to_s
    index = Sections::Controller::Sections.r(:index).to_s

    visit(url)

    current_path.should == index
  end

  it 'Validate a valid section entry' do
    url = Sections::Controller::SectionEntries.r(
      :edit, section.id, entry.id
    ).to_s

    visit(url)

    current_path.should == url
  end

  it 'Validate an invalid section entry' do
    index = Sections::Controller::SectionEntries.r(:index, section.id).to_s
    url   = Sections::Controller::SectionEntries.r(
      :edit, section.id, entry.id + 1
    ).to_s

    visit(url)

    current_path.should == index
  end

  entry.destroy
  section.destroy
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.4.3 spec/zen/package/sections/helper/section.rb
zen-0.4.2 spec/zen/package/sections/helper/section.rb
zen-0.4.1 spec/zen/package/sections/helper/section.rb
zen-0.4 spec/zen/package/sections/helper/section.rb