diff options
author | Philip Arndt <git@p.arndt.io> | 2015-05-20 12:09:19 +1200 |
---|---|---|
committer | Philip Arndt <git@p.arndt.io> | 2015-05-20 12:09:19 +1200 |
commit | 48929c277c2181355b780d5a5364b4c688bb3bc9 (patch) | |
tree | bd2d2eb793f5a19847eba7d6e4efedc74fa1f5e0 /spec/features/refinery/blog/admin/posts_spec.rb | |
parent | 4efb627e5b140c4e1dee252b12c1fea31b9a42aa (diff) | |
parent | de954c625840adb7c1e98f1c675e56bb5e3074d7 (diff) | |
download | refinerycms-blog-48929c277c2181355b780d5a5364b4c688bb3bc9.tar.gz refinerycms-blog-48929c277c2181355b780d5a5364b4c688bb3bc9.tar.bz2 refinerycms-blog-48929c277c2181355b780d5a5364b4c688bb3bc9.zip |
Merge pull request #438 from refinery/merge-pr-432
Replaces #432
Diffstat (limited to 'spec/features/refinery/blog/admin/posts_spec.rb')
-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 2c7b82c..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 - click_link "toggle_advanced_options" + 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>')") - click_link "toggle_advanced_options" - sleep 1 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" + 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 dpage_titleirty 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>" - click_link "toggle_advanced_options" expect(page).to have_content("Author") select other_guy.username, :from => "Author" |