Sha256: b9b999fe853294e166cb3ffbb1e9565af1d48942e8156a249c35acdb7c67ea4e

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe "creating a new record" do
  before :each do
    login
    give_permission("Person")

    @person = create :person
    visit edit_outpost_person_path(@person)
  end

  context "invalid" do
    it "shows validation errors" do
      fill_in "person_name", with: ""
      fill_in "person_email", with: ""
      click_button "edit"

      current_path.should eq outpost_person_path(@person)

      page.should_not have_css ".alert-success"

      # FIXME: These are too specific to simple form
      page.should have_content "Please review the problems below"
      page.should have_css ".error"
    end
  end

  context "valid" do
    it "is saved" do
      fill_in "person_name", with: "New Name"
      click_button "edit"

      @person.reload
      current_path.should eq edit_outpost_person_path(@person)

      page.should have_css ".alert-success"
      page.should_not have_content "Please review the problems below"
      page.should_not have_css ".error"

      @person.name.should eq "New Name"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
outpost-cms-0.1.4 spec/features/editing_spec.rb
outpost-cms-0.1.3 spec/features/editing_spec.rb
outpost-cms-0.1.2 spec/features/editing_spec.rb
outpost-cms-0.1.1 spec/features/editing_spec.rb
outpost-cms-0.1.0 spec/features/editing_spec.rb
outpost-cms-0.0.5 spec/features/editing_spec.rb
outpost-cms-0.0.4 spec/features/editing_spec.rb