noodall 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README ADDED
@@ -0,0 +1,3 @@
1
+ # Noodall - A Content Management Framework for Rails
2
+
3
+ This is Noodall. It is a content management framework built for Rails 3. It is not a content management system itself. It constists of a number of gems and generators that allow developers to quikly create a fully customised tree based content management system.
@@ -1,8 +1,5 @@
1
1
  require 'rails/generators'
2
2
  require 'rails/generators/rails/app/app_generator'
3
- require 'generators/rspec/install/install_generator'
4
- require 'generators/devise/install_generator'
5
- require 'generators/cucumber/install/install_generator'
6
3
 
7
4
  module Noodall
8
5
 
@@ -19,7 +16,6 @@ module Noodall
19
16
  def test
20
17
  directory 'features'
21
18
  directory 'spec'
22
- copy_file "config/cucumber.yml"
23
19
  end
24
20
 
25
21
  def lib
@@ -1,20 +1,16 @@
1
1
  source 'http://rubygems.org'
2
2
  source 'http://gems.github.com'
3
3
 
4
- gem 'rails', '3.0.3'
5
- gem 'mm-multi-parameter-attributes', :git => 'git://github.com/kernow/mm-multi-parameter-attributes.git'
6
- gem 'noodall-ui', '~> 0.1.9'
4
+ gem 'rails', '> 3.0'
5
+ gem 'noodall-ui'
7
6
  gem 'noodall-devise'
8
- gem 'bson_ext', '~> 1.2.0'
9
- gem 'rmagick', :require => 'RMagick'
10
- gem 'dragonfly', '~> 0.8.1'
11
- gem 'factory_girl_rails'
12
- gem 'fakerama'
7
+ gem 'bson_ext'
8
+ gem 'dragonfly'
9
+ gem 'rack-contrib', :require => 'rack/contrib'
13
10
 
14
11
  group :production, :staging do
15
12
  gem 'dalli'
16
13
  gem 'rack-cache', '~> 1.0.0', :require => 'rack/cache'
17
- gem 'rack-contrib', :require => 'rack/contrib'
18
14
  end
19
15
 
20
16
  group :development, :test do
@@ -22,10 +18,10 @@ group :development, :test do
22
18
  gem 'database_cleaner'
23
19
  gem 'cucumber-rails'
24
20
  gem 'cucumber'
25
- gem 'rspec-rails', "~> 2.0.0"
21
+ gem 'rspec-rails'
26
22
  gem 'spork'
27
23
  gem 'launchy' # So you can do Then show me the page
28
24
  gem 'factory_girl_rails'
29
- gem "haml"
25
+ gem 'fakerama'
30
26
  end
31
27
 
@@ -3,56 +3,4 @@ module ApplicationHelper
3
3
  include Noodall::Permalinks
4
4
  include Noodall::LayoutHelper
5
5
 
6
-
7
- def main_navigation
8
- render :partial => 'shared/main_nav',
9
- :locals => {
10
- :play_sport_page => Noodall::Node.published.first(:permalink => 'play-sport'),
11
- :other_roots => Noodall::Node.published.where( :permalink => { :$in => ['get-social','all-about-us'] })
12
- }
13
- end
14
-
15
-
16
- def hero_size
17
- case @node
18
- when LandingPage
19
- '680x300#'
20
- else
21
- '440x196#'
22
- end
23
- end
24
-
25
-
26
- def digg_link(url, html_options = {})
27
- link_to 'Digg', "http://digg.com/submit?phase=2&url=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'digg-submit', :title => 'Digg this!')
28
- end
29
-
30
- def delicious_link(url, html_options = {})
31
- link_to 'delicious', "http://del.icio.us/post?url=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'delicious-submit', :title => 'Save to delicious')
32
- end
33
-
34
- def facebook_link(url, html_options = {})
35
- link_to 'Facebook', "http://www.facebook.com/sharer.php?u=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'facebook-submit', :title => 'Share on Facebook')
36
- end
37
-
38
- def stumble_link(url, html_options = {})
39
- link_to 'Stumble Upon', "http://www.stumbleupon.com/submit?url=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'stumble-submit', :title => 'Stumble on this')
40
- end
41
-
42
- def mail_link(url, html_options = {})
43
- mail_to nil, "Email", html_options.reverse_merge( :body => url, :class => 'share-link', :id => 'mail-link', :title => 'Email this to a friend')
44
- end
45
-
46
- def twitter_link(url, html_options = {})
47
- link_to 'Twitter', "http://twitter.com/home?status=#{url}}", html_options.reverse_merge(:class => 'share-link', :id => 'twitter-submit', :title => 'Tweet this')
48
- end
49
-
50
- def reddit_link(url, html_options = {})
51
- link_to 'Reddit', "http://www.reddit.com/submit?url=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'reddit-submit', :title => 'Reddit this!')
52
- end
53
-
54
- def technorati_link(url, html_options = {})
55
- link_to 'Technorati', "http://technorati.com/faves/?add=#{url}", html_options.reverse_merge(:class => 'share-link', :id => 'technorati-submit', :title => 'Technorati this!')
56
- end
57
-
58
6
  end
