Permalink
Browse files

Added features, fixed translations for 'Add' instead of 'Create'.

  • Loading branch information...
1 parent 2a8e06e commit ceb468a6d4ebe95b79f35eec81061045364c86da @parndt parndt committed Nov 10, 2010
View
@@ -2,7 +2,7 @@ en:
plugins:
refinerycms_news:
title: News
- description: Provides a blog-like news section
+ description: Provides a simple news section
admin:
news_items:
news_item:
@@ -12,10 +12,10 @@ en:
published: Published
index:
actions: Actions
- create: "Create News Item"
+ create: "Add News Item"
news_item: News
no_items: "Sorry, no results found."
- no_items_yet: 'There are no news items yet. Click "Create News Item" to add your first news item.'
+ no_items_yet: 'There are no news items yet. Click "Add News Item" to add your first news item.'
news_items:
show:
back_to_index: "Back to all news"
@@ -0,0 +1,56 @@
+@refinerycms @news-items @news-items-manage
+Feature: Manage News Items
+ In order to have news bulletins on my website
+ As an administrator
+ I want to create and manage news items
+
+ Background:
+ Given I am a logged in refinery user
+ And I have no news items
+
+ Scenario: News Items List
+ Given I have news items titled Home, About
+ When I go to the list of news items
+ Then I should see "Home"
+ And I should see "About"
+
+ Scenario: Create Valid News Item
+ When I go to the list of news items
+ And I follow "Add News Item"
+ And I fill in "Title" with "News Items are a fun way to share what's going on"
+ And I fill in "Content" with "It really is the most exciting thing you could hear about today."
+ And I press "Save"
+ Then I should see "'News Items are a fun way to share what's going on' was successfully added."
+ And I should have 1 news item
+
+ Scenario: Create Invalid News Item (without title)
+ When I go to the list of news items
+ And I follow "Add News Item"
+ And I fill in "Content" with "But you won't ever see this published"
+ And I press "Save"
+ Then I should see "Title can't be blank"
+ And I should have 0 news items
+
+ Scenario: Create Invalid News Item (without content)
+ When I go to the list of news items
+ And I follow "Add News Item"
+ And I fill in "Title" with "Good luck ever seeing this title"
+ And I press "Save"
+ Then I should see "Content can't be blank"
+ And I should have 0 news items
+
+
+ Scenario: Create Duplicate News Item
+ Given I only have news items titled Home, About
+ When I go to the list of news items
+ And I follow "Add News Item"
+ And I fill in "Title" with "About"
+ And I press "Save"
+ Then I should have 2 news items
+
+ Scenario: Delete News Item
+ Given I only have a news item titled "test"
+ When I go to the list of news items
+ And I follow "Remove this news item forever"
+ Then I should see "'test' was successfully removed."
+ And I should have 0 news items
@@ -0,0 +1,25 @@
+Given /^I (only )?have a news item titled "?([^\"]*)"?$/ do |only, title|
+ NewsItem.delete_all if only
+
+ Factory(:news_item, :title => title)
+end
+
+Given /^I (only )?have news items titled "?([^\"]*)"?$/ do |only, titles|
+ NewsItem.delete_all if only
+
+ titles.split(', ').each do |title|
+ Factory(:news_item, :title => title)
+ end
+end
+
+Given /^I have no news items$/ do
+ NewsItem.delete_all
+end
+
+Given /^the news item titled "?([^\"]*)"? is not published$/ do |title|
+ NewsItem.find_by_title(title).update_attribute(:publish_date, Time.now + 1.day)
+end
+
+Then /^I should have ([0-9]+) news items?$/ do |count|
+ NewsItem.count.should == count.to_i
+end
@@ -1,7 +1,7 @@
require 'factory_girl'
Factory.define :news_item do |ni|
- ni.title "RefinyerCMS"
+ ni.title "RefineryCMS News Item"
ni.content "Some random text ..."
- ni.publish_date Date.today
+ ni.publish_date Time.now - 5.minutes
end
View
@@ -0,0 +1,26 @@
+module NavigationHelpers
+ module Refinery
+ module News
+ def path_to(page_name)
+ case page_name
+ when /the home\s?page/
+ root_path
+ when /the list of news items/
+ admin_news_items_path
+ when /the new news item form/
+ new_admin_news_item_path
+ else
+ begin
+ if page_name =~ /the news item titled "?([^\"]*)"?/ and (news_item = NewsItem.find_by_title($1)).present?
+ self.url_for(news_item)
+ else
+ nil
+ end
+ rescue
+ nil
+ end
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,27 @@
+@refinerycms @news-items @news-items-visit @visit-news-items
+Feature: Visit News Items
+ In order to view the content on this website
+ As a visitor
+ I want to view news items
+
+ Background:
+ Given A Refinery user exists
+ And I have a page titled "Home" with a custom url "/"
+ And I have a page titled "News" with a custom url "/news"
+ Given I only have a news item titled "Extra - Read all about it"
+ And I have a news item titled "Unpublished News Item"
+ And the news item titled "Unpublished News Item" is not published
+
+ @menu
+ Scenario: News appears in menu
+ When I go to the home page
+ Then I should see "Home"
+ And I should see "News"
+
+ @show
+ Scenario: Show News Item
+ When I go to the news item titled "Extra - Read all about it"
+ Then I should see "Home"
+ And I should see "Extra - Read all about it"
+ And I should see "News" within ".selected"
+ And I should not see "Unpublished News Item"
View
@@ -2,7 +2,7 @@ module Refinery
module News
class << self
def version
- %q{0.9.9.5}
+ %q{0.9.9.6}
end
end
end
View
@@ -1,8 +1,8 @@
Gem::Specification.new do |s|
s.name = %q{refinerycms-news}
- s.version = %q{0.9.9.5}
+ s.version = %q{0.9.9.6}
s.description = %q{A really straightforward open source Ruby on Rails news engine designed for integration with RefineryCMS.}
- s.date = %q{2010-10-22}
+ s.date = %q{2010-11-11}
s.summary = %q{Ruby on Rails news engine for RefineryCMS.}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com}
@@ -35,12 +35,23 @@ Gem::Specification.new do |s|
'config',
'config/locales',
'config/locales/en.yml',
+ 'config/locales/es-MX.yml',
'config/locales/es.yml',
+ 'config/locales/it.yml',
+ 'config/locales/lv.yml',
'config/locales/nl.yml',
'config/locales/pt-BR.yml',
'config/locales/ru.yml',
'config/locales/sl.yml',
'config/routes.rb',
+ 'features',
+ 'features/manage_news_items.feature',
+ 'features/step_definitions',
+ 'features/step_definitions/news_steps.rb',
+ 'features/support',
+ 'features/support/factories.rb',
+ 'features/support/paths.rb',
+ 'features/visit_news_items.feature',
'lib',
'lib/gemspec.rb',
'lib/generators',
@@ -56,6 +67,9 @@ Gem::Specification.new do |s|
'lib/refinerycms-news.rb',
'license.md',
'readme.md',
+ 'spec',
+ 'spec/models',
+ 'spec/models/news_item_spec.rb',
'test',
'test/fixtures',
'test/fixtures/news_items.yml',

0 comments on commit ceb468a

Please sign in to comment.