diff options
author | Philip Arndt <p@arndt.io> | 2014-02-02 22:31:09 -0800 |
---|---|---|
committer | Philip Arndt <p@arndt.io> | 2014-02-02 22:31:09 -0800 |
commit | a6ec37c7f54660d34a6b6f1496fea9f825543cc7 (patch) | |
tree | 57286eb5a09e4742c2400619b76cf507771d3d7e /spec | |
parent | d891009d8b26cbccfc7fcdec645e1e2382c641bc (diff) | |
parent | 320275b324a8c0cb3e46a10ea43b1391ee86c874 (diff) | |
download | refinerycms-blog-a6ec37c7f54660d34a6b6f1496fea9f825543cc7.tar.gz refinerycms-blog-a6ec37c7f54660d34a6b6f1496fea9f825543cc7.tar.bz2 refinerycms-blog-a6ec37c7f54660d34a6b6f1496fea9f825543cc7.zip |
Merge pull request #368 from refinery/rails4
Rails 4 support.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/refinery/blog/admin/posts_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/refinery/blog/category_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/refinery/blog/post_spec.rb | 8 | ||||
-rw-r--r-- | spec/spec_helper.rb | 3 |
4 files changed, 17 insertions, 15 deletions
diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb index a5d4f62..5dca929 100644 --- a/spec/features/refinery/blog/admin/posts_spec.rb +++ b/spec/features/refinery/blog/admin/posts_spec.rb @@ -39,16 +39,18 @@ module Refinery describe "create blog post", :js => true do before do + subject.class.count.should eq(0) fill_in "post_title", :with => "This is my 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 love it</p>')") click_link "toggle_advanced_options" + page.should have_css '.blog_categories' + page.should have_css "#post_category_ids_#{blog_category.id}" check blog_category.title + find_field("post_category_ids_#{blog_category.id}").should be_checked click_button "Save" - end - - it "should succeed" do page.should have_content("was successfully added.") end @@ -67,13 +69,13 @@ module Refinery end describe "create blog post with tags", :js => true do + let(:tag_list) { "chicago, bikes, beers, babes" } before do - @tag_list = "chicago, bikes, beers, babes" 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 "Tags", :with => @tag_list + fill_in "Tags", :with => tag_list click_button "Save" end @@ -86,7 +88,7 @@ module Refinery end it "should have the specified tags" do - subject.class.last.tag_list.sort.should eq(@tag_list.split(', ').sort) + subject.class.last.tag_list.sort.should eq(tag_list.split(', ').sort) end end end @@ -171,9 +173,6 @@ module Refinery select other_guy.username, :from => "Author" click_button "Save" - end - - it "should succeed" do page.should have_content("was successfully added.") end diff --git a/spec/models/refinery/blog/category_spec.rb b/spec/models/refinery/blog/category_spec.rb index ad83017..9cd5d97 100644 --- a/spec/models/refinery/blog/category_spec.rb +++ b/spec/models/refinery/blog/category_spec.rb @@ -32,7 +32,7 @@ module Refinery :published_at => Time.now, :author => refinery_user }) - category.posts.first.should == latest_post + category.posts.newest_first.first.should == latest_post end end @@ -47,4 +47,4 @@ module Refinery end end end -end
\ No newline at end of file +end diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb index bc9de6e..8b156cb 100644 --- a/spec/models/refinery/blog/post_spec.rb +++ b/spec/models/refinery/blog/post_spec.rb @@ -95,8 +95,10 @@ module Refinery end it "returns all posts which aren't in draft and pub date isn't in future" do - described_class.live.count.should be == 2 - described_class.live.should == [@post2, @post1] + live_posts = described_class.live + live_posts.count.should be == 2 + live_posts.should include(@post2) + live_posts.should include(@post1) end end @@ -135,7 +137,7 @@ module Refinery end it "returns next article when called on current article" do - described_class.last.next.should == @post + described_class.newest_first.last.next.should == @post end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4b29712..bc10eff 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,7 +19,8 @@ RSpec.configure do |config| end # set javascript driver for capybara -Capybara.javascript_driver = :selenium +require 'capybara/poltergeist' +Capybara.javascript_driver = :poltergeist # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories including factories. |