@@ -0,0 +1,2 @@
1
+ class Home < Noodall::Node
2
+ end
@@ -44,6 +44,6 @@ module <%= app_const_base %>
44
44
  # Configure sensitive parameters which will be filtered from the log file.
45
45
  config.filter_parameters += [:password]
46
46
 
47
- config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :noodall_assets, '/media'
47
+ config.middleware.insert 0, 'Dragonfly::Middleware', :noodall_assets
48
48
  end
49
49
  end
@@ -23,5 +23,11 @@
23
23
 
24
24
  # Only use best-standards-support built into browsers
25
25
  config.action_dispatch.best_standards_support = :builtin
26
+
27
+ # Remove Cache-Control header so app does not cache anything
28
+ config.middleware.insert_before ActionDispatch::Static, Rack::ResponseHeaders do |headers|
29
+ headers.delete('Last-Modified')
30
+ headers['Cache-Control'] = "private, max-age=0"
31
+ end
26
32
  end
27
33
 
@@ -1,6 +1,3 @@
1
- # Use Noodall's default dragonfly setup for assets
2
- require 'noodall/dragonfly'
3
-
4
1
  # Set the slots that are avaiable to put components in
5
2
  Noodall::Node.slots :main, :large, :small
6
3
 
@@ -0,0 +1,8 @@
1
+ # Configuration for processing and encoding
2
+ app = Dragonfly::App[:noodall_assets]
3
+ app.configure_with(:imagemagick)
4
+ app.configure_with(:rails)
5
+ app.datastore = Dragonfly::DataStorage::MongoDataStore.new :db => MongoMapper.database
6
+
7
+ # For more info about Dragonfly configuration please visit
8
+ # http://markevans.github.com/dragonfly/
@@ -1,4 +1,5 @@
1
1
  home:
2
+ name: Home
2
3
  title: Welcome
3
4
  type: Home
4
5
  #about:
@@ -8,4 +8,4 @@
8
8
  #
9
9
  Noodall::Node.create_indexes!
10
10
  Noodall::Site.build!
11
- User.create(:name => "Mr Admin", :email => "hello@wearebeef.co.uk", :password => "passw0rd", :password_confirmation => "passw0rd", :groups => ['admin'])
11
+ User.create(:name => "Mr Admin", :email => "admin@example.com", :password => "password", :password_confirmation => "password", :groups => ['admin'])
@@ -1,3 +1,7 @@
1
+ #Load Noodall specific stuff
2
+ require 'noodall/permalinks'
3
+ World(Noodall::Permalinks)
4
+
1
5
  Before do
2
6
  # Create the home page
3
7
  Home.create! :title => 'home', :publish => true, :body => "Hello"
@@ -2,3 +2,7 @@
2
2
  db/*.sqlite3
3
3
  log/*.log
4
4
  tmp/**/*
