stachio 0.0.6 → 0.1.0
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/.gitignore +1 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +7 -3
- data/Appraisals +13 -0
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +5 -0
- data/Rakefile +3 -1
- data/app/controllers/stachio/application_controller.rb +11 -1
- data/app/controllers/stachio/templates_controller.rb +4 -6
- data/app/helpers/stachio/application_helper.rb +1 -1
- data/app/models/stachio/template.rb +2 -1
- data/gemfiles/rails_3.2.gemfile +8 -0
- data/gemfiles/rails_4.0.gemfile +7 -0
- data/gemfiles/rails_4.1.gemfile +7 -0
- data/lib/stachio.rb +2 -2
- data/lib/stachio/engine.rb +1 -1
- data/lib/stachio/readonly.rb +6 -0
- data/lib/stachio/version.rb +1 -1
- data/spec/controllers/stachio/templates_controller_spec.rb +39 -37
- data/spec/dummy/config/application.rb +2 -7
- data/spec/dummy/config/boot.rb +3 -2
- data/spec/dummy/config/environments/development.rb +0 -13
- data/spec/dummy/config/environments/test.rb +0 -6
- data/spec/models/stachio/template_spec.rb +23 -23
- data/spec/rails_helper.rb +67 -0
- data/spec/routing/stachio/templates_routing_spec.rb +10 -8
- data/spec/spec_helper.rb +73 -47
- data/stachio.gemspec +4 -3
- metadata +34 -40
- data/app/assets/images/stachio/.gitkeep +0 -0
- data/app/helpers/stachio/templates_helper.rb +0 -7
- data/spec/dummy/.ruby-version +0 -1
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb +0 -11
- data/spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb +0 -6
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/helpers/stachio/templates_helper_spec.rb +0 -17
- data/spec/requests/stachio/stachio_templates_spec.rb +0 -11
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rspec
    CHANGED
    
    
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.9.3- | 
| 1 | 
            +
            1.9.3-p547
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -2,8 +2,12 @@ language: ruby | |
| 2 2 | 
             
            rvm:
         | 
| 3 3 | 
             
              - 2.0.0
         | 
| 4 4 | 
             
              - 1.9.3
         | 
| 5 | 
            -
              -  | 
| 5 | 
            +
              - rbx-2
         | 
| 6 6 | 
             
            env:
         | 
| 7 7 | 
             
              - DB=sqlite
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            gemfile:
         | 
| 10 | 
            +
              - gemfiles/rails_3.2.gemfile
         | 
| 11 | 
            +
              - gemfiles/rails_4.0.gemfile
         | 
| 12 | 
            +
              - gemfiles/rails_4.1.gemfile
         | 
| 13 | 
            +
             | 
    
        data/Appraisals
    ADDED
    
    
    
        data/{MIT-LICENSE → LICENSE}
    RENAMED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -4,3 +4,8 @@ Stachio is a rails engine which aims to facilitate the creation, retrieval, | |
| 4 4 | 
             
            update, & deletion of mustache templates in a relational database.
         | 
