Sha256: ed446af15b28b85b2f1d6d0836d73c4ea430c6ec540c0a0d2f5b1ef283761130

Contents?: true

Size: 1.21 KB

Versions: 24

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

feature "Nested resource" do
  background { sign_in }
  let!(:blog) { create(:blog) }

  scenario "add new nested resource item" do
    create_comment "Name for Commenty"
    page.should have_content "Name for Commenty"
  end

  scenario "edit nested resource item" do
    create_comment "Name for Commenty"
    update_comment "Name for Commenty", "New Commentz name"
    page.should have_content "New Commentz name"
  end

  scenario "Removes an nested resource item" do
    create_comment "Name for Commenty"
    remove_comment "Name for Commenty"
    page.should_not have_content "Name for Commenty"
  end

  def create_comment(title)
    visit brightcontent.blog_comments_path(blog)
    click_link "Create new comment"
    fill_in "Text", with: title
    click_button "Create Comment"
  end

  def update_comment(title, new_title)
    within_comment_item(title) { click_link "Edit" }
    fill_in "Text", with: new_title
    click_button "Update Comment"
  end

  def remove_comment(title)
    within_comment_item(title) do
      click_link "Delete"
    end
  end

  def within_comment_item(title)
    comment = Comment.find_by_text!(title)
    within "#comment_#{comment.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/nested_resource_spec.rb
brightcontent-core-2.5.1 spec/features/nested_resource_spec.rb
brightcontent-core-2.5.0 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.6 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.5 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.4 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.3 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.2 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.1 spec/features/nested_resource_spec.rb
brightcontent-core-2.4.0 spec/features/nested_resource_spec.rb
brightcontent-core-2.3.4 spec/features/nested_resource_spec.rb
brightcontent-core-2.3.3 spec/features/nested_resource_spec.rb
brightcontent-core-2.3.2 spec/features/nested_resource_spec.rb
brightcontent-core-2.3.1 spec/features/nested_resource_spec.rb
brightcontent-core-2.3.0 spec/features/nested_resource_spec.rb
brightcontent-core-2.2.2 spec/features/nested_resource_spec.rb
brightcontent-core-2.2.1 spec/features/nested_resource_spec.rb
brightcontent-core-2.2.0 spec/features/nested_resource_spec.rb
brightcontent-core-2.1.5 spec/features/nested_resource_spec.rb
brightcontent-core-2.1.4 spec/features/nested_resource_spec.rb