gem_suit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +10 -0
  2. data/.suit +4 -0
  3. data/CHANGELOG.rdoc +5 -0
  4. data/Gemfile +3 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.textile +419 -0
  7. data/Rakefile +26 -0
  8. data/VERSION +1 -0
  9. data/bin/suit +10 -0
  10. data/gem_suit.gemspec +26 -0
  11. data/lib/gem_suit/application/actions.rb +203 -0
  12. data/lib/gem_suit/application/test.rb +106 -0
  13. data/lib/gem_suit/application/utils/gemfile.rb +42 -0
  14. data/lib/gem_suit/application/utils.rb +135 -0
  15. data/lib/gem_suit/application.rb +42 -0
  16. data/lib/gem_suit/cli/application/io_buffer.rb +54 -0
  17. data/lib/gem_suit/cli/application/test_loader.rb +5 -0
  18. data/lib/gem_suit/cli/application.rb +159 -0
  19. data/lib/gem_suit/cli/base/shell.rb +41 -0
  20. data/lib/gem_suit/cli/base/utils.rb +83 -0
  21. data/lib/gem_suit/cli/base.rb +15 -0
  22. data/lib/gem_suit/cli/builder/boot +14 -0
  23. data/lib/gem_suit/cli/builder/generator.rb +154 -0
  24. data/lib/gem_suit/cli/builder/rails_app.rb +146 -0
  25. data/lib/gem_suit/cli/builder.rb +143 -0
  26. data/lib/gem_suit/cli/config/hash.rb +61 -0
  27. data/lib/gem_suit/cli/config.rb +37 -0
  28. data/lib/gem_suit/cli.rb +145 -0
  29. data/lib/gem_suit/integration_test.rb +14 -0
  30. data/lib/gem_suit/test_help.rb +17 -0
  31. data/lib/gem_suit/version.rb +9 -0
  32. data/lib/gem_suit.rb +6 -0
  33. data/templates/dynamic/CHANGELOG.rdoc +5 -0
  34. data/templates/dynamic/Gemfile +14 -0
  35. data/templates/dynamic/MIT-LICENSE +20 -0
  36. data/templates/dynamic/README.textile +35 -0
  37. data/templates/dynamic/VERSION +1 -0
  38. data/templates/dynamic/config/boot.rb +13 -0
  39. data/templates/dynamic/config/preinitializer.rb +20 -0
  40. data/templates/dynamic/gitignore +9 -0
  41. data/templates/dynamic/suit/shared/app/views/application/index.html.erb +16 -0
  42. data/templates/dynamic/suit/shared/public/stylesheets/app.css +99 -0
  43. data/templates/dynamic/suit/shared/test/test_helper.rb +37 -0
  44. data/templates/dynamic/suit/templates/shared/Gemfile +14 -0
  45. data/templates/dynamic/suit/templates/shared/config/database-mysql.yml +11 -0
  46. data/templates/dynamic/suit/templates/shared/config/database-sqlite.yml +10 -0
  47. data/templates/static/suit/shared/app/models/.gitkeep +0 -0
  48. data/templates/static/suit/shared/app/views/layouts/application.html.erb +11 -0
  49. data/templates/static/suit/shared/db/schema.rb +2 -0
  50. data/templates/static/suit/shared/db/seeds.rb +7 -0
  51. data/templates/static/suit/shared/test/fixtures/.gitkeep +0 -0
  52. data/templates/static/suit/shared/test/integration/suit/example.rb +40 -0
  53. data/templates/static/suit/shared/test/suit_application/capybara_extensions.rb +36 -0
  54. data/templates/static/suit/shared/test/suit_application.rb +27 -0
  55. data/templates/static/suit/shared/test/unit/.gitkeep +0 -0
  56. data/templates/static/suit/templates/shared/config/initializers/.gitkeep +0 -0
  57. data/templates/static/suit/templates/shared/db/schema.rb +2 -0
  58. metadata +188 -0