| 5 5 |  | 
| 6 6 | 
             
            [](https://travis-ci.org/bwthomas/stachio)
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            **NOTE:** If you are using Rails 3, you must install the `strong_parameters` gem manually.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            ## License
         | 
| 11 | 
            +
            [MIT](http://opensource.org/licenses/MIT). See [LICENSE](LICENSE).
         | 
    
        data/Rakefile
    CHANGED
    
    
| @@ -1,7 +1,17 @@ | |
| 1 1 | 
             
            module Stachio
         | 
| 2 2 | 
             
              class ApplicationController < ActionController::Base
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                protected
         | 
| 5 | 
            +
             | 
| 3 6 | 
             
                def readonly
         | 
| 4 | 
            -
                   | 
| 7 | 
            +
                  Stachio.readonly
         | 
| 5 8 | 
             
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def permission
         | 
| 11 | 
            +
                  return true unless readonly
         | 
| 12 | 
            +
                  flash[:notice] = "Templates are readonly"
         | 
| 13 | 
            +
                  redirect_to :action => :index
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 6 16 | 
             
              end
         | 
| 7 17 | 
             
            end
         | 
| @@ -47,7 +47,7 @@ module Stachio | |
| 47 47 | 
             
                # POST /templates
         | 
| 48 48 | 
             
                # POST /templates.json
         | 
| 49 49 | 
             
                def create
         | 
| 50 | 
            -
                  @template = Template.new( | 
| 50 | 
            +
                  @template = Template.new(template_params)
         | 
| 51 51 |  | 
| 52 52 | 
             
                  respond_to do |format|
         | 
| 53 53 | 
             
                    if @template.save
         | 
| @@ -66,7 +66,7 @@ module Stachio | |
| 66 66 | 
             
                  @template = Template.find(params[:id])
         | 
| 67 67 |  | 
| 68 68 | 
             
                  respond_to do |format|
         | 
| 69 | 
            -
                    if @template.update_attributes( | 
| 69 | 
            +
                    if @template.update_attributes(template_params)
         | 
| 70 70 | 
             
                      format.html { redirect_to @template, notice: 'Template was successfully updated.' }
         | 
| 71 71 | 
             
                      format.json { head :no_content }
         | 
| 72 72 | 
             
                    else
         | 
| @@ -90,10 +90,8 @@ module Stachio | |
| 90 90 |  | 
| 91 91 | 
             
                private
         | 
| 92 92 |  | 
| 93 | 
            -
                def  | 
| 94 | 
            -
                   | 
| 95 | 
            -
                  flash[:notice] = "Templates are readonly"
         | 
| 96 | 
            -
                  redirect_to :action => :index
         | 
| 93 | 
            +
                def template_params
         | 
| 94 | 
            +
                  params.require(:template).permit(:template_name, :description, :content)
         | 
| 97 95 | 
             
                end
         | 
| 98 96 | 
             
              end
         | 
| 99 97 | 
             
            end
         | 
| @@ -2,9 +2,10 @@ module Stachio | |
| 2 2 | 
             
              Mustache.raise_on_context_miss = true
         | 
| 3 3 |  | 
| 4 4 | 
             
              class Template < ActiveRecord::Base
         | 
| 5 | 
            +
                include ActiveModel::ForbiddenAttributesProtection
         | 
| 6 | 
            +
             | 
| 5 7 | 
             
                lookup_by :template_name
         | 
| 6 8 |  | 
| 7 | 
            -
                attr_accessible :template_name, :description, :content
         | 
| 8 9 | 
             
                validates_presence_of :template_name, :content
         | 
| 9 10 |  | 
| 10 11 | 
             
                attr_accessor :presents, :rendered
         | 
    
        data/lib/stachio.rb
    CHANGED
    
    
    
        data/lib/stachio/engine.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ module Stachio | |
| 9 9 | 
             
                require "stache"     ## use mustache/handlebars for views
         | 
| 10 10 | 
             
                Stache.use :mustache
         | 
| 11 11 |  | 
| 12 | 
            -
                config.readonly = (defined?(Rails) && Rails.env.production?) ? true : false
         | 
| 12 | 
            +
                # config.readonly = (defined?(Rails) && Rails.env.production?) ? true : false
         | 
| 13 13 |  | 
| 14 14 | 
             
                config.generators do |g|
         | 
| 15 15 | 
             
                  g.test_framework :rspec
         | 
    
        data/lib/stachio/version.rb
    CHANGED
    
    
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require ' | 
| 1 | 
            +
            require 'rails_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            # This spec was generated by rspec-rails when you ran the scaffold generator.
         | 
| 4 4 | 
             
            # It demonstrates how one might use RSpec to specify the controller code that
         | 
| @@ -20,6 +20,8 @@ require 'spec_helper' | |
| 20 20 |  | 
| 21 21 | 
             
            module Stachio
         | 
| 22 22 | 
             
              describe TemplatesController do
         | 
| 23 | 
            +
                routes { Stachio::Engine.routes }
         | 
| 24 | 
            +
             | 
| 23 25 | 
             
                # 'render_views' will render any erb /haml/whatever as part of the tests, thus
         | 
| 24 26 | 
             
                # providing some (minimal) assurance that nothing stupid was done
         | 
| 25 27 | 
             
                render_views
         | 
| @@ -42,14 +44,14 @@ module Stachio | |
| 42 44 | 
             
                  it "assigns all templates as @templates" do
         | 
| 43 45 | 
             
                    template = Template.create! valid_attributes
         | 
| 44 46 | 
             
                    get :index, {}, valid_session
         | 
| 45 | 
            -
                    assigns(:templates). | 
| 47 | 
            +
                    expect(assigns(:templates)).to eq([template])
         | 
| 46 48 | 
             
                  end
         | 
| 47 49 |  | 
| 48 50 | 
             
                  it "does not require permission" do
         | 
| 49 | 
            -
                     | 
| 51 | 
            +
                    allow(controller).to receive(:readonly).and_return(true)
         | 
| 50 52 | 
             
                    template = Template.create! valid_attributes
         | 
| 51 53 | 
             
                    get :index, {}, valid_session
         | 
| 52 | 
            -
                    response. | 
| 54 | 
            +
                    expect(response).not_to redirect_to(templates_path)
         | 
| 53 55 | 
             
                  end
         | 
| 54 56 | 
             
                end
         | 
| 55 57 |  | 
| @@ -57,53 +59,53 @@ module Stachio | |
| 57 59 | 
             
                  it "assigns the requested template as @template" do
         | 
| 58 60 | 
             
                    template = Template.create! valid_attributes
         | 
| 59 61 | 
             
                    get :show, {:id => template.to_param}, valid_session
         | 
| 60 | 
            -
                    assigns(:template). | 
| 62 | 
            +
                    expect(assigns(:template)).to eq(template)
         | 
| 61 63 | 
             
                  end
         | 
| 62 64 |  | 
| 63 65 | 
             
                  it "does not require permission" do
         | 
| 64 | 
            -
                     | 
| 66 | 
            +
                    allow(controller).to receive(:readonly).and_return(true)
         | 
| 65 67 | 
             
                    template = Template.create! valid_attributes
         | 
| 66 68 | 
             
                    get :show, {:id => template.to_param}, valid_session
         | 
| 67 | 
            -
                    response. | 
| 69 | 
            +
                    expect(response).not_to redirect_to(templates_path)
         | 
| 68 70 | 
             
                  end
         | 
| 69 71 | 
             
                end
         | 
| 70 72 |  | 
| 71 73 | 
             
                describe "GET new" do
         | 
| 72 74 | 
             
                  it "requires permission" do
         | 
| 73 | 
            -
                     | 
| 75 | 
            +
                    allow(controller).to receive(:readonly).and_return(true)
         | 
| 74 76 | 
             
                    get :new, {}, valid_session
         | 
| 75 | 
            -
                    response. | 
| 77 | 
            +
                    expect(response).to redirect_to(templates_path)
         | 
| 76 78 | 
             
                  end
         | 
| 77 79 |  | 
| 78 80 | 
             
                  it "assigns a new template as @template" do
         | 
| 79 81 | 
             
                    get :new, {}, valid_session
         | 
| 80 | 
            -
                    assigns(:template). | 
| 82 | 
            +
                    expect(assigns(:template)).to be_a_new(Template)
         | 
| 81 83 | 
             
                  end
         | 
| 82 84 | 
             
                end
         | 
| 83 85 |  | 
| 84 86 | 
             
                describe "GET edit" do
         | 
| 85 87 | 
             
                  it "requires permission" do
         | 
| 86 | 
            -
                     | 
| 88 | 
            +
                    allow(controller).to receive(:readonly).and_return(true)
         | 
| 87 89 | 
             
                    template = Template.create! valid_attributes
         | 
| 88 90 | 
             
                    get :edit, {:id => template.to_param}, valid_session
         | 
| 89 | 
            -
                    response. | 
| 91 | 
            +
                    expect(response).to redirect_to(templates_path)
         | 
| 90 92 | 
             
                  end
         | 
| 91 93 |  | 
| 92 94 | 
             
                  it "assigns the requested template as @template" do
         | 
| 93 95 | 
             
                    template = Template.create! valid_attributes
         | 
| 94 96 | 
             
                    get :edit, {:id => template.to_param}, valid_session
         | 
| 95 | 
            -
                    assigns(:template). | 
| 97 | 
            +
                    expect(assigns(:template)).to eq(template)
         | 
| 96 98 | 
             
                  end
         | 
| 97 99 | 
             
                end
         | 
| 98 100 |  | 
| 99 101 | 
             
                describe "POST create" do
         | 
| 100 102 | 
             
                  describe "with valid params" do
         | 
| 101 103 | 
             
                    it "requires permission" do
         | 
| 102 | 
            -
                       | 
| 104 | 
            +
                      allow(controller).to receive(:readonly).and_return(true)
         | 
| 103 105 | 
             
                      expect {
         | 
| 104 106 | 
             
                        post :create, {:template => valid_attributes}, valid_session
         | 
| 105 | 
            -
                      }.to_not change(Template, :count) | 
| 106 | 
            -
                      response. | 
| 107 | 
            +
                      }.to_not change(Template, :count)
         | 
| 108 | 
            +
                      expect(response).to redirect_to(templates_path)
         | 
| 107 109 | 
             
                    end
         | 
| 108 110 |  | 
| 109 111 | 
             
                    it "creates a new Template" do
         | 
| @@ -114,29 +116,29 @@ module Stachio | |
| 114 116 |  | 
| 115 117 | 
             
                    it "assigns a newly created template as @template" do
         | 
| 116 118 | 
             
                      post :create, {:template => valid_attributes}, valid_session
         | 
| 117 | 
            -
                      assigns(:template). | 
| 118 | 
            -
                      assigns(:template). | 
| 119 | 
            +
                      expect(assigns(:template)).to be_a(Template)
         | 
| 120 | 
            +
                      expect(assigns(:template)).to be_persisted
         | 
| 119 121 | 
             
                    end
         | 
| 120 122 |  | 
| 121 123 | 
             
                    it "redirects to the created template" do
         | 
| 122 124 | 
             
                      post :create, {:template => valid_attributes}, valid_session
         | 
| 123 | 
            -
                      response. | 
| 125 | 
            +
                      expect(response).to redirect_to(Template.last)
         | 
| 124 126 | 
             
                    end
         | 
| 125 127 | 
             
                  end
         | 
| 126 128 |  | 
| 127 129 | 
             
                  describe "with invalid params" do
         | 
| 128 130 | 
             
                    it "assigns a newly created but unsaved template as @template" do
         | 
| 129 131 | 
             
                      # Trigger the behavior that occurs when invalid params are submitted
         | 
| 130 | 
            -
                      Template. | 
| 132 | 
            +
                      allow_any_instance_of(Template).to receive(:save).and_return(false)
         | 
| 131 133 | 
             
                      post :create, {:template => { "template_name" => "invalid value" }}, valid_session
         | 
| 132 | 
            -
                      assigns(:template). | 
| 134 | 
            +
                      expect(assigns(:template)).to be_a_new(Template)
         | 
| 133 135 | 
             
                    end
         | 
| 134 136 |  | 
| 135 137 | 
             
                    it "re-renders the 'new' template" do
         | 
| 136 138 | 
             
                      # Trigger the behavior that occurs when invalid params are submitted
         | 
| 137 | 
            -
                      Template. | 
| 139 | 
            +
                      allow_any_instance_of(Template).to receive(:save).and_return(false)
         | 
| 138 140 | 
             
                      post :create, {:template => { "template_name" => "invalid value" }}, valid_session
         | 
| 139 | 
            -
                      response. | 
| 141 | 
            +
                      expect(response).to render_template("new")
         | 
| 140 142 | 
             
                    end
         | 
| 141 143 | 
             
                  end
         | 
| 142 144 | 
             
                end
         | 
| @@ -145,10 +147,10 @@ module Stachio | |
| 145 147 | 
             
                  describe "with valid params" do
         | 
| 146 148 | 
             
                    it "requires permission" do
         | 
| 147 149 | 
             
                      template = Template.create! valid_attributes
         | 
| 148 | 
            -
                       | 
| 149 | 
            -
                      Template. | 
| 150 | 
            +
                      allow(controller).to receive(:readonly).and_return(true)
         | 
| 151 | 
            +
                      expect_any_instance_of(Template).not_to receive(:update_attributes).with({ "template_name" => "MyString" })
         | 
| 150 152 | 
             
                      put :update, {:id => template.to_param, :template => { "template_name" => "MyString" }}, valid_session
         | 
| 151 | 
            -
                      response. | 
| 153 | 
            +
                      expect(response).to redirect_to(templates_path)
         | 
| 152 154 | 
             
                    end
         | 
| 153 155 |  | 
| 154 156 | 
             
                    it "updates the requested template" do
         | 
| @@ -157,20 +159,20 @@ module Stachio | |
| 157 159 | 
             
                      # specifies that the Template created on the previous line
         | 
| 158 160 | 
             
                      # receives the :update_attributes message with whatever params are
         | 
| 159 161 | 
             
                      # submitted in the request.
         | 
| 160 | 
            -
                      Template. | 
| 162 | 
            +
                      expect_any_instance_of(Template).to receive(:update_attributes).with({ "template_name" => "MyString" })
         | 
| 161 163 | 
             
                      put :update, {:id => template.to_param, :template => { "template_name" => "MyString" }}, valid_session
         | 
| 162 164 | 
             
                    end
         | 
| 163 165 |  | 
| 164 166 | 
             
                    it "assigns the requested template as @template" do
         | 
| 165 167 | 
             
                      template = Template.create! valid_attributes
         | 
| 166 168 | 
             
                      put :update, {:id => template.to_param, :template => valid_attributes}, valid_session
         | 
| 167 | 
            -
                      assigns(:template). | 
| 169 | 
            +
                      expect(assigns(:template)).to eq(template)
         | 
| 168 170 | 
             
                    end
         | 
| 169 171 |  | 
| 170 172 | 
             
                    it "redirects to the template" do
         | 
| 171 173 | 
             
                      template = Template.create! valid_attributes
         | 
| 172 174 | 
             
                      put :update, {:id => template.to_param, :template => valid_attributes}, valid_session
         | 
| 173 | 
            -
                      response. | 
| 175 | 
            +
                      expect(response).to redirect_to(template)
         | 
| 174 176 | 
             
                    end
         | 
| 175 177 | 
             
                  end
         | 
| 176 178 |  | 
| @@ -178,17 +180,17 @@ module Stachio | |
| 178 180 | 
             
                    it "assigns the template as @template" do
         | 
| 179 181 | 
             
                      template = Template.create! valid_attributes
         | 
| 180 182 | 
             
                      # Trigger the behavior that occurs when invalid params are submitted
         | 
| 181 | 
            -
                      Template. | 
| 183 | 
            +
                      allow_any_instance_of(Template).to receive(:save).and_return(false)
         | 
| 182 184 | 
             
                      put :update, {:id => template.to_param, :template => { "template_name" => "invalid value" }}, valid_session
         | 
| 183 | 
            -
                      assigns(:template). | 
| 185 | 
            +
                      expect(assigns(:template)).to eq(template)
         | 
| 184 186 | 
             
                    end
         | 
| 185 187 |  | 
| 186 188 | 
             
                    it "re-renders the 'edit' template" do
         | 
| 187 189 | 
             
                      template = Template.create! valid_attributes
         | 
| 188 190 | 
             
                      # Trigger the behavior that occurs when invalid params are submitted
         | 
| 189 | 
            -
                      Template. | 
| 191 | 
            +
                      allow_any_instance_of(Template).to receive(:save).and_return(false)
         | 
| 190 192 | 
             
                      put :update, {:id => template.to_param, :template => { "template_name" => "invalid value" }}, valid_session
         | 
| 191 | 
            -
                      response. | 
| 193 | 
            +
                      expect(response).to render_template("edit")
         | 
| 192 194 | 
             
                    end
         | 
| 193 195 | 
             
                  end
         | 
| 194 196 | 
             
                end
         | 
| @@ -196,13 +198,13 @@ module Stachio | |
| 196 198 | 
             
                describe "DELETE destroy" do
         | 
| 197 199 | 
             
                  it "requires permission" do
         | 
| 198 200 | 
             
                    template = Template.create! valid_attributes
         | 
| 199 | 
            -
                     | 
| 201 | 
            +
                    allow(controller).to receive(:readonly).and_return(true)
         | 
| 200 202 |  | 
| 201 203 | 
             
                    expect {
         | 
| 202 204 | 
             
                      delete :destroy, {:id => template.to_param}, valid_session
         | 
| 203 | 
            -
                    }.to_not change(Template, :count) | 
| 205 | 
            +
                    }.to_not change(Template, :count)
         | 
| 204 206 |  | 
| 205 | 
            -
                    response. | 
| 207 | 
            +
                    expect(response).to redirect_to(templates_path)
         | 
| 206 208 | 
             
                  end
         | 
| 207 209 |  | 
| 208 210 | 
             
                  it "destroys the requested template" do
         | 
| @@ -216,7 +218,7 @@ module Stachio | |
| 216 218 | 
             
                    template = Template.create! valid_attributes
         | 
| 217 219 | 
             
                    delete :destroy, {:id => template.to_param}, valid_session
         | 
| 218 220 | 
             
                    #response.should redirect_to(templates_url)       ## Requires default_host_url to be set, but we're in an engine.
         | 
| 219 | 
            -
                    response. | 
| 221 | 
            +
                    expect(response).to redirect_to(templates_path)       ## So, instead, we test the redirection against the relative path
         | 
| 220 222 | 
             
                  end
         | 
| 221 223 | 
             
                end
         | 
| 222 224 |  | 
| @@ -4,7 +4,6 @@ require File.expand_path('../boot', __FILE__) | |
| 4 4 | 
             
            require "active_record/railtie"
         | 
| 5 5 | 
             
            require "action_controller/railtie"
         | 
| 6 6 | 
             
            require "action_mailer/railtie"
         | 
| 7 | 
            -
            require "active_resource/railtie"
         | 
| 8 7 | 
             
            require "sprockets/railtie"
         | 
| 9 8 | 
             
            # require "rails/test_unit/railtie"
         | 
| 10 9 |  | 
| @@ -50,17 +49,13 @@ module Dummy | |
| 50 49 | 
             
                # like if you have constraints or database-specific column types
         | 
| 51 50 | 
             
                # config.active_record.schema_format = :sql
         | 
| 52 51 |  | 
| 53 | 
            -
                # Enforce whitelist mode for mass assignment.
         | 
| 54 | 
            -
                # This will create an empty whitelist of attributes available for mass-assignment for all models
         | 
| 55 | 
            -
                # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
         | 
| 56 | 
            -
                # parameters by using an attr_accessible or attr_protected declaration.
         | 
| 57 | 
            -
                config.active_record.whitelist_attributes = true
         | 
| 58 | 
            -
             | 
| 59 52 | 
             
                # Enable the asset pipeline
         | 
| 60 53 | 
             
                config.assets.enabled = true
         | 
| 61 54 |  | 
| 62 55 | 
             
                # Version of your assets, change this if you want to expire all your assets
         | 
| 63 56 | 
             
                config.assets.version = '1.0'
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                config.active_record.whitelist_attributes = false if Rails::VERSION::MAJOR == 3
         | 
| 64 59 | 
             
              end
         | 
| 65 60 | 
             
            end
         | 
| 66 61 |  | 
    
        data/spec/dummy/config/boot.rb
    CHANGED
    
    | @@ -2,9 +2,10 @@ require 'rubygems' | |
| 2 2 | 
             
            gemfile = File.expand_path('../../../../Gemfile', __FILE__)
         | 
| 3 3 |  | 
| 4 4 | 
             
            if File.exist?(gemfile)
         | 
| 5 | 
            -
              ENV['BUNDLE_GEMFILE']  | 
| 5 | 
            +
              ENV['BUNDLE_GEMFILE'] ||= gemfile
         | 
| 6 6 | 
             
              require 'bundler'
         | 
| 7 7 | 
             
              Bundler.setup
         | 
| 8 8 | 
             
            end
         | 
| 9 9 |  | 
| 10 | 
            -
            $:.unshift File.expand_path('../../../../lib', __FILE__)
         | 
| 10 | 
            +
            $:.unshift File.expand_path('../../../../lib', __FILE__)
         | 
| 11 | 
            +
             | 
| @@ -6,9 +6,6 @@ Dummy::Application.configure do | |
| 6 6 | 
             
              # since you don't have to restart the web server when you make code changes.
         | 
| 7 7 | 
             
              config.cache_classes = false
         | 
| 8 8 |  | 
| 9 | 
            -
              # Log error messages when you accidentally call methods on nil.
         | 
| 10 | 
            -
              config.whiny_nils = true
         | 
| 11 | 
            -
             | 
| 12 9 | 
             
              # Show full error reports and disable caching
         | 
| 13 10 | 
             
              config.consider_all_requests_local       = true
         | 
| 14 11 | 
             
              config.action_controller.perform_caching = false
         | 
| @@ -19,16 +16,6 @@ Dummy::Application.configure do | |
| 19 16 | 
             
              # Print deprecation notices to the Rails logger
         | 
| 20 17 | 
             
              config.active_support.deprecation = :log
         | 
| 21 18 |  | 
| 22 | 
            -
              # Only use best-standards-support built into browsers
         | 
| 23 | 
            -
              config.action_dispatch.best_standards_support = :builtin
         | 
| 24 | 
            -
             | 
| 25 | 
            -
              # Raise exception on mass assignment protection for Active Record models
         | 
| 26 | 
            -
              config.active_record.mass_assignment_sanitizer = :strict
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              # Log the query plan for queries taking more than this (works
         | 
| 29 | 
            -
              # with SQLite, MySQL, and PostgreSQL)
         | 
| 30 | 
            -
              config.active_record.auto_explain_threshold_in_seconds = 0.5
         | 
| 31 | 
            -
             | 
| 32 19 | 
             
              # Do not compress assets
         | 
| 33 20 | 
             
              config.assets.compress = false
         | 
| 34 21 |  | 
| @@ -11,9 +11,6 @@ Dummy::Application.configure do | |
| 11 11 | 
             
              config.serve_static_assets = true
         | 
| 12 12 | 
             
              config.static_cache_control = "public, max-age=3600"
         | 
| 13 13 |  | 
| 14 | 
            -
              # Log error messages when you accidentally call methods on nil
         | 
| 15 | 
            -
              config.whiny_nils = true
         | 
| 16 | 
            -
             | 
| 17 14 | 
             
              # Show full error reports and disable caching
         | 
| 18 15 | 
             
              config.consider_all_requests_local       = true
         | 
| 19 16 | 
             
              config.action_controller.perform_caching = false
         | 
| @@ -29,9 +26,6 @@ Dummy::Application.configure do | |
| 29 26 | 
             
              # ActionMailer::Base.deliveries array.
         | 
| 30 27 | 
             
              config.action_mailer.delivery_method = :test
         | 
| 31 28 |  | 
| 32 | 
            -
              # Raise exception on mass assignment protection for Active Record models
         | 
| 33 | 
            -
              config.active_record.mass_assignment_sanitizer = :strict
         | 
| 34 | 
            -
             | 
| 35 29 | 
             
              # Print deprecation notices to the stderr
         | 
| 36 30 | 
             
              config.active_support.deprecation = :stderr
         | 
| 37 31 | 
             
            end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require ' | 
| 1 | 
            +
            require 'rails_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Stachio
         | 
| 4 4 | 
             
              describe Template do
         | 
| @@ -14,28 +14,28 @@ module Stachio | |
| 14 14 | 
             
                end
         | 
| 15 15 |  | 
| 16 16 | 
             
                it "stores templates in the database" do
         | 
| 17 | 
            -
                  template.save | 
| 18 | 
            -
                  Template.count. | 
| 19 | 
            -
                  Template.first. | 
| 17 | 
            +
                  expect(template.save!).to be_truthy
         | 
| 18 | 
            +
                  expect(Template.count).to eql(1)
         | 
| 19 | 
            +
                  expect(Template.first).to eq(template)
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 22 | 
             
                it "validates the presence of template_name" do
         | 
| 23 23 | 
             
                  template.template_name = ""
         | 
| 24 | 
            -
                  template. | 
| 24 | 
            +
                  expect(template).not_to be_valid
         | 
| 25 25 | 
             
                  template.template_name = "but i am a template!"
         | 
| 26 | 
            -
                  template. | 
| 26 | 
            +
                  expect(template).to be_valid
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 | 
             
                it "validates the presence of content" do
         | 
| 30 30 | 
             
                  template.content = ""
         | 
| 31 | 
            -
                  template. | 
| 31 | 
            +
                  expect(template).not_to be_valid
         | 
| 32 32 | 
             
                  template.content = "but i am a {{teapot}}!"
         | 
| 33 | 
            -
                  template. | 
| 33 | 
            +
                  expect(template).to be_valid
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 36 | 
             
                it "fetches templates from the database using the template name" do
         | 
| 37 37 | 
             
                  template.save!
         | 
| 38 | 
            -
                  template. | 
| 38 | 
            +
                  expect(template).to eq(Template['mrs.potts'])
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 41 | 
             
                it "reports an error when it can't compose the message" do
         | 
| @@ -45,44 +45,44 @@ module Stachio | |
| 45 45 |  | 
| 46 46 | 
             
                describe '#render' do
         | 
| 47 47 | 
             
                  it "renders using the content of the template" do
         | 
| 48 | 
            -
                    template.presents. | 
| 49 | 
            -
                    template.render. | 
| 48 | 
            +
                    expect(template.presents).to be_a_kind_of(Class)
         | 
| 49 | 
            +
                    expect(template.render).to eq("I am a TEAPOT")
         | 
| 50 50 | 
             
                  end
         | 
| 51 51 |  | 
| 52 52 | 
             
                  it "can render values from a hash" do
         | 
| 53 53 | 
             
                    template.presents = {:teapot => 'TEAPOT' }
         | 
| 54 | 
            -
                    template.render. | 
| 54 | 
            +
                    expect(template.render).to eq("I am a TEAPOT")
         | 
| 55 55 | 
             
                  end
         | 
| 56 56 |  | 
| 57 57 | 
             
                  it "renders nothing when presenting a nil" do
         | 
| 58 58 | 
             
                    template.presents = nil
         | 
| 59 | 
            -
                    template.render. | 
| 59 | 
            +
                    expect(template.render).to eq(nil)
         | 
| 60 60 | 
             
                  end
         | 
| 61 61 |  | 
| 62 62 | 
             
                  it "memoizes rendered text" do
         | 
| 63 | 
            -
                    template.render. | 
| 64 | 
            -
                    template.rendered. | 
| 63 | 
            +
                    expect(template.render).to   eq("I am a TEAPOT")
         | 
| 64 | 
            +
                    expect(template.rendered).to eq("I am a TEAPOT")
         | 
| 65 65 |  | 
| 66 66 | 
             
                    template.presents = {:teapot => 'HORSERADISH'}
         | 
| 67 67 |  | 
| 68 | 
            -
                    template.render. | 
| 69 | 
            -
                    template.rendered. | 
| 68 | 
            +
                    expect(template.render).to   eq("I am a TEAPOT")
         | 
| 69 | 
            +
                    expect(template.rendered).to eq("I am a TEAPOT")
         | 
| 70 70 | 
             
                  end
         | 
| 71 71 |  | 
| 72 72 | 
             
                  it "can be reset when memoized" do
         | 
| 73 | 
            -
                    template.render. | 
| 73 | 
            +
                    expect(template.render).to   eq("I am a TEAPOT")
         | 
| 74 74 | 
             
                    template.presents = {:teapot => 'HORSERADISH'}
         | 
| 75 75 |  | 
| 76 | 
            -
                    template.render. | 
| 77 | 
            -
                    template.render(:force => true). | 
| 76 | 
            +
                    expect(template.render).to                 eq("I am a TEAPOT")
         | 
| 77 | 
            +
                    expect(template.render(:force => true)).to eq("I am a HORSERADISH")
         | 
| 78 78 | 
             
                  end
         | 
| 79 79 | 
             
                end
         | 
| 80 80 |  | 
| 81 81 | 
             
                describe '#present' do
         | 
| 82 82 | 
             
                  it "sets attribute 'presents' & renders all at once" do
         | 
| 83 | 
            -
                    template.render. | 
| 84 | 
            -
                    template.present(:teapot => 'TURNIP'). | 
| 85 | 
            -
                    template.presents. | 
| 83 | 
            +
                    expect(template.render).to   eq("I am a TEAPOT")
         | 
| 84 | 
            +
                    expect(template.present(:teapot => 'TURNIP')).to eq("I am a TURNIP")
         | 
| 85 | 
            +
                    expect(template.presents).to eq({:teapot => 'TURNIP'})
         | 
| 86 86 | 
             
                  end
         | 
| 87 87 | 
             
                end
         | 
| 88 88 |  | 
| @@ -0,0 +1,67 @@ | |
| 1 | 
            +
            # This file is copied to spec/ when you run 'rails generate rspec:install'
         | 
| 2 | 
            +
            ENV["RAILS_ENV"] ||= 'test'
         | 
| 3 | 
            +
            require File.expand_path("../dummy/config/environment", __FILE__)
         | 
| 4 | 
            +
            require 'rspec/rails'
         | 
| 5 | 
            +
            require 'pry'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'simplecov'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            SimpleCov.start do
         | 
| 10 | 
            +
              add_filter                "vendor"
         | 
| 11 | 
            +
              add_filter                "spec"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              add_group "Models",       "app/models"
         | 
| 14 | 
            +
              add_group "Controllers",  "app/controllers"
         | 
| 15 | 
            +
            end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            # Add additional requires below this line. Rails is not loaded until this point!
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            # Requires supporting ruby files with custom matchers and macros, etc, in
         | 
| 20 | 
            +
            # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
         | 
| 21 | 
            +
            # run as spec files by default. This means that files in spec/support that end
         | 
| 22 | 
            +
            # in _spec.rb will both be required and run as specs, causing the specs to be
         | 
| 23 | 
            +
            # run twice. It is recommended that you do not name files matching this glob to
         | 
| 24 | 
            +
            # end with _spec.rb. You can configure this pattern with the --pattern
         | 
| 25 | 
            +
            # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
         | 
| 26 | 
            +
            #
         | 
| 27 | 
            +
            # The following line is provided for convenience purposes. It has the downside
         | 
| 28 | 
            +
            # of increasing the boot-up time by auto-requiring all files in the support
         | 
| 29 | 
            +
            # directory. Alternatively, in the individual `*_spec.rb` files, manually
         | 
| 30 | 
            +
            # require only the support files necessary.
         | 
| 31 | 
            +
            #
         | 
| 32 | 
            +
            # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            # Checks for pending migrations before tests are run.
         | 
| 35 | 
            +
            # If you are not using ActiveRecord, you can remove this line.
         | 
| 36 | 
            +
            if ActiveRecord::VERSION::MAJOR > 3
         | 
| 37 | 
            +
              if ActiveRecord::VERSION::MINOR > 0
         | 
| 38 | 
            +
                ActiveRecord::Migration.maintain_test_schema!
         | 
| 39 | 
            +
              else
         | 
| 40 | 
            +
                ActiveRecord::Migration.check_pending!
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            RSpec.configure do |config|
         | 
| 45 | 
            +
              # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
         | 
| 46 | 
            +
              config.fixture_path = "#{::Rails.root}/spec/fixtures"
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              # If you're not using ActiveRecord, or you'd prefer not to run each of your
         | 
| 49 | 
            +
              # examples within a transaction, remove the following line or assign false
         | 
| 50 | 
            +
              # instead of true.
         | 
| 51 | 
            +
              config.use_transactional_fixtures = true
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              # RSpec Rails can automatically mix in different behaviours to your tests
         | 
| 54 | 
            +
              # based on their file location, for example enabling you to call `get` and
         | 
| 55 | 
            +
              # `post` in specs under `spec/controllers`.
         | 
| 56 | 
            +
              #
         | 
| 57 | 
            +
              # You can disable this behaviour by removing the line below, and instead
         | 
| 58 | 
            +
              # explicitly tag your specs with their type, e.g.:
         | 
| 59 | 
            +
              #
         | 
| 60 | 
            +
              #     RSpec.describe UsersController, :type => :controller do
         | 
| 61 | 
            +
              #       # ...
         | 
| 62 | 
            +
              #     end
         | 
| 63 | 
            +
              #
         | 
| 64 | 
            +
              # The different available types are documented in the features, such as in
         | 
| 65 | 
            +
              # https://relishapp.com/rspec/rspec-rails/docs
         | 
| 66 | 
            +
              config.infer_spec_type_from_file_location!
         | 
| 67 | 
            +
            end
         | 
| @@ -1,35 +1,37 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'rails_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Stachio
         | 
| 4 4 | 
             
              describe TemplatesController do
         | 
| 5 | 
            +
                routes { Stachio::Engine.routes }
         | 
| 6 | 
            +
             | 
| 5 7 | 
             
                describe "routing" do
         | 
| 6 8 |  | 
| 7 9 | 
             
                  it "routes to #index" do
         | 
| 8 | 
            -
                    get("/"). | 
| 10 | 
            +
                    expect(get("/")).to route_to("stachio/templates#index")
         | 
| 9 11 | 
             
                  end
         | 
| 10 12 |  | 
| 11 13 | 
             
                  it "routes to #new" do
         | 
| 12 | 
            -
                    get("/new"). | 
| 14 | 
            +
                    expect(get("/new")).to route_to("stachio/templates#new")
         | 
| 13 15 | 
             
                  end
         | 
| 14 16 |  | 
| 15 17 | 
             
                  it "routes to #show" do
         | 
| 16 | 
            -
                    get("/1"). | 
| 18 | 
            +
                    expect(get("/1")).to route_to("stachio/templates#show", :id => "1")
         | 
| 17 19 | 
             
                  end
         | 
| 18 20 |  | 
| 19 21 | 
             
                  it "routes to #edit" do
         | 
| 20 | 
            -
                    get("/1/edit"). | 
| 22 | 
            +
                    expect(get("/1/edit")).to route_to("stachio/templates#edit", :id => "1")
         | 
| 21 23 | 
             
                  end
         | 
| 22 24 |  | 
| 23 25 | 
             
                  it "routes to #create" do
         | 
| 24 | 
            -
                    post("/"). | 
| 26 | 
            +
                    expect(post("/")).to route_to("stachio/templates#create")
         | 
| 25 27 | 
             
                  end
         | 
| 26 28 |  | 
| 27 29 | 
             
                  it "routes to #update" do
         | 
| 28 | 
            -
                    put("/1"). | 
| 30 | 
            +
                    expect(put("/1")).to route_to("stachio/templates#update", :id => "1")
         | 
| 29 31 | 
             
                  end
         | 
| 30 32 |  | 
| 31 33 | 
             
                  it "routes to #destroy" do
         | 
| 32 | 
            -
                    delete("/1"). | 
| 34 | 
            +
                    expect(delete("/1")).to route_to("stachio/templates#destroy", :id => "1")
         | 
| 33 35 | 
             
                  end
         | 
| 34 36 |  | 
| 35 37 | 
             
                end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,59 +1,85 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            #  | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
            #  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 1 | 
            +
            # This file was generated by the `rails generate rspec:install` command. Conventionally, all
         | 
| 2 | 
            +
            # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
         | 
| 3 | 
            +
            # The generated `.rspec` file contains `--require spec_helper` which will cause this
         | 
| 4 | 
            +
            # file to always be loaded, without a need to explicitly require it in any files.
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # Given that it is always loaded, you are encouraged to keep this file as
         | 
| 7 | 
            +
            # light-weight as possible. Requiring heavyweight dependencies from this file
         | 
| 8 | 
            +
            # will add to the boot time of your test suite on EVERY test run, even for an
         | 
| 9 | 
            +
            # individual file that may not need all of that loaded. Instead, consider making
         | 
| 10 | 
            +
            # a separate helper file that requires the additional dependencies and performs
         | 
| 11 | 
            +
            # the additional setup, and require it from the spec files that actually need it.
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            # The `.rspec` file also contains a few flags that are not defaults but that
         | 
| 14 | 
            +
            # users commonly want.
         | 
| 15 | 
            +
            #
         | 
| 16 | 
            +
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         | 
| 17 | 
            +
            RSpec.configure do |config|
         | 
| 18 | 
            +
              # rspec-expectations config goes here. You can use an alternate
         | 
| 19 | 
            +
              # assertion/expectation library such as wrong or the stdlib/minitest
         | 
| 20 | 
            +
              # assertions if you prefer.
         | 
| 21 | 
            +
              config.expect_with :rspec do |expectations|
         | 
| 22 | 
            +
                # This option will default to `true` in RSpec 4. It makes the `description`
         | 
| 23 | 
            +
                # and `failure_message` of custom matchers include text for helper methods
         | 
| 24 | 
            +
                # defined using `chain`, e.g.:
         | 
| 25 | 
            +
                # be_bigger_than(2).and_smaller_than(4).description
         | 
| 26 | 
            +
                #   # => "be bigger than 2 and smaller than 4"
         | 
| 27 | 
            +
                # ...rather than:
         | 
| 28 | 
            +
                #   # => "be bigger than 2"
         | 
| 29 | 
            +
                #expectations.include_chain_clauses_in_custom_matcher_descriptions = true
         | 
| 30 | 
            +
              end
         | 
| 20 31 |  | 
| 21 | 
            -
            #  | 
| 22 | 
            -
            #  | 
| 23 | 
            -
             | 
| 32 | 
            +
              # rspec-mocks config goes here. You can use an alternate test double
         | 
| 33 | 
            +
              # library (such as bogus or mocha) by changing the `mock_with` option here.
         | 
| 34 | 
            +
              config.mock_with :rspec do |mocks|
         | 
| 35 | 
            +
                # Prevents you from mocking or stubbing a method that does not exist on
         | 
| 36 | 
            +
                # a real object. This is generally recommended, and will default to
         | 
| 37 | 
            +
                # `true` in RSpec 4.
         | 
| 38 | 
            +
                mocks.verify_partial_doubles = false
         | 
| 39 | 
            +
              end
         | 
| 24 40 |  | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
              #  | 
| 29 | 
            -
              #
         | 
| 30 | 
            -
              #  | 
| 31 | 
            -
              #  | 
| 32 | 
            -
               | 
| 41 | 
            +
            # The settings below are suggested to provide a good initial experience
         | 
| 42 | 
            +
            # with RSpec, but feel free to customize to your heart's content.
         | 
| 43 | 
            +
            =begin
         | 
| 44 | 
            +
              # These two settings work together to allow you to limit a spec run
         | 
| 45 | 
            +
              # to individual examples or groups you care about by tagging them with
         | 
| 46 | 
            +
              # `:focus` metadata. When nothing is tagged with `:focus`, all examples
         | 
| 47 | 
            +
              # get run.
         | 
| 48 | 
            +
              config.filter_run :focus
         | 
| 49 | 
            +
              config.run_all_when_everything_filtered = true
         | 
| 33 50 |  | 
| 34 | 
            -
              #  | 
| 35 | 
            -
               | 
| 51 | 
            +
              # Limits the available syntax to the non-monkey patched syntax that is recommended.
         | 
| 52 | 
            +
              # For more details, see:
         | 
| 53 | 
            +
              #   - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
         | 
| 54 | 
            +
              #   - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
         | 
| 55 | 
            +
              #   - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
         | 
| 56 | 
            +
              config.disable_monkey_patching!
         | 
| 36 57 |  | 
| 37 | 
            -
              #  | 
| 38 | 
            -
              #  | 
| 39 | 
            -
              #  | 
| 40 | 
            -
              config. | 
| 58 | 
            +
              # Many RSpec users commonly either run the entire suite or an individual
         | 
| 59 | 
            +
              # file, and it's useful to allow more verbose output when running an
         | 
| 60 | 
            +
              # individual spec file.
         | 
| 61 | 
            +
              if config.files_to_run.one?
         | 
| 62 | 
            +
                # Use the documentation formatter for detailed output,
         | 
| 63 | 
            +
                # unless a formatter has already been configured
         | 
| 64 | 
            +
                # (e.g. via a command-line flag).
         | 
| 65 | 
            +
                config.default_formatter = 'doc'
         | 
| 66 | 
            +
              end
         | 
| 41 67 |  | 
| 42 | 
            -
              #  | 
| 43 | 
            -
              #  | 
| 44 | 
            -
              #  | 
| 45 | 
            -
              config. | 
| 68 | 
            +
              # Print the 10 slowest examples and example groups at the
         | 
| 69 | 
            +
              # end of the spec run, to help surface which specs are running
         | 
| 70 | 
            +
              # particularly slow.
         | 
| 71 | 
            +
              config.profile_examples = 10
         | 
| 46 72 |  | 
| 47 73 | 
             
              # Run specs in random order to surface order dependencies. If you find an
         | 
| 48 74 | 
             
              # order dependency and want to debug it, you can fix the order by providing
         | 
| 49 75 | 
             
              # the seed, which is printed after each run.
         | 
| 50 76 | 
             
              #     --seed 1234
         | 
| 51 | 
            -
              config.order =  | 
| 52 | 
            -
             | 
| 53 | 
            -
              # Mountable engine, y'all. Let's get the routing right.
         | 
| 54 | 
            -
              config.include Stachio::Engine.routes.url_helpers
         | 
| 77 | 
            +
              config.order = :random
         | 
| 55 78 |  | 
| 56 | 
            -
               | 
| 57 | 
            -
             | 
| 58 | 
            -
               | 
| 79 | 
            +
              # Seed global randomization in this process using the `--seed` CLI option.
         | 
| 80 | 
            +
              # Setting this allows you to use `--seed` to deterministically reproduce
         | 
| 81 | 
            +
              # test failures related to randomization by passing the same `--seed` value
         | 
| 82 | 
            +
              # as the one that triggered the failure.
         | 
| 83 | 
            +
              Kernel.srand config.seed
         | 
| 84 | 
            +
            =end
         | 
| 59 85 | 
             
            end
         | 
    
        data/stachio.gemspec
    CHANGED
    
    | @@ -12,11 +12,12 @@ Gem::Specification.new do |s| | |
| 12 12 | 
             
              s.homepage    = "https://github.com/bwthomas/stachio"
         | 
| 13 13 | 
             
              s.summary     = "Stash your Stache with Stachio."
         | 
| 14 14 | 
             
              s.description = "Stachio is a rails engine which aims to facilitate the creation, retrieval, update, & deletion of mustache templates in a relational database."
         | 
| 15 | 
            +
              s.license     = 'MIT'
         | 
| 15 16 |  | 
| 16 17 | 
             
              s.files         = `git ls-files`.split("\n")
         | 
| 17 18 | 
             
              s.test_files    = `git ls-files -- {test,spec}/*`.split("\n")
         | 
| 18 19 |  | 
| 19 | 
            -
              s.add_dependency "rails", " | 
| 20 | 
            +
              s.add_dependency "rails", ">= 3.2", "< 5.0"
         | 
| 20 21 | 
             
              s.add_dependency "lookup_by"
         | 
| 21 22 | 
             
              s.add_dependency "jquery-rails"           ## required by the dummy application
         | 
| 22 23 | 
             
              s.add_dependency "stache", "~> 1.0.2"     ## use mustache/handlebars for views
         | 
| @@ -24,10 +25,10 @@ Gem::Specification.new do |s| | |
| 24 25 | 
             
              s.add_dependency "handlebars"
         | 
| 25 26 |  | 
| 26 27 | 
             
              s.add_development_dependency "sqlite3"
         | 
| 27 | 
            -
              s.add_development_dependency "rspec-rails"
         | 
| 28 | 
            -
              s.add_development_dependency "rspec-fire"
         | 
| 28 | 
            +
              s.add_development_dependency "rspec-rails", '~> 3.1.0'
         | 
| 29 29 | 
             
              s.add_development_dependency 'simplecov'
         | 
| 30 30 | 
             
              s.add_development_dependency 'simplecov-rcov'
         | 
| 31 31 | 
             
              s.add_development_dependency 'rspec'
         | 
| 32 32 | 
             
              s.add_development_dependency 'pry'
         | 
| 33 | 
            +
              s.add_development_dependency 'appraisal'
         | 
| 33 34 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stachio
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,24 +10,30 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date:  | 
| 13 | 
            +
            date: 2014-10-07 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: rails
         | 
| 17 17 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 18 18 | 
             
                none: false
         | 
| 19 19 | 
             
                requirements:
         | 
| 20 | 
            -
                - -  | 
| 20 | 
            +
                - - ! '>='
         | 
| 21 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            +
                    version: '3.2'
         | 
| 23 | 
            +
                - - <
         | 
| 21 24 | 
             
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            -
                    version:  | 
| 25 | 
            +
                    version: '5.0'
         | 
| 23 26 | 
             
              type: :runtime
         | 
| 24 27 | 
             
              prerelease: false
         | 
| 25 28 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 29 | 
             
                none: false
         | 
| 27 30 | 
             
                requirements:
         | 
| 28 | 
            -
                - -  | 
| 31 | 
            +
                - - ! '>='
         | 
| 29 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 30 | 
            -
                    version: 3.2 | 
| 33 | 
            +
                    version: '3.2'
         | 
| 34 | 
            +
                - - <
         | 
| 35 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 36 | 
            +
                    version: '5.0'
         | 
| 31 37 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 32 38 | 
             
              name: lookup_by
         | 
| 33 39 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -129,19 +135,19 @@ dependencies: | |
| 129 135 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 130 136 | 
             
                none: false
         | 
| 131 137 | 
             
                requirements:
         | 
| 132 | 
            -
                - -  | 
| 138 | 
            +
                - - ~>
         | 
| 133 139 | 
             
                  - !ruby/object:Gem::Version
         | 
| 134 | 
            -
                    version:  | 
| 140 | 
            +
                    version: 3.1.0
         | 
| 135 141 | 
             
              type: :development
         | 
| 136 142 | 
             
              prerelease: false
         | 
| 137 143 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 138 144 | 
             
                none: false
         | 
| 139 145 | 
             
                requirements:
         | 
| 140 | 
            -
                - -  | 
| 146 | 
            +
                - - ~>
         | 
| 141 147 | 
             
                  - !ruby/object:Gem::Version
         | 
| 142 | 
            -
                    version:  | 
| 148 | 
            +
                    version: 3.1.0
         | 
| 143 149 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 144 | 
            -
              name:  | 
| 150 | 
            +
              name: simplecov
         | 
| 145 151 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 146 152 | 
             
                none: false
         | 
| 147 153 | 
             
                requirements:
         | 
| @@ -157,7 +163,7 @@ dependencies: | |
| 157 163 | 
             
                  - !ruby/object:Gem::Version
         | 
| 158 164 | 
             
                    version: '0'
         | 
| 159 165 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 160 | 
            -
              name: simplecov
         | 
| 166 | 
            +
              name: simplecov-rcov
         | 
| 161 167 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 162 168 | 
             
                none: false
         | 
| 163 169 | 
             
                requirements:
         | 
| @@ -173,7 +179,7 @@ dependencies: | |
| 173 179 | 
             
                  - !ruby/object:Gem::Version
         | 
| 174 180 | 
             
                    version: '0'
         | 
| 175 181 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 176 | 
            -
              name:  | 
| 182 | 
            +
              name: rspec
         | 
| 177 183 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 178 184 | 
             
                none: false
         | 
| 179 185 | 
             
                requirements:
         | 
| @@ -189,7 +195,7 @@ dependencies: | |
| 189 195 | 
             
                  - !ruby/object:Gem::Version
         | 
| 190 196 | 
             
                    version: '0'
         | 
| 191 197 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 192 | 
            -
              name:  | 
| 198 | 
            +
              name: pry
         | 
| 193 199 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 194 200 | 
             
                none: false
         | 
| 195 201 | 
             
                requirements:
         | 
| @@ -205,7 +211,7 @@ dependencies: | |
| 205 211 | 
             
                  - !ruby/object:Gem::Version
         | 
| 206 212 | 
             
                    version: '0'
         | 
| 207 213 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 208 | 
            -
              name:  | 
| 214 | 
            +
              name: appraisal
         | 
| 209 215 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 210 216 | 
             
                none: false
         | 
| 211 217 | 
             
                requirements:
         | 
| @@ -234,15 +240,14 @@ files: | |
| 234 240 | 
             
            - .ruby-version
         | 
| 235 241 | 
             
            - .simplecov
         | 
| 236 242 | 
             
            - .travis.yml
         | 
| 243 | 
            +
            - Appraisals
         | 
| 237 244 | 
             
            - Gemfile
         | 
| 238 | 
            -
            -  | 
| 245 | 
            +
            - LICENSE
         | 
| 239 246 | 
             
            - README.md
         | 
| 240 247 | 
             
            - Rakefile
         | 
| 241 | 
            -
            - app/assets/images/stachio/.gitkeep
         | 
| 242 248 | 
             
            - app/controllers/stachio/application_controller.rb
         | 
| 243 249 | 
             
            - app/controllers/stachio/templates_controller.rb
         | 
| 244 250 | 
             
            - app/helpers/stachio/application_helper.rb
         | 
| 245 | 
            -
            - app/helpers/stachio/templates_helper.rb
         | 
| 246 251 | 
             
            - app/models/stachio/template.rb
         | 
| 247 252 | 
             
            - app/views/layouts/stachio/application.html.erb
         | 
| 248 253 | 
             
            - app/views/stachio/templates/_form.html.erb
         | 
| @@ -253,20 +258,21 @@ files: | |
| 253 258 | 
             
            - config/routes.rb
         | 
| 254 259 | 
             
            - db/migrate/20130509172418_create_stachio_templates.rb
         | 
| 255 260 | 
             
            - db/migrate/20130529130543_add_description_to_stachio_templates.rb
         | 
| 261 | 
            +
            - gemfiles/rails_3.2.gemfile
         | 
| 262 | 
            +
            - gemfiles/rails_4.0.gemfile
         | 
| 263 | 
            +
            - gemfiles/rails_4.1.gemfile
         | 
| 256 264 | 
             
            - lib/stachio.rb
         | 
| 257 265 | 
             
            - lib/stachio/engine.rb
         | 
| 266 | 
            +
            - lib/stachio/readonly.rb
         | 
| 258 267 | 
             
            - lib/stachio/version.rb
         | 
| 259 268 | 
             
            - lib/tasks/stachio_tasks.rake
         | 
| 260 269 | 
             
            - script/rails
         | 
| 261 270 | 
             
            - spec/controllers/stachio/templates_controller_spec.rb
         | 
| 262 271 | 
             
            - spec/dummy/.rspec
         | 
| 263 | 
            -
            - spec/dummy/.ruby-version
         | 
| 264 272 | 
             
            - spec/dummy/README.md
         | 
| 265 273 | 
             
            - spec/dummy/Rakefile
         | 
| 266 274 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 267 275 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 268 | 
            -
            - spec/dummy/app/mailers/.gitkeep
         | 
| 269 | 
            -
            - spec/dummy/app/models/.gitkeep
         | 
| 270 276 | 
             
            - spec/dummy/app/views/layouts/application.html.erb
         | 
| 271 277 | 
             
            - spec/dummy/config.ru
         | 
| 272 278 | 
             
            - spec/dummy/config/application.rb
         | 
| @@ -284,24 +290,20 @@ files: | |
| 284 290 | 
             
            - spec/dummy/config/initializers/wrap_parameters.rb
         | 
| 285 291 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 286 292 | 
             
            - spec/dummy/config/routes.rb
         | 
| 287 | 
            -
            - spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb
         | 
| 288 | 
            -
            - spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb
         | 
| 289 293 | 
             
            - spec/dummy/db/schema.rb
         | 
| 290 | 
            -
            - spec/dummy/lib/assets/.gitkeep
         | 
| 291 | 
            -
            - spec/dummy/log/.gitkeep
         | 
| 292 294 | 
             
            - spec/dummy/public/404.html
         | 
| 293 295 | 
             
            - spec/dummy/public/422.html
         | 
| 294 296 | 
             
            - spec/dummy/public/500.html
         | 
| 295 297 | 
             
            - spec/dummy/public/favicon.ico
         | 
| 296 298 | 
             
            - spec/dummy/script/rails
         | 
| 297 | 
            -
            - spec/helpers/stachio/templates_helper_spec.rb
         | 
| 298 299 | 
             
            - spec/models/stachio/template_spec.rb
         | 
| 299 | 
            -
            - spec/ | 
| 300 | 
            +
            - spec/rails_helper.rb
         | 
| 300 301 | 
             
            - spec/routing/stachio/templates_routing_spec.rb
         | 
| 301 302 | 
             
            - spec/spec_helper.rb
         | 
| 302 303 | 
             
            - stachio.gemspec
         | 
| 303 304 | 
             
            homepage: https://github.com/bwthomas/stachio
         | 
| 304 | 
            -
            licenses: | 
| 305 | 
            +
            licenses:
         | 
| 306 | 
            +
            - MIT
         | 
| 305 307 | 
             
            post_install_message: 
         | 
| 306 308 | 
             
            rdoc_options: []
         | 
| 307 309 | 
             
            require_paths:
         | 
| @@ -314,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 314 316 | 
             
                  version: '0'
         | 
| 315 317 | 
             
                  segments:
         | 
| 316 318 | 
             
                  - 0
         | 
| 317 | 
            -
                  hash:  | 
| 319 | 
            +
                  hash: 1862475971077471142
         | 
| 318 320 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 319 321 | 
             
              none: false
         | 
| 320 322 | 
             
              requirements:
         | 
| @@ -323,23 +325,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 323 325 | 
             
                  version: '0'
         | 
| 324 326 | 
             
                  segments:
         | 
| 325 327 | 
             
                  - 0
         | 
| 326 | 
            -
                  hash:  | 
| 328 | 
            +
                  hash: 1862475971077471142
         | 
| 327 329 | 
             
            requirements: []
         | 
| 328 330 | 
             
            rubyforge_project: 
         | 
| 329 | 
            -
            rubygems_version: 1.8.23
         | 
| 331 | 
            +
            rubygems_version: 1.8.23.2
         | 
| 330 332 | 
             
            signing_key: 
         | 
| 331 333 | 
             
            specification_version: 3
         | 
| 332 334 | 
             
            summary: Stash your Stache with Stachio.
         | 
| 333 335 | 
             
            test_files:
         | 
| 334 336 | 
             
            - spec/controllers/stachio/templates_controller_spec.rb
         | 
| 335 337 | 
             
            - spec/dummy/.rspec
         | 
| 336 | 
            -
            - spec/dummy/.ruby-version
         | 
| 337 338 | 
             
            - spec/dummy/README.md
         | 
| 338 339 | 
             
            - spec/dummy/Rakefile
         | 
| 339 340 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 340 341 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 341 | 
            -
            - spec/dummy/app/mailers/.gitkeep
         | 
| 342 | 
            -
            - spec/dummy/app/models/.gitkeep
         | 
| 343 342 | 
             
            - spec/dummy/app/views/layouts/application.html.erb
         | 
| 344 343 | 
             
            - spec/dummy/config.ru
         | 
| 345 344 | 
             
            - spec/dummy/config/application.rb
         | 
| @@ -357,18 +356,13 @@ test_files: | |
| 357 356 | 
             
            - spec/dummy/config/initializers/wrap_parameters.rb
         | 
| 358 357 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 359 358 | 
             
            - spec/dummy/config/routes.rb
         | 
| 360 | 
            -
            - spec/dummy/db/migrate/20130529132016_create_stachio_templates.stachio.rb
         | 
| 361 | 
            -
            - spec/dummy/db/migrate/20130529132017_add_description_to_stachio_templates.stachio.rb
         | 
| 362 359 | 
             
            - spec/dummy/db/schema.rb
         | 
| 363 | 
            -
            - spec/dummy/lib/assets/.gitkeep
         | 
| 364 | 
            -
            - spec/dummy/log/.gitkeep
         | 
| 365 360 | 
             
            - spec/dummy/public/404.html
         | 
| 366 361 | 
             
            - spec/dummy/public/422.html
         | 
| 367 362 | 
             
            - spec/dummy/public/500.html
         | 
| 368 363 | 
             
            - spec/dummy/public/favicon.ico
         | 
| 369 364 | 
             
            - spec/dummy/script/rails
         | 
| 370 | 
            -
            - spec/helpers/stachio/templates_helper_spec.rb
         | 
| 371 365 | 
             
            - spec/models/stachio/template_spec.rb
         | 
| 372 | 
            -
            - spec/ | 
| 366 | 
            +
            - spec/rails_helper.rb
         | 
| 373 367 | 
             
            - spec/routing/stachio/templates_routing_spec.rb
         | 
| 374 368 | 
             
            - spec/spec_helper.rb
         | 
| 
            File without changes
         | 
    
        data/spec/dummy/.ruby-version
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            1.9.3-p194
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/spec/dummy/log/.gitkeep
    DELETED
    
    | 
            File without changes
         | 
| @@ -1,17 +0,0 @@ | |
| 1 | 
            -
            require 'spec_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            # Specs in this file have access to a helper object that includes
         | 
| 4 | 
            -
            # the TemplatesHelper. For example:
         | 
| 5 | 
            -
            #
         | 
| 6 | 
            -
            # describe TemplatesHelper do
         | 
| 7 | 
            -
            #   describe "string concat" do
         | 
| 8 | 
            -
            #     it "concats two strings with spaces" do
         | 
| 9 | 
            -
            #       helper.concat_strings("this","that").should == "this that"
         | 
| 10 | 
            -
            #     end
         | 
| 11 | 
            -
            #   end
         | 
| 12 | 
            -
            # end
         | 
| 13 | 
            -
            module Stachio
         | 
| 14 | 
            -
              describe TemplatesHelper do
         | 
| 15 | 
            -
                pending "add some examples to (or delete) #{__FILE__}"
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
            end
         | 
| @@ -1,11 +0,0 @@ | |
| 1 | 
            -
            require 'spec_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            describe "Templates" do
         | 
| 4 | 
            -
              describe "GET /stachio_templates" do
         | 
| 5 | 
            -
                it "works! (now write some real specs)" do
         | 
| 6 | 
            -
                  # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
         | 
| 7 | 
            -
                  get templates_path
         | 
| 8 | 
            -
                  response.status.should be(200)
         | 
| 9 | 
            -
                end
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
            end
         |