5
+ .DS_Store
6
+ .livereload
7
+ .sass-cache/*
8
+
@@ -1,7 +1,7 @@
1
1
  namespace :db do
2
2
 
3
3
  task :seed => :environment do
4
- require 'db/seeds'
4
+ require "#{Rails.root}/db/seeds"
5
5
  end
6
6
 
7
7
  task :populate => :seed do
@@ -1,5 +1,5 @@
1
1
  Factory.define :home do |home|
2
- home.title { Faker::Lorem.words(3).join(' ') }
3
- home.body { Faker::Lorem.paragraphs(6) }
2
+ home.title { "Welcome" }
3
+ home.body { Fakerama::Content.content }
4
4
  home.published_at { Time.now }
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module Noodall
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
data/noodall.gemspec CHANGED
@@ -5,17 +5,16 @@ Gem::Specification.new do |s|
5
5
  s.name = "noodall"
6
6
  s.version = Noodall::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.authors = []
9
- s.email = []
8
+ s.authors = ['Steve England', 'Beef']
9
+ s.email = ['noodall@wearebeef.co.uk']
10
10
  s.homepage = "http://rubygems.org/gems/noodall"
11
11
  s.summary = "Noodall meta-gem that depends on the other components"
12
12
  s.description = "Noodall meta-gem that depends on the other components. UI and Core data objects."
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
- s.add_dependency 'rails', "~> 3.0.1"
15
+ s.add_dependency 'rails', ">= 3.0.1"
16
16
  s.add_dependency 'noodall-core', ">= 0"
17
17
  s.add_dependency 'noodall-ui', ">= 0"
18
- # s.add_dependency 'noodall-devise', ">= 0"
19
18
 
20
19
  s.add_development_dependency "bundler", ">= 1.0.0"
21
20
 
metadata CHANGED
@@ -1,95 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: noodall
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
11
6
  platform: ruby
12
- authors: []
13
-
7
+ authors:
8
+ - Steve England
9
+ - Beef
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2011-02-16 00:00:00 +00:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2011-08-26 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &21176580 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 5
30
- segments:
31
- - 3
32
- - 0
33
- - 1
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
34
22
  version: 3.0.1
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: noodall-core
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *21176580
26
+ - !ruby/object:Gem::Dependency
27
+ name: noodall-core
28
+ requirement: &21176120 !ruby/object:Gem::Requirement
41
29
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
49
34
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: noodall-ui
53
35
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *21176120
37
+ - !ruby/object:Gem::Dependency
38
+ name: noodall-ui
39
+ requirement: &21175660 !ruby/object:Gem::Requirement
55
40
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
63
45
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: bundler
67
46
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *21175660
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: &21223660 !ruby/object:Gem::Requirement
69
51
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 23
74
- segments:
75
- - 1
76
- - 0
77
- - 0
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
78
55
  version: 1.0.0
79
56
  type: :development
80
- version_requirements: *id004
81
- description: Noodall meta-gem that depends on the other components. UI and Core data objects.
82
- email: []
83
-
84
- executables:
57
+ prerelease: false
58
+ version_requirements: *21223660
59
+ description: Noodall meta-gem that depends on the other components. UI and Core data
60
+ objects.
61
+ email:
62
+ - noodall@wearebeef.co.uk
63
+ executables:
85
64
  - noodall
86
65
  extensions: []
87
-
88
66
  extra_rdoc_files: []
89
-
90
- files:
67
+ files:
91
68
  - .gitignore
92
69
  - Gemfile
70
+ - README
93
71
  - Rakefile
94
72
  - bin/noodall
95
73
  - lib/noodall.rb
@@ -101,13 +79,13 @@ files:
101
79
  - lib/noodall/templates/app/helpers/application_helper.rb
102
80
  - lib/noodall/templates/app/mailers/.empty_directory
103
81
  - lib/noodall/templates/app/models/.empty_directory
82
+ - lib/noodall/templates/app/models/home.rb
104
83
  - lib/noodall/templates/app/views/admin/nodes/_home.html.erb
105
84
  - lib/noodall/templates/app/views/layouts/application.html.erb.tt
106
85
  - lib/noodall/templates/app/views/nodes/home.html.erb
107
86
  - lib/noodall/templates/config.ru
108
87
  - lib/noodall/templates/config/application.rb
109
88
  - lib/noodall/templates/config/boot.rb
110
- - lib/noodall/templates/config/cucumber.yml
111
89
  - lib/noodall/templates/config/database.yml
112
90
  - lib/noodall/templates/config/environment.rb
113
91
  - lib/noodall/templates/config/environments/development.rb.tt
@@ -120,6 +98,7 @@ files:
120
98
  - lib/noodall/templates/config/initializers/mime_types.rb
121
99
  - lib/noodall/templates/config/initializers/mongo_mapper.rb
122
100
  - lib/noodall/templates/config/initializers/noodall.rb
101
+ - lib/noodall/templates/config/initializers/noodall_dragonfly.rb
123
102
  - lib/noodall/templates/config/initializers/secret_token.rb.tt
124
103
  - lib/noodall/templates/config/initializers/session_store.rb.tt
125
104
  - lib/noodall/templates/config/locales/devise.en.yml
@@ -133,10 +112,7 @@ files:
133
112
  - lib/noodall/templates/features/step_definitions/cms_node_steps.rb
134
113
  - lib/noodall/templates/features/step_definitions/component_steps.rb
135
114
  - lib/noodall/templates/features/step_definitions/sign_in_steps.rb
136
- - lib/noodall/templates/features/step_definitions/web_steps.rb
137
- - lib/noodall/templates/features/support/env.rb
138
- - lib/noodall/templates/features/support/home_page.rb
139
- - lib/noodall/templates/features/support/paths.rb
115
+ - lib/noodall/templates/features/support/noodall.rb
140
116
  - lib/noodall/templates/gitignore
141
117
  - lib/noodall/templates/lib/tasks/populate.rake
142
118
  - lib/noodall/templates/public/404.html
@@ -151,7 +127,6 @@ files:
151
127
  - lib/noodall/templates/public/javascripts/prototype.js
152
128
  - lib/noodall/templates/public/robots.txt
153
129
  - lib/noodall/templates/public/stylesheets/.empty_directory
154
- - lib/noodall/templates/script/cucumber
155
130
  - lib/noodall/templates/script/rails
156
131
  - lib/noodall/templates/spec/factories/asset.rb
157
132
  - lib/noodall/templates/spec/factories/home.rb
@@ -160,41 +135,28 @@ files:
160
135
  - lib/noodall/templates/spec/files/test.pdf
161
136
  - lib/noodall/version.rb
162
137
  - noodall.gemspec
163
- has_rdoc: true
164
138
  homepage: http://rubygems.org/gems/noodall
165
139
  licenses: []
166
-
167
140
  post_install_message:
168
141
  rdoc_options: []
169
-
170
- require_paths:
142
+ require_paths:
171
143
  - lib
172
- required_ruby_version: !ruby/object:Gem::Requirement
144
+ required_ruby_version: !ruby/object:Gem::Requirement
173
145
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 3
178
- segments:
179
- - 0
180
- version: "0"
181
- required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
151
  none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- hash: 23
187
- segments:
188
- - 1
189
- - 3
190
- - 6
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
191
155
  version: 1.3.6
192
156
  requirements: []
193
-
194
157
  rubyforge_project:
195
- rubygems_version: 1.4.1
158
+ rubygems_version: 1.8.6
196
159
  signing_key:
197
160
  specification_version: 3
198
161
  summary: Noodall meta-gem that depends on the other components
199
162
  test_files: []
200
-
@@ -1,8 +0,0 @@
1
- <%
2
- rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
- rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
- std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
- %>
6
- default: --drb <%= std_opts %> features
7
- wip: --drb --tags @wip:3 --wip features
8
- rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -1,219 +0,0 @@
1
- # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
- # It is recommended to regenerate this file in the future when you upgrade to a
3
- # newer version of cucumber-rails. Consider adding your own code to a new file
4
- # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
- # files.
6
-
7
-
8
- require 'uri'
9
- require 'cgi'
10
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
11
-
12
- module WithinHelpers
13
- def with_scope(locator)
14
- locator ? within(locator) { yield } : yield
15
- end
16
- end
17
- World(WithinHelpers)
18
-
19
- Given /^(?:|I )am on (.+)$/ do |page_name|
20
- visit path_to(page_name)
21
- end
22
-
23
- When /^(?:|I )go to (.+)$/ do |page_name|
24
- visit path_to(page_name)
25
- end
26
-
27
- When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
28
- with_scope(selector) do
29
- click_button(button)
30
- end
31
- end
32
-
33
- When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
34
- with_scope(selector) do
35
- click_link(link)
36
- end
37
- end
38
-
39
- When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
40
- with_scope(selector) do
41
- fill_in(field, :with => value)
42
- end
43
- end
44
-
45
- When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
46
- with_scope(selector) do
47
- fill_in(field, :with => value)
48
- end
49
- end
50
-
51
- # Use this to fill in an entire form with data from a table. Example:
52
- #
53
- # When I fill in the following:
54
- # | Account Number | 5002 |
55
- # | Expiry date | 2009-11-01 |
56
- # | Note | Nice guy |
57
- # | Wants Email? | |
58
- #
59
- # TODO: Add support for checkbox, select og option
60
- # based on naming conventions.
61
- #
62
- When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
63
- with_scope(selector) do
64
- fields.rows_hash.each do |name, value|
65
- When %{I fill in "#{name}" with "#{value}"}
66
- end
67
- end
68
- end
69
-
70
- When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
71
- with_scope(selector) do
72
- select(value, :from => field)
73
- end
74
- end
75
-
76
- When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
77
- with_scope(selector) do
78
- check(field)
79
- end
80
- end
81
-
82
- When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
83
- with_scope(selector) do
84
- uncheck(field)
85
- end
86
- end
87
-
88
- When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
89
- with_scope(selector) do
90
- choose(field)
91
- end
92
- end
93
-
94
- When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
95
- with_scope(selector) do
96
- attach_file(field, path)
97
- end
98
- end
99
-
100
- Then /^(?:|I )should see JSON:$/ do |expected_json|
101
- require 'json'
102
- expected = JSON.pretty_generate(JSON.parse(expected_json))
103
- actual = JSON.pretty_generate(JSON.parse(response.body))
104
- expected.should == actual
105
- end
106
-
107
- Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
108
- with_scope(selector) do
109
- if page.respond_to? :should
110
- page.should have_content(text)
111
- else
112
- assert page.has_content?(text)
113
- end
114
- end
115
- end
116
-
117
- Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
118
- regexp = Regexp.new(regexp)
119
- with_scope(selector) do
120
- if page.respond_to? :should
121
- page.should have_xpath('//*', :text => regexp)
122
- else
123
- assert page.has_xpath?('//*', :text => regexp)
124
- end
125
- end
126
- end
127
-
128
- Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
129
- with_scope(selector) do
130
- if page.respond_to? :should
131
- page.should have_no_content(text)
132
- else
133
- assert page.has_no_content?(text)
134
- end
135
- end
136
- end
137
-
138
- Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
139
- regexp = Regexp.new(regexp)
140
- with_scope(selector) do
141
- if page.respond_to? :should
142
- page.should have_no_xpath('//*', :text => regexp)
143
- else
144
- assert page.has_no_xpath?('//*', :text => regexp)
145
- end
146
- end
147
- end
148
-
149
- Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
150
- with_scope(selector) do
151
- field = find_field(field)
152
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
153
- if field_value.respond_to? :should
154
- field_value.should =~ /#{value}/
155
- else
156
- assert_match(/#{value}/, field_value)
157
- end
158
- end
159
- end
160
-
161
- Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
162
- with_scope(selector) do
163
- field = find_field(field)
164
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
165
- if field_value.respond_to? :should_not
166
- field_value.should_not =~ /#{value}/
167
- else
168
- assert_no_match(/#{value}/, field_value)
169
- end
170
- end
171
- end
172
-
173
- Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
174
- with_scope(selector) do
175
- field_checked = find_field(label)['checked']
176
- if field_checked.respond_to? :should
177
- field_checked.should be_true
178
- else
179
- assert field_checked
180
- end
181
- end
182
- end
183
-
184
- Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
185
- with_scope(selector) do
186
- field_checked = find_field(label)['checked']
187
- if field_checked.respond_to? :should
188
- field_checked.should be_false
189
- else
190
- assert !field_checked
191
- end
192
- end
193
- end
194
-
195
- Then /^(?:|I )should be on (.+)$/ do |page_name|
196
- current_path = URI.parse(current_url).path
197
- if current_path.respond_to? :should
198
- current_path.should == path_to(page_name)
199
- else
200
- assert_equal path_to(page_name), current_path
201
- end
202
- end
203
-
204
- Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
205
- query = URI.parse(current_url).query
206
- actual_params = query ? CGI.parse(query) : {}
207
- expected_params = {}
208
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
209
-
210
- if actual_params.respond_to? :should
211
- actual_params.should == expected_params
212
- else
213
- assert_equal expected_params, actual_params
214
- end
215
- end
216
-
217
- Then /^show me the page$/ do
218
- save_and_open_page
219
- end
@@ -1,53 +0,0 @@
1
- # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
- # It is recommended to regenerate this file in the future when you upgrade to a
3
- # newer version of cucumber-rails. Consider adding your own code to a new file
4
- # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
- # files.
6
-
7
- require 'rubygems'
8
- require 'spork'
9
-
10
- Spork.prefork do
11
- ENV["RAILS_ENV"] ||= "test"
12
- require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
13
-
14
- require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
15
- require 'cucumber/rails/rspec'
16
- require 'cucumber/rails/world'
17
- require 'cucumber/web/tableish'
18
-
19
-
20
- require 'capybara/rails'
21
- require 'capybara/cucumber'
22
- require 'capybara/session'
23
- # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
24
- # order to ease the transition to Capybara we set the default here. If you'd
25
- # prefer to use XPath just remove this line and adjust any selectors in your
26
- # steps to use the XPath syntax.
27
- Capybara.default_selector = :css
28
-
29
- require 'factory_girl/step_definitions'
30
-
31
- #Load Noodall specific stuff
32
- require 'noodall/permalinks'
33
- World(Noodall::Permalinks)
34
- end
35
-
36
- Spork.each_run do
37
- # If you set this to false, any error raised from within your app will bubble
38
- # up to your step definition and out to cucumber unless you catch it somewhere
39
- # on the way. You can make Rails rescue errors and render error pages on a
40
- # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
41
- #
42
- # If you set this to true, Rails will rescue all errors and render error
43
- # pages, more or less in the same way your application would behave in the
44
- # default production environment. It's not recommended to do this for all
45
- # of your scenarios, as this makes it hard to discover errors in your application.
46
- ActionController::Base.allow_rescue = false
47
-
48
- # How to clean your database when transactions are turned off. See
49
- # http://github.com/bmabey/database_cleaner for more info.
50
- require 'database_cleaner'
51
- require 'database_cleaner/cucumber'
52
- DatabaseCleaner.strategy = :truncation
53
- end
@@ -1,35 +0,0 @@
1
- module NavigationHelpers
2
- # Maps a name to a path. Used by the
3
- #
4
- # When /^I go to (.+)$/ do |page_name|
5
- #
6
- # step definition in web_steps.rb
7
- #
8
- def path_to(page_name)
9
- case page_name
10
-
11
- when /the (website|home\s?page)/
12
- home = Home.create(:title => 'Home', :publish => true, :body => "Welcome")
13
- '/'
14
- when /the sign in page/
15
- new_user_session_path
16
- # Add more mappings here.
17
- # Here is an example that pulls values out of the Regexp:
18
- #
19
- # when /^(.*)'s profile page$/i
20
- # user_profile_path(User.find_by_login($1))
21
-
22
- else
23
- begin
24
- page_name =~ /the (.*) page/
25
- path_components = $1.split(/\s+/)
26
- self.send(path_components.push('path').join('_').to_sym)
27
- rescue Object => e
28
- raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
29
- "Now, go and add a mapping in #{__FILE__}"
30
- end
31
- end
32
- end
33
- end
34
-
35
- World(NavigationHelpers)
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
4
- if vendored_cucumber_bin
5
- load File.expand_path(vendored_cucumber_bin)
6
- else
7
- require 'rubygems' unless ENV['NO_RUBYGEMS']
8
- require 'cucumber'
9
- load Cucumber::BINARY
10
- end