Created
October 13, 2014 10:20
-
-
Save katpadi/313c8951e3d39a27882c to your computer and use it in GitHub Desktop.
MyAwesomeTasks Simple RSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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