@@ -0,0 +1,37 @@
1
+ require "rubygems"
2
+ require "gem_suit/test_help"
3
+
4
+ class ActiveSupport::TestCase
5
+ # Transactional fixtures accelerate your tests by wrapping each test method
6
+ # in a transaction that's rolled back on completion. This ensures that the
7
+ # test database remains unchanged so your fixtures don't have to be reloaded
8
+ # between every test method. Fewer database queries means faster tests.
9
+ #
10
+ # Read Mike Clark's excellent walkthrough at
11
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
12
+ #
13
+ # Every Active Record database supports transactions except MyISAM tables
14
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
15
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
16
+ # is recommended.
17
+ #
18
+ # The only drawback to using transactional fixtures is when you actually
19
+ # need to test transactions. Since your test is bracketed by a transaction,
20
+ # any transactions started in your code will be automatically rolled back.
21
+ self.use_transactional_fixtures = true
22
+
23
+ # Instantiated fixtures are slow, but give you @david where otherwise you
24
+ # would need people(:david). If you don't want to migrate your existing
25
+ # test cases which use the @david style and don't mind the speed hit (each
26
+ # instantiated fixtures translates to a database query per test method),
27
+ # then set this back to true.
28
+ self.use_instantiated_fixtures = false
29
+
30
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
31
+ #
32
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
33
+ # -- they do not yet inherit this setting
34
+ fixtures :all
35
+
36
+ # Add more helper methods to be used by all tests here...
37
+ end
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "<%%= rails_gem_version %>"
4
+ gem "sqlite3-ruby", :require => "sqlite3"
5
+
6
+ gem "<%= gem_name %>", :path => File.expand_path("../../../..", __FILE__)
7
+
8
+ group :test do
9
+ gem "mysql"
10
+ gem "shoulda"
11
+ gem "mocha"
12
+ gem "capybara"
13
+ gem "launchy"
14
+ end
@@ -0,0 +1,11 @@
1
+ development:
2
+ adapter: sqlite3
3
+ database: db/development.sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+ test:
7
+ adapter: mysql
8
+ database: <%= gem_name %>_test
9
+ username: root
10
+ password: <%%= mysql_password %>
11
+ host: 127.0.0.1
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: sqlite3
3
+ database: db/development.sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+ test:
7
+ adapter: sqlite3
8
+ database: db/test.sqlite3
9
+ pool: 5
10
+ timeout: 5000
File without changes
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <title>Test Application - Rails <%= Rails::VERSION::STRING %></title>
4
+ <%= stylesheet_link_tag "app" %>
5
+ </head>
6
+ <body>
7
+ <div id="page">
8
+ <%= yield %>
9
+ </div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,2 @@
1
+ ActiveRecord::Schema.define(:version => 19820801133704) do
2
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Major.create(:name => 'Daley', :city => cities.first)
@@ -0,0 +1,40 @@
1
+ require File.expand_path("../../../suit_application.rb", __FILE__)
2
+
3
+ SuitApplication.test
4
+
5
+ class ExampleTest < GemSuit::IntegrationTest
6
+
7
+ context "My example test" do
8
+ setup do
9
+ end
10
+
11
+ teardown do
12
+ SuitApplication.restore_all
13
+ end
14
+
15
+ should "assert css as expected" do
16
+ visit "/"
17
+ assert page.has_css? "div#page"
18
+ assert page.has_no_css? "div#paul_engel"
19
+
20
+ # Hello World ;)
21
+ page.execute_script <<-SCRIPT
22
+ var div = document.createElement("div");
23
+ div.innerHTML = "<h2>Hi. This is an GemSuit example test!</h2><p><br>Closing in <span id='seconds'>10</span> seconds.</p>";
24
+ var divs = document.getElementsByTagName("div");
25
+ for (var i = 0; i < divs.length; i++) {
26
+ if (divs[i].className == "left") {
27
+ divs[i].appendChild(div);
28
+ }
29
+ }
30
+ SCRIPT
31
+
32
+ # Counting down
33
+ 10.times do |i|
34
+ sleep 1
35
+ page.execute_script "document.getElementById('seconds').innerHTML = '#{9 - i}';"
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,36 @@
1
+ module GemSuit
2
+ class IntegrationTest
3
+
4
+ # def login
5
+ # visit "/login"
6
+ # fill_in_and_submit "form#login", {:Email => "paul.engel@holder.nl", :Password => "test"}, "Login"
7
+ # end
8
+
9
+ # def logout
10
+ # find("a#logout").click_link "Logout"
11
+ # end
12
+
13
+ # def fill_in_and_submit(selector, with, submit)
14
+ # within "#{selector} fieldset.inputs" do
15
+ # with.each do |key, value|
16
+ # begin
17
+ # fill_in key.to_s, :with => value
18
+ # rescue Selenium::WebDriver::Error::ElementNotDisplayedError
19
+ # page.execute_script "var input = $('#{selector} [name=\"#{key}\"]');" +
20
+ # "if (input.data('cleditor')) {" +
21
+ # " input.val('#{value}');" +
22
+ # " input.data('cleditor').updateFrame();" +
23
+ # "}"
24
+ # end
25
+ # end
26
+ # end
27
+ # find(selector).find_button(submit).click
28
+ # sleep 2
29
+ # end
30
+
31
+ # def say_hello
32
+ # page.execute_script "Hello, you!"
33
+ # end
34
+
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ require "rubygems"
2
+ require "gem_suit"
3
+
4
+ class SuitApplication < GemSuit::Application
5
+
6
+ # def description
7
+ # "My first GemSuit integration test"
8
+ # end
9
+
10
+ # def prepare
11
+ # generate_something
12
+ # end
13
+
14
+ # def config_for_template(path)
15
+ # case path
16
+ # when "Gemfile"
17
+ # {"rails_gem_version" => "3.0.5"}
18
+ # end
19
+ # end
20
+
21
+ private
22
+
23
+ # def generate_something
24
+ # generate "your_generator", "some_parameter"
25
+ # end
26
+
27
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ ActiveRecord::Schema.define(:version => 19820801133704) do
2
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_suit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Paul Engel
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-13 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rich_support
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 27
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 0
34
+ version: 0.1.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: thor
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 43
46
+ segments:
47
+ - 0
48
+ - 14
49
+ - 6
50
+ version: 0.14.6
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: capybara
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 111
62
+ segments:
63
+ - 0
64
+ - 4
65
+ - 1
66
+ - 2
67
+ version: 0.4.1.2
68
+ type: :runtime
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
71
+ name: launchy
72
+ prerelease: false
73
+ requirement: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ hash: 15
79
+ segments:
80
+ - 0
81
+ - 4
82
+ - 0
83
+ version: 0.4.0
84
+ type: :runtime
85
+ version_requirements: *id004
86
+ description: Test the entire usage workflow (including the generators) of your newly generated or existing gem within Rails 2 and 3 and make the gem development mobile
87
+ email:
88
+ - paul.engel@holder.nl
89
+ executables:
90
+ - suit
91
+ extensions: []
92
+
93
+ extra_rdoc_files: []
94
+
95
+ files:
96
+ - .gitignore
97
+ - .suit
98
+ - CHANGELOG.rdoc
99
+ - Gemfile
100
+ - MIT-LICENSE
101
+ - README.textile
102
+ - Rakefile
103
+ - VERSION
104
+ - bin/suit
105
+ - gem_suit.gemspec
106
+ - lib/gem_suit.rb
107
+ - lib/gem_suit/application.rb
108
+ - lib/gem_suit/application/actions.rb
109
+ - lib/gem_suit/application/test.rb
110
+ - lib/gem_suit/application/utils.rb
111
+ - lib/gem_suit/application/utils/gemfile.rb
112
+ - lib/gem_suit/cli.rb
113
+ - lib/gem_suit/cli/application.rb
114
+ - lib/gem_suit/cli/application/io_buffer.rb
115
+ - lib/gem_suit/cli/application/test_loader.rb
116
+ - lib/gem_suit/cli/base.rb
117
+ - lib/gem_suit/cli/base/shell.rb
118
+ - lib/gem_suit/cli/base/utils.rb
119
+ - lib/gem_suit/cli/builder.rb
120
+ - lib/gem_suit/cli/builder/boot
121
+ - lib/gem_suit/cli/builder/generator.rb
122
+ - lib/gem_suit/cli/builder/rails_app.rb
123
+ - lib/gem_suit/cli/config.rb
124
+ - lib/gem_suit/cli/config/hash.rb
125
+ - lib/gem_suit/integration_test.rb
126
+ - lib/gem_suit/test_help.rb
127
+ - lib/gem_suit/version.rb
128
+ - templates/dynamic/CHANGELOG.rdoc
129
+ - templates/dynamic/Gemfile
130
+ - templates/dynamic/MIT-LICENSE
131
+ - templates/dynamic/README.textile
132
+ - templates/dynamic/VERSION
133
+ - templates/dynamic/config/boot.rb
134
+ - templates/dynamic/config/preinitializer.rb
135
+ - templates/dynamic/gitignore
136
+ - templates/dynamic/suit/shared/app/views/application/index.html.erb
137
+ - templates/dynamic/suit/shared/public/stylesheets/app.css
138
+ - templates/dynamic/suit/shared/test/test_helper.rb
139
+ - templates/dynamic/suit/templates/shared/Gemfile
140
+ - templates/dynamic/suit/templates/shared/config/database-mysql.yml
141
+ - templates/dynamic/suit/templates/shared/config/database-sqlite.yml
142
+ - templates/static/suit/shared/app/models/.gitkeep
143
+ - templates/static/suit/shared/app/views/layouts/application.html.erb
144
+ - templates/static/suit/shared/db/schema.rb
145
+ - templates/static/suit/shared/db/seeds.rb
146
+ - templates/static/suit/shared/test/fixtures/.gitkeep
147
+ - templates/static/suit/shared/test/integration/suit/example.rb
148
+ - templates/static/suit/shared/test/suit_application.rb
149
+ - templates/static/suit/shared/test/suit_application/capybara_extensions.rb
150
+ - templates/static/suit/shared/test/unit/.gitkeep
151
+ - templates/static/suit/templates/shared/config/initializers/.gitkeep
152
+ - templates/static/suit/templates/shared/db/schema.rb
153
+ has_rdoc: true
154
+ homepage: https://github.com/archan937/gem_suit
155
+ licenses: []
156
+
157
+ post_install_message:
158
+ rdoc_options: []
159
+
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ hash: 3
177
+ segments:
178
+ - 0
179
+ version: "0"
180
+ requirements: []
181
+
182
+ rubyforge_project: gem_suit
183
+ rubygems_version: 1.6.2
184
+ signing_key:
185
+ specification_version: 3
186
+ summary: Test the entire usage workflow (including the generators) of your newly generated or existing gem within Rails 2 and 3 and make the gem development mobile
187
+ test_files: []
188
+