watirmark 5.14.16

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.
Files changed (106) hide show
  1. data/app_generators/create_project/create_project_generator.rb +115 -0
  2. data/app_generators/create_project/templates/features/env.rb.erb +8 -0
  3. data/app_generators/create_project/templates/features/model_steps.rb.erb +9 -0
  4. data/app_generators/create_project/templates/features/post_error_steps.rb.erb +15 -0
  5. data/app_generators/create_project/templates/features/sample.feature.erb +5 -0
  6. data/app_generators/create_project/templates/features/site_steps.rb.erb +7 -0
  7. data/app_generators/create_project/templates/generators/controller.rb.erb +9 -0
  8. data/app_generators/create_project/templates/generators/generate.rb.erb +9 -0
  9. data/app_generators/create_project/templates/generators/model.rb.erb +7 -0
  10. data/app_generators/create_project/templates/generators/mvc_generator.rb.erb +100 -0
  11. data/app_generators/create_project/templates/generators/rbeautify.rb.erb +212 -0
  12. data/app_generators/create_project/templates/generators/view.rb.erb +16 -0
  13. data/app_generators/create_project/templates/generators/workflow_loader.rb.erb +1 -0
  14. data/app_generators/create_project/templates/library/base_controller.rb.erb +9 -0
  15. data/app_generators/create_project/templates/library/base_view.rb.erb +6 -0
  16. data/app_generators/create_project/templates/library/configuration.rb.erb +6 -0
  17. data/app_generators/create_project/templates/library/core_libraries.rb.erb +9 -0
  18. data/app_generators/create_project/templates/library/loader.rb.erb +23 -0
  19. data/app_generators/create_project/templates/library/page_load_checker.rb.erb +11 -0
  20. data/app_generators/create_project/templates/library/post_errors_checker.rb.erb +23 -0
  21. data/app_generators/create_project/templates/library/project_require_file.rb.erb +8 -0
  22. data/app_generators/create_project/templates/library/search_controller.rb.erb +12 -0
  23. data/app_generators/create_project/templates/library/workflows.rb.erb +0 -0
  24. data/app_generators/create_project/templates/project/config.yml.erb +3 -0
  25. data/app_generators/create_project/templates/project/gemfile.rb.erb +11 -0
  26. data/app_generators/create_project/templates/project/rakefile.rb.erb +21 -0
  27. data/bin/etapestry/Gemfile +11 -0
  28. data/bin/etapestry/config.yml +3 -0
  29. data/bin/etapestry/features/etapestry_home.feature +5 -0
  30. data/bin/etapestry/features/step_definitions/model_steps.rb +9 -0
  31. data/bin/etapestry/features/step_definitions/post_error_steps.rb +15 -0
  32. data/bin/etapestry/features/step_definitions/site_steps.rb +7 -0
  33. data/bin/etapestry/features/support/env.rb +8 -0
  34. data/bin/etapestry/generators/mvc/mvc_generator.rb +100 -0
  35. data/bin/etapestry/generators/mvc/rbeautify.rb +212 -0
  36. data/bin/etapestry/generators/mvc/templates/controller.rb.erb +9 -0
  37. data/bin/etapestry/generators/mvc/templates/model.rb.erb +7 -0
  38. data/bin/etapestry/generators/mvc/templates/view.rb.erb +16 -0
  39. data/bin/etapestry/generators/mvc/templates/workflow_loader.rb.erb +1 -0
  40. data/bin/etapestry/lib/etapestry.rb +8 -0
  41. data/bin/etapestry/lib/etapestry/checkers/page_load_checker.rb +11 -0
  42. data/bin/etapestry/lib/etapestry/checkers/post_errors_checker.rb +23 -0
  43. data/bin/etapestry/lib/etapestry/configuration.rb +6 -0
  44. data/bin/etapestry/lib/etapestry/core_libraries.rb +9 -0
  45. data/bin/etapestry/lib/etapestry/loader.rb +23 -0
  46. data/bin/etapestry/lib/etapestry/site/base_controller.rb +9 -0
  47. data/bin/etapestry/lib/etapestry/site/base_view.rb +6 -0
  48. data/bin/etapestry/lib/etapestry/site/search_controller.rb +12 -0
  49. data/bin/etapestry/lib/etapestry/workflows.rb +0 -0
  50. data/bin/etapestry/rakefile.rb +21 -0
  51. data/bin/etapestry/script/generate.rb +9 -0
  52. data/bin/twitter/features/hashtag_search.feature +93 -0
  53. data/bin/twitter/features/step_definitions/hashtag_steps.rb +9 -0
  54. data/bin/twitter/lib/twitter/workflows/search/result_controller.rb +13 -0
  55. data/bin/twitter/lib/twitter/workflows/search/result_model.rb +5 -0
  56. data/bin/twitter/lib/twitter/workflows/search/result_view.rb +19 -0
  57. data/bin/watirmark +10 -0
  58. data/lib/watirmark.rb +26 -0
  59. data/lib/watirmark/at_exit.rb +13 -0
  60. data/lib/watirmark/configuration.rb +201 -0
  61. data/lib/watirmark/controller/actions.rb +172 -0
  62. data/lib/watirmark/controller/assertions.rb +116 -0
  63. data/lib/watirmark/controller/controller.rb +191 -0
  64. data/lib/watirmark/controller/dialogs.rb +33 -0
  65. data/lib/watirmark/controller/matcher.rb +19 -0
  66. data/lib/watirmark/cucumber/cuke_helper.rb +150 -0
  67. data/lib/watirmark/cucumber/email_helper.rb +103 -0
  68. data/lib/watirmark/cucumber/env.rb +9 -0
  69. data/lib/watirmark/cucumber/hooks.rb +16 -0
  70. data/lib/watirmark/cucumber/model_helper.rb +34 -0
  71. data/lib/watirmark/cucumber/transforms.rb +55 -0
  72. data/lib/watirmark/exceptions.rb +15 -0
  73. data/lib/watirmark/extensions/ruby_extensions.rb +129 -0
  74. data/lib/watirmark/extensions/webdriver_extensions.rb +150 -0
  75. data/lib/watirmark/formatters/snapshot_formatter.rb +23 -0
  76. data/lib/watirmark/loader.rb +87 -0
  77. data/lib/watirmark/model.rb +3 -0
  78. data/lib/watirmark/models/cucumber_helper.rb +49 -0
  79. data/lib/watirmark/models/debug_methods.rb +21 -0
  80. data/lib/watirmark/models/default_values.rb +21 -0
  81. data/lib/watirmark/models/factory.rb +168 -0
  82. data/lib/watirmark/models/factory_method_generators.rb +84 -0
  83. data/lib/watirmark/models/factory_methods.rb +72 -0
  84. data/lib/watirmark/models/trait.rb +35 -0
  85. data/lib/watirmark/models/upload_csv.rb +24 -0
  86. data/lib/watirmark/page/keyed_element.rb +63 -0
  87. data/lib/watirmark/page/page.rb +50 -0
  88. data/lib/watirmark/page/page_definition.rb +187 -0
  89. data/lib/watirmark/page/process_page.rb +112 -0
  90. data/lib/watirmark/page/radio_maps.rb +53 -0
  91. data/lib/watirmark/profile.rb +22 -0
  92. data/lib/watirmark/rake/smoketest.rb +17 -0
  93. data/lib/watirmark/screenshot.rb +127 -0
  94. data/lib/watirmark/session.rb +115 -0
  95. data/lib/watirmark/version.rb +5 -0
  96. data/spec/assertions_spec.rb +95 -0
  97. data/spec/config_spec.rb +82 -0
  98. data/spec/controller_actions_spec.rb +91 -0
  99. data/spec/controller_spec.rb +426 -0
  100. data/spec/controllers_and_models_spec.rb +52 -0
  101. data/spec/model_factory_spec.rb +568 -0
  102. data/spec/model_traits_spec.rb +141 -0
  103. data/spec/page_spec.rb +127 -0
  104. data/spec/process_page_spec.rb +163 -0
  105. data/spec/spec_helper.rb +17 -0
  106. metadata +238 -0
