Sha256: f65eacfb764da2a1923c4ae0bbb36c2560e89e44704137a2a045b0ff778465ec

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

feature "Resources form" do
  scenario "Adds a new item" do
    sign_in
    create_blog "Name for blogitem"
    page.should have_content "Name for blogitem"
  end

  scenario "Edits an existing item" do
    sign_in
    create_blog "Name for blogitem"
    update_blog "Name for blogitem", "New blog name"
    page.should have_content "New blog name"
  end

  scenario "Removes an item" do
    sign_in
    create_blog "Name for blogitem"
    remove_blog "Name for blogitem"
    page.should_not have_content "Name for blogitem"
  end

  def create_blog(title)
    visit brightcontent.blogs_url
    click_link "Create new blog"
    fill_in "Name", with: title
    click_button "Create Blog"
  end

  def update_blog(title, new_title)
    within_blog_item(title) { click_link "Edit" }
    fill_in "Name", with: new_title
    click_button "Update Blog"
  end

  def remove_blog(title)
    within_blog_item(title) do
      click_link "Delete"
    end
  end

  def within_blog_item(title)
    blog = Blog.find_by_name!(title)
    within "#blog_#{blog.id}" do
      yield
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
brightcontent-core-2.6.0 spec/features/resources_form_spec.rb
brightcontent-core-2.5.1 spec/features/resources_form_spec.rb
brightcontent-core-2.5.0 spec/features/resources_form_spec.rb
brightcontent-core-2.4.6 spec/features/resources_form_spec.rb
brightcontent-core-2.4.5 spec/features/resources_form_spec.rb
brightcontent-core-2.4.4 spec/features/resources_form_spec.rb
brightcontent-core-2.4.3 spec/features/resources_form_spec.rb
brightcontent-core-2.4.2 spec/features/resources_form_spec.rb
brightcontent-core-2.4.1 spec/features/resources_form_spec.rb
brightcontent-core-2.4.0 spec/features/resources_form_spec.rb
brightcontent-core-2.3.4 spec/features/resources_form_spec.rb
brightcontent-core-2.3.3 spec/features/resources_form_spec.rb
brightcontent-core-2.3.2 spec/features/resources_form_spec.rb
brightcontent-core-2.3.1 spec/features/resources_form_spec.rb
brightcontent-core-2.3.0 spec/features/resources_form_spec.rb
brightcontent-core-2.2.2 spec/features/resources_form_spec.rb
brightcontent-core-2.2.1 spec/features/resources_form_spec.rb
brightcontent-core-2.2.0 spec/features/resources_form_spec.rb
brightcontent-core-2.1.5 spec/features/resources_form_spec.rb
brightcontent-core-2.1.4 spec/features/resources_form_spec.rb