adva-core 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ source :rubygems
2
+
3
+ gem 'adva-core'
4
+ gem 'adva-blog'
5
+ gem 'adva-cache'
6
+ gem 'adva-categories'
7
+ gem 'adva-static'
8
+ gem 'adva-user'
9
+ gem 'adva-markup'
10
+
11
+ group :test do
12
+ gem 'sqlite3-ruby', '1.2.5'
13
+ gem 'cucumber', '0.9.4'
14
+ gem 'cucumber-rails', '0.3.2'
15
+ gem 'webrat', '0.7.2'
16
+ gem 'thor'
17
+ gem 'ruby-debug'
18
+ gem 'mocha'
19
+ gem 'fakefs', :require => 'fakefs/safe'
20
+ gem 'test_declarative'
21
+ gem 'database_cleaner', '0.5.2'
22
+ gem 'launchy'
23
+ gem 'factory_girl', '1.3.2'
24
+ end
@@ -1,3 +1,3 @@
1
1
  copy_file config[:source].join('lib/bundler/repository.rb'), "#{app_path}/lib/bundler/repository.rb"
2
- copy_file config[:source].join('Gemfile'), "#{app_path}/Gemfile"
3
- remove_file 'public/index.html'
2
+ copy_file config[:source].join('adva-core/lib/adva/generators/templates/app/Gemfile'), "#{app_path}/Gemfile"
3
+ remove_file 'public/index.html'
@@ -6,15 +6,15 @@ module Adva
6
6
  def instance
7
7
  @@instance ||= new
8
8
  end
9
-
9
+
10
10
  def get(*args)
11
11
  instance.get(*args)
12
12
  end
13
-
13
+
14
14
  def set(*args)
15
15
  instance.set(*args)
16
16
  end
17
-
17
+
18
18
  def clear
19
19
  instance.clear
20
20
  end
@@ -40,18 +40,18 @@ module Adva
40
40
  end
41
41
 
42
42
  def get(*keys)
43
- keys.map { |key| key.to_sym }.inject(self) do |result, key|
43
+ keys.map { |key| key.to_sym }.inject(self) do |result, key|
44
44
  return nil unless result.has_key?(key)
45
45
  result[key]
46
46
  end
47
47
  end
48
-
48
+
49
49
  protected
50
-
50
+
51
51
  def merge!(other)
52
52
  other.each { |key, value| self[key] = value }
53
53
  end
54
-
54
+
55
55
  def to_registry(hash)
56
56
  hash.inject(Registry.new) do |registry, (key, value)|
57
57
  registry[key.to_sym] = value.is_a?(Hash) ? to_registry(value) : value
@@ -59,4 +59,4 @@ module Adva
59
59
  end
60
60
  end
61
61
  end
62
- end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module AdvaCore
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,8 +1,6 @@
1
- def assert_email_sent(attributes)
2
- emails = ::ActionMailer::Base.deliveries
3
- assert !emails.empty?, "No emails were sent"
4
- matching_emails = emails.select do |email|
5
- attributes.all? do |name, value|
1
+ def emails_for_assertion(attributes)
2
+ ::ActionMailer::Base.deliveries.select do |email|
3
+ attributes.all? do |name, value|
6
4
  case name
7
5
  when 'body'
8
6
  value.split(',').map(&:strip).all? { |value| email.body.include?(value) }
@@ -11,9 +9,23 @@ def assert_email_sent(attributes)
11
9
  end
12
10
  end
13
11
  end
14
- assert !matching_emails.empty?, begin
12
+ end
13
+
14
+ def assert_email_sent(attributes)
15
+ emails = ::ActionMailer::Base.deliveries
16
+ assert !emails.empty?, "No emails were sent"
17
+ assert !emails_for_assertion(attributes).empty?, begin
15
18
  msg = ["None of the #{emails.size} emails matched #{attributes.inspect}.\nInstead, there are the following emails:"]
