fume 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
3
  :minor: 3
4
- :patch: 0
4
+ :patch: 1
5
5
  :major: 0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fume}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sunteya"]
12
- s.date = %q{2009-12-28}
12
+ s.date = %q{2010-01-11}
13
13
  s.email = %q{Sunteya@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README"
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "generators/fume/capify/templates/config/deploy.rb",
26
26
  "generators/fume/fume_generator.rb",
27
27
  "generators/fume/rspec/rspec_gen.rb",
28
+ "generators/fume/rspec/templates/spec/support/erb_macros.rb",
28
29
  "generators/fume/rspec/templates/spec/support/fume_controller_macros.rb",
29
30
  "generators/fume/simple_theme/simple_theme_gen.rb",
30
31
  "generators/fume/simple_theme/templates/public/demo.html",
@@ -0,0 +1,18 @@
1
+ module ErbMacros
2
+ def self.included(base)
3
+ base.send :extend, ClassMethods
4
+ base.send :include, InstanceMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ end
9
+
10
+ module InstanceMethods
11
+ def render_template(template)
12
+ erb = ERB.new(template.read)
13
+ tmp_file = Tempfile.new("erb")
14
+ File.open(tmp_file.path, "wb") { |f| f.write(erb.result(binding)) }
15
+ tmp_file
16
+ end
17
+ end
18
+ end
@@ -24,22 +24,29 @@ module FumeControllerMacros
24
24
  end
25
25
  end
26
26
 
27
+
27
28
  %w{ be_success be_redirect be_invalid }.each do |be_method|
28
- define_method "it_should_#{be_method}_for" do |action_methods, &block|
29
+ eval %Q[
30
+ def it_should_#{be_method}_for(*args, &block)
31
+ options = args.extract_options!() || {}
32
+ action_methods = args.flatten
29
33
  action_methods.each do |action_method|
30
- it "should #{be_method} for #{action_method.method} :#{action_method.action} action" do
34
+ it "should #{be_method} for \#{action_method.method} :\#{action_method.action} action \#{options[:message]}" do
35
+ params = {}
31
36
  if block_given?
32
37
  result = self.instance_exec(&block)
33
38
  params = result if result.is_a? Hash
34
-
35
- self.instance_exec(params, &action_method)
36
- response.should send(be_method)
37
39
  end
40
+
41
+ self.instance_exec(params, &action_method)
42
+ response.should #{be_method}
38
43
  end
39
44
  end
40
45
  end
46
+ ]
41
47
  end
42
48
 
49
+
43
50
  def it_should_be_like_restful_resources(options = {}, &block)
44
51
  actions = [ :index, :new, :create, :show, :edit, :update, :destroy ]
45
52
  actions &= [ options[:only] ].flatten if options[:only]
@@ -50,6 +57,12 @@ module FumeControllerMacros
50
57
  params = instance_exec(&block)
51
58
  end
52
59
  end
60
+
61
+ if actions.include?(:show)
62
+ it_should_be_success_for get(:show) do
63
+ params = instance_exec(&block)
64
+ end
65
+ end
53
66
 
54
67
  if actions.include?(:new)
55
68
  it_should_be_success_for get(:new) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fume
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunteya
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-28 00:00:00 +08:00
12
+ date: 2010-01-11 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -32,6 +32,7 @@ files:
32
32
  - generators/fume/capify/templates/config/deploy.rb
33
33
  - generators/fume/fume_generator.rb
34
34
  - generators/fume/rspec/rspec_gen.rb
35
+ - generators/fume/rspec/templates/spec/support/erb_macros.rb
35
36
  - generators/fume/rspec/templates/spec/support/fume_controller_macros.rb
36
37
  - generators/fume/simple_theme/simple_theme_gen.rb
37
38
  - generators/fume/simple_theme/templates/public/demo.html