bdd-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d651a0976475a44824b13a183ba1ce371cb1e66f
4
+ data.tar.gz: 8d1e3472e1d295f5030c97e5c8992e0e36731d71
5
+ SHA512:
6
+ metadata.gz: 74f1ea26f86284b5e32eabe1e97bf05d5f3329b12c6426fb15042b9b9a1492bf93721cefcd4a696dcbd005d597db154d050a54fbb94e622793841eefb3557289
7
+ data.tar.gz: a02dc8e961f0ab7746ca0c1e13aa1ca162c4f672f4e798796fc595197bdee9ce0db8cdd9610c8414fa102f1f15bdf0a87124a21c7ddba6ca655210a4b7c5609e
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bdd-rails (0.0.1)
5
+ bundler
6
+ rails
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.6)
12
+ actionpack (= 4.2.6)
13
+ actionview (= 4.2.6)
14
+ activejob (= 4.2.6)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.6)
18
+ actionview (= 4.2.6)
19
+ activesupport (= 4.2.6)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.6)
25
+ activesupport (= 4.2.6)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ activejob (4.2.6)
31
+ activesupport (= 4.2.6)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.6)
34
+ activesupport (= 4.2.6)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.6)
37
+ activemodel (= 4.2.6)
38
+ activesupport (= 4.2.6)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.6)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ arel (6.0.3)
47
+ builder (3.2.2)
48
+ concurrent-ruby (1.0.1)
49
+ erubis (2.7.0)
50
+ globalid (0.3.6)
51
+ activesupport (>= 4.1.0)
52
+ i18n (0.7.0)
53
+ json (1.8.3)
54
+ loofah (2.0.3)
55
+ nokogiri (>= 1.5.9)
56
+ mail (2.6.4)
57
+ mime-types (>= 1.16, < 4)
58
+ mime-types (3.0)
59
+ mime-types-data (~> 3.2015)
60
+ mime-types-data (3.2016.0221)
61
+ mini_portile2 (2.0.0)
62
+ minitest (5.8.4)
63
+ nokogiri (1.6.7.2)
64
+ mini_portile2 (~> 2.0.0.rc2)
65
+ rack (1.6.4)
66
+ rack-test (0.6.3)
67
+ rack (>= 1.0)
68
+ rails (4.2.6)
69
+ actionmailer (= 4.2.6)
70
+ actionpack (= 4.2.6)
71
+ actionview (= 4.2.6)
72
+ activejob (= 4.2.6)
73
+ activemodel (= 4.2.6)
74
+ activerecord (= 4.2.6)
75
+ activesupport (= 4.2.6)
76
+ bundler (>= 1.3.0, < 2.0)
77
+ railties (= 4.2.6)
78
+ sprockets-rails
79
+ rails-deprecated_sanitizer (1.0.3)
80
+ activesupport (>= 4.2.0.alpha)
81
+ rails-dom-testing (1.0.7)
82
+ activesupport (>= 4.2.0.beta, < 5.0)
83
+ nokogiri (~> 1.6.0)
84
+ rails-deprecated_sanitizer (>= 1.0.1)
85
+ rails-html-sanitizer (1.0.3)
86
+ loofah (~> 2.0)
87
+ railties (4.2.6)
88
+ actionpack (= 4.2.6)
89
+ activesupport (= 4.2.6)
90
+ rake (>= 0.8.7)
91
+ thor (>= 0.18.1, < 2.0)
92
+ rake (11.1.2)
93
+ sprockets (3.5.2)
94
+ concurrent-ruby (~> 1.0)
95
+ rack (> 1, < 3)
96
+ sprockets-rails (3.0.4)
97
+ actionpack (>= 4.0)
98
+ activesupport (>= 4.0)
99
+ sprockets (>= 3.0.0)
100
+ thor (0.19.1)
101
+ thread_safe (0.3.5)
102
+ tzinfo (1.2.2)
103
+ thread_safe (~> 0.1)
104
+
105
+ PLATFORMS
106
+ ruby
107
+
108
+ DEPENDENCIES
109
+ bdd-rails!
110
+ rake
111
+
112
+ BUNDLED WITH
113
+ 1.10.6
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # BDD Rails: A starter kit
2
+
3
+ Hello there! So you think BDD is a great way to talk about software? Are you
4
+ ready to codify some of those conversations? Do you build apps in rails? If
5
+ so you've come to the right place.
6
+
7
+ `bdd-rails` was built to provide a set of generators for a rails app. We provide
8
+ an opinionated setup for using rspec + capybara to feature test your
9
+ application.
10
+
11
+ ## BDD starts with conversations
12
+
13
+ Many think BDD is about a certain testing style, it is and it isn't. BDD is much
14
+ more about the conversations around the desired and undesired behaviour of a
15
+ system.
16
+
17
+ If you're not having conversations about your system in a BDD style then that
18
+ is where you should start!
19
+
20
+ ## Codifying Behaviour
21
+
22
+ Coming soon...
23
+
24
+ ## Creating a new rails app
25
+
26
+ Firstly, make sure you have rails installed!
27
+
28
+ ```
29
+ gem install rails
30
+ ```
31
+
32
+ Now let's create a new app!
33
+
34
+ ```
35
+ rails new --skip-test-unit my_bdd_app
36
+ cd my_bdd_app
37
+ ```
38
+
39
+ Next we want to install `bdd-rails`:
40
+
41
+ ```
42
+ echo "gem 'bdd-rails', path: '../../'" >> Gemfile
43
+ bundle
44
+ ```
45
+
46
+ And finally we want to install our BDD setup in your rails app:
47
+
48
+ ```
49
+ bundle exec rails g bdd_rails:install
50
+ ```
51
+
52
+ Now you can run your (empty) test suite:
53
+
54
+ ```
55
+ bundle exec rspec
56
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
data/bdd-rails.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'bdd_rails/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'bdd-rails'
7
+ spec.version = BddRails::VERSION
8
+ spec.authors = ['Luke Morton']
9
+ spec.email = ['luke@madetech.com']
10
+
11
+ spec.summary = %q{A starter kit for testing BDD in rails}
12
+ spec.homepage = 'https://github.com/madetech/bdd-rails'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_dependency 'rails'
19
+ spec.add_dependency 'bundler'
20
+
21
+ spec.add_development_dependency 'rake'
22
+ end
data/lib/bdd-rails.rb ADDED
@@ -0,0 +1 @@
1
+ require 'bdd_rails'
@@ -0,0 +1,52 @@
1
+ module BddRails
2
+ class InstallGenerator < ::Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def install_spec_directory
6
+ directory 'spec'
7
+ end
8
+
9
+ def add_dot_rspec
10
+ copy_file '.rspec'
11
+ end
12
+
13
+ def add_gems
14
+ gem_group :test do
15
+ gem 'capybara'
16
+ gem 'database_cleaner'
17
+ gem 'factory_girl'
18
+ gem 'ffaker'
19
+ gem 'rspec-its'
20
+ gem 'rspec-rails'
21
+ end
22
+
23
+ bundle_command :install
24
+ end
25
+
26
+ private
27
+
28
+ def bundle_command(command)
29
+ say_status :run, "bundle #{command}"
30
+
31
+ # We are going to shell out rather than invoking Bundler::CLI.new(command)
32
+ # because `rails new` loads the Thor gem and on the other hand bundler uses
33
+ # its own vendored Thor, which could be a different version. Running both
34
+ # things in the same process is a recipe for a night with paracetamol.
35
+ #
36
+ # We unset temporary bundler variables to load proper bundler and Gemfile.
37
+ #
38
+ # Thanks to James Tucker for the Gem tricks involved in this call.
39
+ _bundle_command = Gem.bin_path('bundler', 'bundle')
40
+
41
+ require 'bundler'
42
+ Bundler.with_clean_env do
43
+ full_command = %Q["#{Gem.ruby}" "#{_bundle_command}" #{command}]
44
+ if options[:quiet]
45
+ system(full_command, out: File::NULL)
46
+ else
47
+ system(full_command)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails/railtie'
2
+
3
+ module BddRails
4
+ class Rails
5
+ class Railtie < ::Rails::Railtie
6
+ generators do
7
+ require 'bdd_rails/install_generator'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
@@ -0,0 +1,28 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '4.2.4'
4
+
5
+ group :test do
6
+ gem 'brakeman' # Always latest
7
+ gem 'cane', '2.6.2'
8
+ gem 'capybara', '2.4.1'
9
+ gem 'database_cleaner', '1.5.1'
10
+ gem 'factory_girl', '4.5.0'
11
+ gem 'ffaker', '1.32.1'
12
+ gem 'rspec-its', '1.0.1'
13
+ gem 'rspec-rails', '3.2.1'
14
+ gem 'rspec', '3.2.0'
15
+ gem 'scss-lint', '~> 0.37.0'
16
+ gem 'tailor', '1.4.1'
17
+ end
18
+
19
+ group :development do
20
+ gem 'spring'
21
+ gem 'quiet_assets'
22
+ end
23
+
24
+ group :development, :test do
25
+ gem 'dotenv-rails'
26
+ gem 'pry-byebug'
27
+ gem 'pry-rails'
28
+ end
@@ -0,0 +1,6 @@
1
+ # Factories
2
+
3
+ We use `factory_girl`. Please name files like `model_factory.rb`, so for a
4
+ factory for the User model you'd create a file called `user_factory.rb`.
5
+
6
+ More info: https://github.com/thoughtbot/factory_girl
@@ -0,0 +1 @@
1
+ # Feature tests
@@ -0,0 +1,12 @@
1
+ # Please leave this file as is
2
+ #
3
+ # If you would like to add configuration for your rspec test suite
4
+ # add a well named file into the support/ directory.
5
+ #
6
+ # Prefix your file name with a number if the load order is important.
7
+ #
8
+ # For more information head to https://github.com/lukemorton/bdd-rails
9
+ #
10
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each do |support_file|
11
+ require support_file
12
+ end
@@ -0,0 +1,5 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../../config/environment', __FILE__)
3
+ require 'rspec/rails'
4
+
5
+ ActiveRecord::Migration.maintain_test_schema!
@@ -0,0 +1,2 @@
1
+ require 'capybara/rails'
2
+ require 'capybara/rspec'
@@ -0,0 +1,9 @@
1
+ require 'database_cleaner'
2
+
3
+ RSpec.configure do |config|
4
+ config.use_transactional_fixtures = false
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.clean_with(:truncation)
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ require 'factory_girl'
2
+
3
+ FactoryGirl.definition_file_paths << File.join('spec', 'factories')
4
+ FactoryGirl.find_definitions
5
+
6
+ RSpec.configure do |config|
7
+ config.include FactoryGirl::Syntax::Methods
8
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.before :example do
3
+ ActionMailer::Base.deliveries.clear
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |expectations|
3
+ expectations.syntax = :expect
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ RSpec.configure do |config|
2
+ config.mock_with :rspec do |mocks|
3
+ mocks.syntax = :expect
4
+
5
+ mocks.verify_partial_doubles = true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ RSpec.configure do |config|
2
+ if config.files_to_run.one?
3
+ config.default_formatter = 'doc'
4
+ end
5
+
6
+ config.profile_examples = 5
7
+ end
@@ -0,0 +1,7 @@
1
+ RSpec.configure do |config|
2
+ config.filter_run :focus
3
+ config.run_all_when_everything_filtered = true
4
+ config.infer_spec_type_from_file_location!
5
+ config.order = :random
6
+ Kernel.srand config.seed
7
+ end
@@ -0,0 +1,3 @@
1
+ module BddRails
2
+ VERSION = '0.0.1'
3
+ end
data/lib/bdd_rails.rb ADDED
@@ -0,0 +1 @@
1
+ require 'bdd_rails/railtie'
data/test.sh ADDED
@@ -0,0 +1,10 @@
1
+ cd example
2
+ rails new --skip-test-unit $1
3
+ cd $1
4
+ echo "gem 'bdd-rails', path: '../../'" >> Gemfile
5
+ bundle
6
+ spring stop
7
+ bundle exec rails g bdd_rails:install
8
+ cd ..
9
+ rm -rf $1
10
+ cd ..
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bdd-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Luke Morton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - luke@madetech.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - README.md
66
+ - Rakefile
67
+ - bdd-rails.gemspec
68
+ - lib/bdd-rails.rb
69
+ - lib/bdd_rails.rb
70
+ - lib/bdd_rails/install_generator.rb
71
+ - lib/bdd_rails/railtie.rb
72
+ - lib/bdd_rails/templates/.rspec
73
+ - lib/bdd_rails/templates/Gemfile
74
+ - lib/bdd_rails/templates/spec/factories/README.md
75
+ - lib/bdd_rails/templates/spec/features/README.md
76
+ - lib/bdd_rails/templates/spec/spec_helper.rb
77
+ - lib/bdd_rails/templates/spec/support/01_rails.rb
78
+ - lib/bdd_rails/templates/spec/support/capybara.rb
79
+ - lib/bdd_rails/templates/spec/support/database_cleaner.rb
80
+ - lib/bdd_rails/templates/spec/support/factory_girl.rb
81
+ - lib/bdd_rails/templates/spec/support/mail_cleaner.rb
82
+ - lib/bdd_rails/templates/spec/support/rspec_expectations.rb
83
+ - lib/bdd_rails/templates/spec/support/rspec_mocks.rb
84
+ - lib/bdd_rails/templates/spec/support/rspec_output.rb
85
+ - lib/bdd_rails/templates/spec/support/rspec_run_conditions.rb
86
+ - lib/bdd_rails/version.rb
87
+ - test.sh
88
+ homepage: https://github.com/madetech/bdd-rails
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.5.1
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: A starter kit for testing BDD in rails
112
+ test_files: []