diff options
author | Philip Arndt <git@p.arndt.io> | 2015-05-20 12:05:03 +1200 |
---|---|---|
committer | Philip Arndt <git@p.arndt.io> | 2015-05-20 12:05:03 +1200 |
commit | de954c625840adb7c1e98f1c675e56bb5e3074d7 (patch) | |
tree | bd2d2eb793f5a19847eba7d6e4efedc74fa1f5e0 /spec/features/refinery/blog/admin | |
parent | 99cdd519b209e05a6ed9ab81f23d22bd11b2490f (diff) | |
download | refinerycms-blog-de954c625840adb7c1e98f1c675e56bb5e3074d7.tar.gz refinerycms-blog-de954c625840adb7c1e98f1c675e56bb5e3074d7.tar.bz2 refinerycms-blog-de954c625840adb7c1e98f1c675e56bb5e3074d7.zip |
remove JS from tests for reliability and dramatic speed increase.
Diffstat (limited to 'spec/features/refinery/blog/admin')
-rw-r--r-- | spec/features/refinery/blog/admin/posts_spec.rb | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb index 9ab35c7..0efbb1d 100644 --- a/spec/features/refinery/blog/admin/posts_spec.rb +++ b/spec/features/refinery/blog/admin/posts_spec.rb @@ -32,27 +32,24 @@ module Refinery expect(page).to have_content("Tags") end - it "should have category title", :js => true do - find('#toggle_advanced_options').trigger(:click) + it "should have category title" do expect(page).to have_content(blog_category.title) end - describe "create blog post", :js => true do + describe "create blog post" do before do expect(subject.class.count).to eq(0) fill_in "post_title", :with => "This is my blog post" + fill_in "post_body", with: "<p>And I love it</p>" - # this is a dirty hack but textarea that needs to be filled is - # hidden and capybara refuses to fill in elements it can't see - page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I love it</p>')") - find('#toggle_advanced_options').trigger(:click) expect(page).to have_css '.blog_categories' expect(page).to have_css "#post_category_ids_#{blog_category.id}" - expect(page).to have_selector("#post_category_ids_#{blog_category.id}:not(:checked)") - check blog_category.title - expect(page).to have_selector("#post_category_ids_#{blog_category.id}:checked") + expect { check(blog_category.title) }.to change { + !!page.find("#post_category_ids_#{blog_category.id}").checked? + }.from(false).to(true) + click_button "Save" - sleep 1 + expect(page).to have_content("was successfully added.") end @@ -70,13 +67,11 @@ module Refinery end end - describe "create blog post with tags", :js => true do + describe "create blog post with tags" do let(:tag_list) { "chicago, bikes, beers, babes" } before do fill_in "Title", :with => "This is a tagged blog post" - # this is a dirty hack but textarea that needs to be filled is - # hidden and capybara refuses to fill in elements it can't see - page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>And I also love it</p>')") + fill_in "post_body", with: "<p>And I also love it</p>" fill_in "Tags", :with => tag_list click_button "Save" end @@ -160,17 +155,14 @@ module Refinery context "with multiple users" do let!(:other_guy) { FactoryGirl.create(:refinery_user, :username => "Other Guy") } - describe "create blog post with alternate author", :js => true do + describe "create blog post with alternate author" do before do visit refinery.blog_admin_posts_path click_link "Create new post" fill_in "post_title", :with => "This is some other guy's blog post" - # this is a dirty hack but textarea that needs to be filled is - # hidden and capybara refuses to fill in elements it can't see - page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>I totally did not write it.</p>')") + fill_in "post_body", with: "<p>I totally did not write it.</p>" - find("#toggle_advanced_options").trigger(:click) expect(page).to have_content("Author") select other_guy.username, :from => "Author" |