raygun 0.0.24 → 0.0.25

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.
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.25 [2013-02-20]
4
+
5
+ * Generated controller specs now pass without intervention.
6
+ * Generated view specs use factory_girl's build_stubbed instead of rspec's stub_model, expect() syntax, and 1.9 hash syntax.
7
+ * Initialize git and create an initial commit (thanks @blakeeb).
8
+
3
9
  ## 0.0.24 [2013-02-14]
4
10
 
5
11
  * Upgrade to ruby-1.9.3-p385 (thanks @mechfish).
@@ -18,7 +18,8 @@ describe <%= controller_class_name %>Controller do
18
18
  end
19
19
 
20
20
  before do
21
- login_user build :user
21
+ # TODO Set to :user and specify authorization rules in Ability.rb.
22
+ login_user build :admin
22
23
  end
23
24
 
24
25
  <% unless options[:singleton] -%>
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
+ describe "<%= ns_table_name %>/edit" do
5
+ before(:each) do
6
+ @<%= ns_file_name %> = assign(:<%= ns_file_name %>, build_stubbed(:<%= class_name.underscore %>))
7
+ end
8
+
9
+ it "renders the edit <%= ns_file_name %> form" do
10
+ render
11
+
12
+ assert_select "form", action: <%= index_helper %>_path(@<%= ns_file_name %>), method: "post" do
13
+ <% for attribute in output_attributes -%>
14
+ assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", name: "<%= ns_file_name %>[<%= attribute.name %>]"
15
+ <% end -%>
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
+ describe "<%= ns_table_name %>/index" do
5
+ before(:each) do
6
+ assign(:<%= table_name %>, [
7
+ <% [1,2].each_with_index do |id, model_index| -%>
8
+ build_stubbed(:<%= class_name.underscore %><%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : ',' %>
9
+ <% output_attributes.each_with_index do |attribute, attribute_index| -%>
10
+ <%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
11
+ <% end -%>
12
+ <% if !output_attributes.empty? -%>
13
+ <%= model_index == 1 ? ')' : '),' %>
14
+ <% end -%>
15
+ <% end -%>
16
+ ])
17
+ end
18
+
19
+ it "renders a list of <%= ns_table_name %>" do
20
+ render
21
+
22
+ <% for attribute in output_attributes -%>
23
+ assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 2
24
+ <% end -%>
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
+ describe "<%= ns_table_name %>/new" do
5
+ before(:each) do
6
+ assign(:<%= ns_file_name %>, build_stubbed(:<%= class_name.underscore %>))
7
+ end
8
+
9
+ it "renders new <%= ns_file_name %> form" do
10
+ render
11
+
12
+ assert_select "form", action: <%= index_helper %>_path, method: "post" do
13
+ <% for attribute in output_attributes -%>
14
+ assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", name: "<%= ns_file_name %>[<%= attribute.name %>]"
15
+ <% end -%>
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
+ describe "<%= ns_table_name %>/show" do
5
+ before(:each) do
6
+ @<%= ns_file_name %> = assign(:<%= ns_file_name %>, build_stubbed(:<%= class_name.underscore %>))
7
+ end
8
+
9
+ it "renders attributes" do
10
+ render
11
+
12
+ <% for attribute in output_attributes -%>
13
+ expect(rendered).to match(/<%= eval(value_for(attribute)) %>/)
14
+ <% end -%>
15
+ end
16
+ end
@@ -2,10 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "users/edit" do
4
4
  before(:each) do
5
- @user = assign(:user, stub_model(User,
6
- email: "MyString",
7
- name: "MyString"
8
- ))
5
+ @user = assign(:user, build_stubbed(:user))
9
6
  end
10
7
 
11
8
  it "renders the edit user form" do
@@ -3,14 +3,8 @@ require 'spec_helper'
3
3
  describe "users/index" do
4
4
  before(:each) do
5
5
  assign(:users, [
6
- stub_model(User,
7
- email: "Email",
8
- name: "Name"
9
- ),
10
- stub_model(User,
11
- email: "Email",
12
- name: "Name"
13
- )
6
+ build_stubbed(:user, name: "Name", email: "Email"),
7
+ build_stubbed(:user, name: "Name", email: "Email")
14
8
  ])
15
9
  end
16
10
 
@@ -2,10 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "users/new" do
4
4
  before(:each) do
5
- assign(:user, stub_model(User,
6
- email: "MyString",
7
- name: "MyString"
8
- ).as_new_record)
5
+ assign(:user, build_stubbed(:user))
9
6
  end
10
7
 
11
8
  it "renders new user form" do
@@ -2,10 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "users/show" do
4
4
  before(:each) do
5
- @user = assign(:user, stub_model(User,
6
- email: "Email",
7
- name: "Name"
8
- ))
5
+ @user = assign(:user, build_stubbed(:user))
9
6
  end
10
7
 
11
8
  it "renders attributes in <p>" do
data/bin/raygun CHANGED
@@ -41,6 +41,7 @@ module Raygun
41
41
 
42
42
  def configure_new_app
43
43
  update_ruby_version
44
+ initialize_git
44
45
  end
45
46
 
46
47
  def update_ruby_version
@@ -55,6 +56,14 @@ module Raygun
55
56
  end
56
57
  end
57
58
 
59
+ def initialize_git
60
+ Dir.chdir(app_dir) do
61
+ shell 'git init'
62
+ shell 'git add -A .'
63
+ shell 'git commit -m "raygun-zapped skeleton"'
64
+ end
65
+ end
66
+
58
67
  def print_plan
59
68
  puts
60
69
  puts "Creating new app #{camel_name} in directory #{app_dir}..."
@@ -1,3 +1,3 @@
1
1
  module Raygun
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: raygun
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.24
5
+ version: 0.0.25
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Nelson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-14 00:00:00.000000000 Z
14
+ date: 2013-02-20 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: Carbon Five Rails application generator
17
17
  email:
@@ -117,6 +117,10 @@ files:
117
117
  - app_prototype/lib/tasks/spec.rake
118
118
  - app_prototype/lib/templates/rails/scaffold_controller/controller.rb
119
119
  - app_prototype/lib/templates/rspec/scaffold/controller_spec.rb
120
+ - app_prototype/lib/templates/rspec/scaffold/edit_spec.rb
121
+ - app_prototype/lib/templates/rspec/scaffold/index_spec.rb
122
+ - app_prototype/lib/templates/rspec/scaffold/new_spec.rb
123
+ - app_prototype/lib/templates/rspec/scaffold/show_spec.rb
120
124
  - app_prototype/lib/templates/slim/scaffold/_form.html.slim
121
125
  - app_prototype/lib/templates/slim/scaffold/edit.html.slim
122
126
  - app_prototype/lib/templates/slim/scaffold/index.html.slim