@@ -0,0 +1,127 @@
1
+ require 'watirmark/configuration'
2
+ Watirmark::Configuration.instance.defaults = {:create_master_snapshots => false}
3
+
4
+ module Watirmark
5
+ module Screenshot
6
+
7
+ class << self
8
+ def take
9
+ CurrentScreenShots.new
10
+ end
11
+
12
+ def compare_screenshots(masters, currents)
13
+ raise ArgumentError, "Passed invalid arguments to compare_screenshots" unless masters.kind_of?(MasterAlbum) && currents.kind_of?(CurrentScreenShots)
14
+
15
+ if Watirmark::Configuration.instance.snapshotwidth.kind_of?(Fixnum)
16
+ compare_specific_screenshot_size(currents, masters)
17
+ else
18
+ compare_standard_screenshot_sizes(currents, masters)
19
+ end
20
+ end
21
+
22
+ def compare_specific_screenshot_size(currents, masters)
23
+ unless currents.screenshots.md5 == masters.album.md5
24
+ report_failure(currents.screenshots.filename, masters.album.filename)
25
+ end
26
+ end
27
+
28
+ def compare_standard_screenshot_sizes(currents, masters)
29
+ masters.album.each_with_index do |master, index|
30
+ unless currents.screenshots[index].md5 == master.md5
31
+ report_failure(currents.screenshots[index].filename, masters.filename)
32
+ end
33
+ end
34
+ end
35
+
36
+ def report_failure(current, master)
37
+ Watirmark.logger.info "Checking Snapshot:\n master: #{master}\n screenshot: #{current}"
38
+ raise ArgumentError, "Master snapshot: #{File.expand_path(master)} does not match current snapshot: #{File.expand_path(current)}"
39
+ end
40
+ end
41
+
42
+ class CurrentScreenShots
43
+ attr_accessor :screenshots
44
+
45
+ def initialize
46
+ if Watirmark::Configuration.instance.snapshotwidth.kind_of?(Fixnum)
47
+ @screenshots = Current.new
48
+ else
49
+ widths = Watirmark::Configuration.instance.snapshotwidth.split(",").map {|s| s.to_i}
50
+ @screenshots = []
51
+ widths.each {|width| @screenshots << Current.new(width) }
52
+ end
53
+ end
54
+ end
55
+
56
+ class MasterAlbum
57
+ attr_accessor :album
58
+
59
+ def initialize(filename, screenshot)
60
+ if Watirmark::Configuration.instance.snapshotwidth.kind_of?(Fixnum)
61
+ @album = Master.new(filename, screenshot.screenshots)
62
+ else
63
+ widths = Watirmark::Configuration.instance.snapshotwidth.split(",").map {|s| s.to_i}
64
+ @album = []
65
+ widths.each_with_index do |width, index|
66
+ @album << Master.new(filename.sub(/\.png/, "_width_#{width}.png"), screenshot.screenshots[index])
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ class Current
73
+ attr_accessor :filename, :screenwidth, :screenheight
74
+
75
+ def initialize(snapshotwidth=Watirmark::Configuration.instance.snapshotwidth)
76
+ get_screen_size
77
+ FileUtils.mkdir_p('reports/screenshots')
78
+ take_screen_shot(snapshotwidth)
79
+ revert_window_size
80
+ end
81
+
82
+ def take_screen_shot(snapshotwidth)
83
+ update_window_size(snapshotwidth)
84
+ @filename = "reports/screenshots/#{UUID.new.generate(:compact)}.png"
85
+ focus_browser
86
+ Page.browser.screenshot.save @filename
87
+ end
88
+
89
+ def md5
90
+ Digest::MD5.hexdigest(File.read(@filename))
91
+ end
92
+
93
+ def update_window_size(width)
94
+ Page.browser.window.resize_to(width, Watirmark::Configuration.instance.snapshotheight)
95
+ end
96
+
97
+ def get_screen_size
98
+ size = Page.browser.window.size
99
+ @screenwidth = size.width
100
+ @screenheight = size.height
101
+ end
102
+
103
+ def revert_window_size
104
+ Page.browser.window.resize_to(@screenwidth, @screenheight)
105
+ end
106
+
107
+ def focus_browser
108
+ Page.browser.element.click
109
+ end
110
+ end
111
+
112
+ class Master < Current
113
+ def initialize(filename, screenshot)
114
+ @filename = filename
115
+ update(screenshot) if Watirmark::Configuration.instance.create_master_snapshots
116
+ end
117
+
118
+ def update(screenshot)
119
+ FileUtils.mkdir_p(File.dirname(@filename))
120
+ File.unlink(@filename) if File.exists?(@filename)
121
+ FileUtils.copy_file(screenshot.filename, @filename)
122
+ Watirmark.logger.info "Created new master: #@filename"
123
+ end
124
+ end
125
+ end
126
+ end
127
+
@@ -0,0 +1,115 @@
1
+ module Watirmark
2
+
3
+ # This functionality allows us to ignore and buffer
4
+ # post failures and then compare on a cucumber step
5
+ module CucumberPostFailureBuffering
6
+ @@buffer_post_failure = false
7
+
8
+ def post_failure
9
+ @@post_failure
10
+ end
11
+
12
+ def post_failure=(x)
13
+ @@post_failure = x
14
+ end
15
+
16
+ def buffer_post_failure
17
+ @@buffer_post_failure
18
+ end
19
+
20
+ def catch_post_failures(&block)
21
+ @@post_failure = nil
22
+ @@buffer_post_failure = true
23
+ block.call
24
+ @@buffer_post_failure = false
25
+ @@post_failure
26
+ end
27
+ end
28
+
29
+ class Session
30
+ include Singleton
31
+ include CucumberPostFailureBuffering
32
+
33
+ POST_WAIT_CHECKERS = []
34
+
35
+ def browser
36
+ Page.browser
37
+ end
38
+
39
+ def browser=(x)
40
+ Page.browser = x
41
+ end
42
+
43
+ def config
44
+ Watirmark::Configuration.instance
45
+ end
46
+
47
+ # set up the global variables, reading from the config file
48
+ def initialize
49
+ Watirmark.add_exit_task {
50
+ closebrowser if config.closebrowseronexit
51
+ }
52
+ config.firefox_profile = default_firefox_profile if config.webdriver.to_s == 'firefox'
53
+ end
54
+
55
+ def default_firefox_profile
56
+ if Configuration.instance.default_firefox_profile
57
+ Watirmark.logger.info "Using firefox profile: #{Configuration.instance.default_firefox_profile}"
58
+ profile = Selenium::WebDriver::Firefox::Profile.from_name Configuration.instance.default_firefox_profile
59
+ else
60
+ profile = Selenium::WebDriver::Firefox::Profile.new
61
+ end
62
+ profile.native_events = false
63
+ if Configuration.instance.projectpath
64
+ download_directory = File.join(Configuration.instance.projectpath, "reports", "downloads")
65
+ download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
66
+ profile['browser.download.folderList'] = 2 # custom location
67
+ profile['browser.download.dir'] = download_directory
68
+ profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
69
+ end
70
+ profile
71
+ end
72
+
73
+ def newsession
74
+ closebrowser
75
+ openbrowser
76
+ end
77
+
78
+ def openbrowser
79
+ Page.browser = new_watir_browser
80
+ initialize_page_checkers
81
+ initialize_screenshots
82
+ Page.browser
83
+ end
84
+
85
+ def closebrowser
86
+ begin
87
+ Page.browser.close
88
+ rescue Errno::ECONNREFUSED
89
+ # browser already closed or unavailable
90
+ ensure
91
+ Page.browser = nil
92
+ end
93
+ end
94
+
95
+ private
96
+
97
+ def new_watir_browser
98
+ config.webdriver ||= :firefox
99
+ if config.webdriver.to_sym == :firefox
100
+ Watir::Browser.new config.webdriver.to_sym, :profile => config.firefox_profile
101
+ else
102
+ Watir::Browser.new config.webdriver.to_sym
103
+ end
104
+ end
105
+
106
+ def initialize_screenshots
107
+ Page.browser.screenshot.base64
108
+ end
109
+
110
+ def initialize_page_checkers
111
+ POST_WAIT_CHECKERS.each { |p| Page.browser.add_checker p }
112
+ end
113
+
114
+ end
115
+ end
@@ -0,0 +1,5 @@
1
+ module Watirmark
2
+ module Version
3
+ STRING = '5.14.16'
4
+ end
5
+ end
@@ -0,0 +1,95 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Watirmark::Assertions do
4
+ include Watirmark::Assertions
5
+
6
+ it 'can compare simple elements' do
7
+ element = stub(:exists? => true, :value => 'giant vampire squid', :radio_map => nil)
8
+ assert_equal element, 'giant vampire squid'
9
+ end
10
+
11
+ it 'compare integer' do
12
+ element = stub(:exists? => true, :value => '100')
13
+ assert_equal element, 100
14
+ end
15
+
16
+ it 'compare string integer' do
17
+ element = stub(:exists? => true, :value => '100')
18
+ assert_equal element, '100'
19
+ end
20
+
21
+ it 'expecting value with with percent' do
22
+ element = stub(:exists? => true, :value => '100%')
23
+ assert_equal element, '100%'
24
+ end
25
+
26
+ it 'expecting value with with a currency symbol' do
27
+ element = stub(:exists? => true, :value => '$123.45')
28
+ assert_equal element, '$123.45'
29
+ end
30
+
31
+ it 'expecting integer value should strip the dollar sign' do
32
+ element = stub(:exists? => true, :value => '$25')
33
+ assert_equal element, '25'
34
+ assert_equal element, '$25'
35
+ lambda { assert_equal element, '25%' }.should raise_error
36
+ end
37
+
38
+ it 'symbol in wrong place needs to match exactly or fail' do
39
+ element = stub(:exists? => true, :value => '25$')
40
+ lambda { assert_equal element, '$25' }.should raise_error
41
+ assert_equal element, '25$'
42
+
43
+ element = stub(:exists? => true, :value => '%50')
44
+ lambda { assert_equal element, '50%' }.should raise_error
45
+ lambda { assert_equal element, '50' }.should raise_error
46
+ assert_equal element, '%50'
47
+ end
48
+
49
+ it 'should detect two different numbers are different' do
50
+ element = stub(:exists? => true, :value => '50')
51
+ lambda { assert_equal element, '51' }.should raise_error
52
+ lambda { assert_equal element, '50.1' }.should raise_error
53
+ lambda { assert_equal element, 49.9 }.should raise_error
54
+ lambda { assert_equal element, 49 }.should raise_error
55
+ assert_equal element, 50.0
56
+ end
57
+
58
+ it 'should let a number match a number with a $ before or % after' do
59
+ element = stub(:exists? => true, :value => '$26', :name => 'unittest')
60
+ assert_equal element, 26
61
+ element = stub(:exists? => true, :value => '27%', :name => 'unittest')
62
+ assert_equal element, 27.00
63
+ end
64
+
65
+ it 'should let a number in a string match a number with currency or percent' do
66
+ element = stub(:exists? => true, :value => '$36', :name => 'unittest')
67
+ assert_equal element, '36'
68
+ element = stub(:exists? => true, :value => '37%', :name => 'unittest')
69
+ assert_equal element, '37.00'
70
+ end
71
+
72
+ end
73
+
74
+ describe "normalize_values" do
75
+ include Watirmark::Assertions
76
+
77
+ specify 'normalize dates' do
78
+ normalize_value("1/1/2012").should == Date.parse('1/1/2012')
79
+ normalize_value("1/1/09").should == Date.parse('1/1/09')
80
+ normalize_value("01/1/09").should == Date.parse('1/1/09')
81
+ normalize_value("01/01/09").should == Date.parse('1/1/09')
82
+ end
83
+ specify 'normalize whitespace' do
84
+ normalize_value(" a").should == "a"
85
+ normalize_value("a ").should == "a"
86
+ normalize_value("a\n").should == "a"
87
+ normalize_value("\na").should == "a"
88
+ normalize_value(" a \nb").should == "a \nb"
89
+ normalize_value(" a \r\nb").should == "a \nb"
90
+ normalize_value(" a \nb\n").should == "a \nb"
91
+ end
92
+ specify 'do not normalize string of spaces' do
93
+ normalize_value(' ').should == ' '
94
+ end
95
+ end
@@ -0,0 +1,82 @@
1
+ require_relative 'spec_helper'
2
+
3
+ shared_examples_for "configuration_file" do
4
+ specify 'string' do
5
+ @config.string.should == "foo"
6
+ end
7
+
8
+ specify 'true_boolean' do
9
+ @config.true_boolean.should be_true
10
+ end
11
+
12
+ specify 'false_boolean' do
13
+ @config.false_boolean.should be_false
14
+ end
15
+
16
+ specify 'symbol' do
17
+ @config.symbol.should == :foo
18
+ end
19
+
20
+ specify 'integer' do
21
+ @config.integer.should == 3
22
+ end
23
+
24
+ specify 'float' do
25
+ @config.float.should == 1.2
26
+ end
27
+ end
28
+
29
+ describe "text file" do
30
+ it_behaves_like "configuration_file"
31
+
32
+ before :all do
33
+ @config = Watirmark::Configuration.instance
34
+ @config.reset
35
+ @config.configfile = File.dirname(__FILE__) + '/configurations/config.txt'
36
+ @config.read_from_file
37
+ end
38
+ end
39
+
40
+ describe "yaml file" do
41
+ it_behaves_like "configuration_file"
42
+
43
+ before :all do
44
+ @config = Watirmark::Configuration.instance
45
+ @config.reset
46
+ @config.configfile = File.dirname(__FILE__) + '/configurations/config.yml'
47
+ @config.read_from_file
48
+ end
49
+ end
50
+
51
+ describe "configuration" do
52
+ before :all do
53
+ @config = Watirmark::Configuration.instance
54
+ @config.reset
55
+ @config.reload
56
+ end
57
+
58
+ specify 'add defaults' do
59
+ @config.email.should == 'devnull'
60
+ @config.webdriver.should == 'firefox'
61
+ @config.defaults = {:email => 'email-changed'}
62
+ @config.email.should == 'email-changed'
63
+ @config.webdriver.should == 'firefox'
64
+ end
65
+
66
+ specify 'inspect' do
67
+ @config.inspect.should =~ /^{.+}/
68
+ end
69
+
70
+ specify 'override how a setting is set' do
71
+ module Watirmark
72
+ class Configuration
73
+ def hostname_value(hostname)
74
+ hostname + '/test'
75
+ end
76
+ end
77
+ end
78
+ Watirmark::Configuration.instance.hostname = 'www.convio.com'
79
+ Watirmark::Configuration.instance.hostname.should == 'www.convio.com/test'
80
+ end
81
+
82
+ end
@@ -0,0 +1,91 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Watirmark::Actions do
4
+ before :all do
5
+ class ActionView < Page
6
+ private_keyword(:a)
7
+ private_keyword(:b)
8
+ end
9
+
10
+ class ActionController < Watirmark::WebPage::Controller
11
+ @view = ActionView
12
+
13
+ def create
14
+ end
15
+
16
+ def edit
17
+ end
18
+
19
+ def before_all
20
+ end
21
+
22
+ def before_each
23
+ end
24
+
25
+ def after_each
26
+ end
27
+
28
+ def after_all
29
+ end
30
+ end
31
+
32
+ class ActionModel < Watirmark::Model::Factory
33
+ keywords :a, :b
34
+ defaults do
35
+ a {1}
36
+ b {2}
37
+ end
38
+ end
39
+ end
40
+
41
+ before :each do
42
+ @controller = ActionController.new(ActionModel.new)
43
+ end
44
+
45
+ it 'before and after' do
46
+ @controller.expects(:before_all).once
47
+ @controller.expects(:after_all).once
48
+ @controller.run :create
49
+ end
50
+
51
+ it 'before_each and after_each' do
52
+ @controller.expects(:before_each).once
53
+ @controller.expects(:after_each).once
54
+ @controller.run :create
55
+ end
56
+
57
+ it 'before_each and after_each with multiple methods passed to run' do
58
+ @controller.expects(:before_each).twice
59
+ @controller.expects(:after_each).twice
60
+ @controller.run :create, :edit
61
+ end
62
+
63
+ it 'use hashes instead of models' do
64
+ controller = ActionController.new(a: 1, b: 2)
65
+ controller.expects(:before_each).once
66
+ controller.expects(:after_each).once
67
+ controller.run :create
68
+ end
69
+
70
+ it 'records should be processed separately' do
71
+ controller = ActionController.new
72
+ controller.records << {a:1, b:2}
73
+ controller.records << {c:3, d:4}
74
+ controller.expects(:before_all).once
75
+ controller.expects(:after_all).once
76
+ controller.expects(:before_each).twice
77
+ controller.expects(:after_each).twice
78
+ controller.run :create
79
+ end
80
+
81
+ it 'records should be cleared after run' do
82
+ controller = ActionController.new
83
+ controller.records.should == []
84
+ controller.records << {a:1, b:2}
85
+ controller.records << {c:3, d:4}
86
+ controller.records.should == [{a:1, b:2}, {c:3, d:4}]
87
+ controller.run :create
88
+ controller.records.should == []
89
+ end
90
+
91
+ end