Sha256: 484c592b25e45f71ba376095e3a865554dce7294e580ccffc57502b272d424e8
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' # 90% of this section is controller via javascipt hence the minimal specs RSpec.describe "Admin::Menus", :type => :request do let(:admin) { FactoryGirl.create(:admin) } let(:menu_build) { FactoryGirl.build(:menu) } let!(:menu) { FactoryGirl.create(:menu) } before { sign_in(admin) } describe "GET /admin/menus" do before(:each) do visit "/admin/menus" end it "should display the menus" do expect(page).to have_content('Menus') end it "should allow you to create a new menu" do expect(page).to have_css('form#new_menu') fill_in 'menu_name', with: menu_build.name fill_in 'menu_key', with: menu_build.name click_button 'Add menu group' expect(page).to have_content('Success') end it "should not allow you to create a new menu without a name or key" do fill_in 'menu_name', with: '' click_button 'Add menu group' expect(current_path).to eq("/admin/menus") expect(page).to have_selector('.help-block.error') expect(page).to have_content('Name is required') expect(page).to have_content('Key is required') end it "should have a link to edit menu" do expect(page).to have_content(menu.name) find(:xpath, "//a[@href='/admin/menus/#{menu.id}/edit']").click expect(page).to have_content('Edit') end it "should have link to delete menu" do expect(page).to have_content(menu.name) expect(page).to have_link("Delete", href: "/admin/menus/#{menu.id}") end end describe "PUT /admin/menus/#id/edit" do # everything controlled via javascript end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roroacms-0.0.7 | spec/requests/roroacms/admin/menu_spec.rb |