Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MyAwesomeTasks Simple RSpec
require 'rails_helper'
describe 'MyAwesomeTasks' do
let!(:dummy_task) { create :my_awesome_task }
describe "Tasks Form" do
subject { page }
it { is_expected.to have_field('my_awesome_task[title]') }
it { is_expected.to have_field('my_awesome_task[description]') }
it { is_expected.to have_field('my_awesome_task[content]') }
it { is_expected.to have_button('Add Task') }
end
describe 'Method #edit' do
it 'has clickable link' do
expect(page)
.to have_selector("a#my_awesome_task#{dummy_task.id}")
end
it 'actually works', js: true do
page.find("a#my_awesome_task#{dummy_task.id}").click
wait_for_ajax
expect(page).to have_selector('#my_modal', visible: true)
fill_in 'my_awesome_task[description]', with: 'kakorrhaphiophobia'
click_button 'Save'
wait_for_ajax
expect(page)
.to have_text('kakorrhaphiophobia')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.