smarter_listing 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fe16dceef655bf333e6334a686a84711c867ca9
4
- data.tar.gz: 12cd67339fae29899ccf6306702bcc4e10fdb326
3
+ metadata.gz: 327a347c94717d1f2311f0001a0aa527c365a713
4
+ data.tar.gz: b639ec9b44082b24ea6c46e6be279ddd0bf494c9
5
5
  SHA512:
6
- metadata.gz: b01c7e9dccb979d1fcc60512f93300f81a6e8da69494431ab42c979906884fedd1316f300abf28b5a05081d1332485a496db663d57d1afea3edcf84369a7eec5
7
- data.tar.gz: 6f9e06c26878c1ddb48e5a88053cc4a46fd133739b773400f1ba0496a4d29276516dd8b713fc630c20bf34b53720b96b7317e5605f8fd765f6f7e2b8c73fea0e
6
+ metadata.gz: 9d9f752feacad0d5477e4b24446d5d1e5551228383ab0e7abd2f802520aab14cd246e428e9a9156e35d7f438420f017046632542246ad4b96a4afbbe798fa6d0
7
+ data.tar.gz: f3b9e075f5a74d103fc9158353cd51ddc4f644075af391cc8879f146d0225718a89a06b172fd89fc768a4bae22eaa55c6b60c9cd9079e1f2bb13ab5736dda2f6
@@ -1,2 +1,2 @@
1
- <%= smart_listing_item collection_sym, :copy, resource, "#{current_engine}/#{collection_sym}/form" %>
1
+ <%= smart_listing_item collection_sym, :copy, resource, "#{current_engine}/#{collection_sym}/form.html" %>
2
2
  <%== render 'smarter_listing/form_logic' %>
@@ -1 +1 @@
1
- <%= smart_listing_item collection_sym, :create, resource, resource.valid? ? "#{current_engine}/#{collection_sym}/#{collection_action}" : "#{current_engine}/#{collection_sym}/form" %>
1
+ <%= smart_listing_item collection_sym, :create, resource, resource.valid? ? "#{current_engine}/#{collection_sym}/#{collection_action}" : "#{current_engine}/#{collection_sym}/form.html" %>
@@ -1,2 +1,2 @@
1
- <%= smart_listing_item collection_sym, :edit, resource, "#{current_engine}/#{collection_sym}/form" %>
1
+ <%= smart_listing_item collection_sym, :edit, resource, "#{current_engine}/#{collection_sym}/form.html" %>
2
2
  <%== render 'smarter_listing/form_logic' %>
@@ -1,2 +1,2 @@
1
- <%= smart_listing_item collection_sym, :new, resource, "#{current_engine}/#{collection_sym}/form" %>
1
+ <%= smart_listing_item collection_sym, :new, resource, "#{current_engine}/#{collection_sym}/form.html" %>
2
2
  <%== render 'smarter_listing/form_logic' %>
@@ -1 +1 @@
1
- <%= smart_listing_item collection_sym, :update, resource, resource.valid? ? "#{current_engine}/#{collection_sym}/#{collection_action}" : "#{current_engine}/#{collection_sym}/form" %>
1
+ <%= smart_listing_item collection_sym, :update, resource, resource.valid? ? "#{current_engine}/#{collection_sym}/#{collection_action}" : "#{current_engine}/#{collection_sym}/form.html" %>
@@ -1,3 +1,3 @@
1
1
  module SmarterListing
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -11,6 +11,7 @@ class ListingsControllerTest < ActionController::TestCase
11
11
  test 'correct layout' do
12
12
  get :index
13
13
  assert_template 'default'
14
+ assert_select '#layout', 'TAG'
14
15
  end
15
16
 
16
17
  test 'should have the methods from all helpers' do
@@ -24,12 +25,19 @@ class ListingsControllerTest < ActionController::TestCase
24
25
  test "should get index" do
25
26
  get :index
26
27
  assert_response :success
27
- assert_not_nil assigns(:listings)
28
+ assert_equal [@listing], assigns(:listings)
29
+ assert_select '#this_is_the_index', 'TAG'
30
+ assert_select 'table#the_table'
31
+ assert_select 'td', @listing.name
32
+ assert_select 'td', @listing.content
33
+ assert_select 'td.actions', 1
28
34
  end
29
35
 
30
36
  test "should get new" do
31
37
  xhr :get, :new, format: :js
32
38
  assert_response :success
39
+ assert_equal 'text/javascript', @response.content_type
40
+ assert_includes response.body, 'id=\\"the_form\\"'
33
41
  end
34
42
 
35
43
  test "should create listing" do
@@ -41,22 +49,27 @@ class ListingsControllerTest < ActionController::TestCase
41
49
  assert_response :success
42
50
  end
43
51
 
44
- test "should get edit" do
52
+ test 'should get edit' do
45
53
  xhr :get, :edit, id: @listing, format: :js
46
54
  assert_response :success
55
+ assert_equal 'text/javascript', @response.content_type
56
+ assert_includes response.body, 'id=\\"the_form\\"'
47
57
  end
48
58
 
49
- test "should update listing" do
59
+ test 'should update listing' do
50
60
  resource_params = {content: @listing.content, deleted_at: @listing.deleted_at, name: 'newName'}
51
61
  xhr :patch, :update, id: @listing, listing: resource_params, format: :js
52
62
  assert_empty @listing.errors
53
63
  assert_response :success
64
+ assert_includes response.body, '<td>newName<\\/td>'
65
+ assert_includes response.body, @listing.content
54
66
  end
55
67
 
56
- test "should destroy listing" do
68
+ test 'should destroy listing' do
57
69
  assert_difference('Listing.count', -1) do
58
70
  xhr :delete, :destroy, id: @listing, format: :js
59
71
  end
60
72
  assert_response :success
73
+ assert_select 'tr', 0
61
74
  end
62
75
  end
@@ -7,7 +7,7 @@
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
10
-
10
+ <div id="layout">TAG</div>
11
11
  <%= yield %>
12
12
 
13
13
  </body>
@@ -1,4 +1,4 @@
1
- <td colspan="6">
1
+ <td colspan="6" id="the_form">
2
2
  <%= form_for object, url: object.new_record? ? listings_path : listing_path(object), remote: true, html: {class: "form-horizontal"} do |f| %>
3
3
  <%= f.text_field :name %>
4
4
  <%= f.text_field :content %>
@@ -1,7 +1,8 @@
1
- <table class="table table-striped">
1
+ <table class="table table-striped" id="the_table">
2
2
  <tr>
3
3
  <th><%= smart_listing.sortable 'Name', :name %></th>
4
4
  <th><%= smart_listing.sortable 'Content', :content %></th>
5
+ </tr>
5
6
  <% smart_listing.collection.each do |lang| %>
6
7
  <tr class="editable" data-id="<%= lang.id %>">
7
8
  <%= smart_listing.render partial: 'listing', locals: {object: lang} %>
@@ -5,4 +5,5 @@
5
5
  Search
6
6
  </button>
7
7
  <% end %>
8
+ <div id="this_is_the_index">TAG</div>
8
9
  <%= smart_listing_render(:listings) %>
Binary file