16
19
  msg += emails.map { |email| attributes.keys.map { |key| [key, email.send(key)] }.map { |key, value| "#{key}: #{value}" }.join(',') }
17
20
  msg.join("\n")
18
21
  end
19
- end
22
+ end
23
+
24
+ def assert_no_email_sent(attributes = {})
25
+ if attributes.empty?
26
+ assert ::ActionMailer::Base.deliveries.empty?
27
+ else
28
+ assert emails_for_assertion(attributes).empty?, "Expected none of the emails to match #{attributes.inspect}, but one did."
29
+ end
30
+ end
31
+
@@ -114,9 +114,9 @@ Then /^I should (not )?see a ([a-z ]+ )?row (?:of the ([a-z ]+) table )?where "(
114
114
  xpath_result = body.xpath("//#{table_xpath}/descendant::td[@headers='#{header_id}'][normalize-space(text())='#{cell_content}']/#{tr_xpath}/@id")
115
115
 
116
116
  if optional_not.present?
117
- assert xpath_result.empty?, 'should not find a row'
117
+ assert xpath_result.empty?, "Expected not find a row where #{header.inspect} is #{cell_content}."
118
118
  else
119
- assert xpath_result.any?, 'should find at least one row'
119
+ assert xpath_result.any?, "Expected to find at least one row where #{header.inspect} is #{cell_content}."
120
120
  end
121
121
  end
122
122
 
@@ -258,6 +258,10 @@ Then /^the following emails should have been sent:$/ do |expected_emails|
258
258
  end
259
259
  end
260
260
 
261
+ Then /^no emails should have been sent$/ do
262
+ assert_no_email_sent
263
+ end
264
+
261
265
  Then /^"([^"]*)" should be filled in with "([^"]*)"$/ do |field, value|
262
266
  field = webrat.field_labeled(field)
263
267
  assert_equal value, field.value
@@ -44,7 +44,7 @@ end
44
44
  # | Note | Nice guy |
45
45
  # | Wants Email? | |
46
46
  #
47
- When /^(?:|I )fill in the following:$/ do |fields|
47
+ When /^(?:|I )fill in the following:?$/ do |fields|
48
48
  fields.rows_hash.each do |name, value|
49
49
  step = case webrat.field_labeled(name)
50
50
  when Webrat::TextField, Webrat::TextareaField, Webrat::PasswordField
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ingo Weiss
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-12-18 00:00:00 +01:00
19
+ date: 2011-01-14 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -139,12 +139,12 @@ dependencies:
139
139
  requirements:
140
140
  - - "="
141
141
  - !ruby/object:Gem::Version
142
- hash: 51
142
+ hash: 47
143
143
  segments:
144
144
  - 0
145
145
  - 0
146
- - 22
147
- version: 0.0.22
146
+ - 24
147
+ version: 0.0.24
148
148
  type: :runtime
149
149
  version_requirements: *id008
150
150
  - !ruby/object:Gem::Dependency
@@ -187,12 +187,12 @@ dependencies:
187
187
  requirements:
188
188
  - - "="
189
189
  - !ruby/object:Gem::Version
190
- hash: 7
190
+ hash: 3
191
191
  segments:
192
192
  - 0
193
193
  - 0
194
- - 12
195
- version: 0.0.12
194
+ - 14
195
+ version: 0.0.14
196
196
  type: :runtime
197
197
  version_requirements: *id011
198
198
  - !ruby/object:Gem::Dependency
@@ -362,6 +362,7 @@ files:
362
362
  - lib/adva/generators/templates/engine/redirects.rb.erb
363
363
  - lib/adva/generators/templates/engine/Gemfile.erb
364
364
  - lib/adva/generators/templates/engine/all.rb
365
+ - lib/adva/generators/templates/app/Gemfile
365
366
  - lib/adva/generators/templates/app/app_template.rb
366
367
  - lib/adva/generators/engine.rb
367
368
  - lib/adva/responder/redirect.rb